I'm pleased to announce another release of Ruby/Informix, a Ruby
library for connecting to IBM Informix.
In this release you'll find support for the INTERVAL data type, more
handy methods and more and better documentation with examples, along
with a new web site.
Web site: http://ruby-informix.rubyforge.org/
Documentation: http://ruby-informix.rubyforge.org/doc/
Some examples:
Connecting to a database:
db = Informix.connect('stores')
Inserting records
stmt = db.prepare('insert into state values(?, ?)')
stmt.execute('CA', 'California')
Iterating over a table using a hash (shortcut):
db.each_hash('select * from customers') do |cust|
puts "#{cust['firstname']} #{cust['lastname']}"
end
Changelog follows:
0.7.0 03/31/2008
···
------------------
New features:
* Experimental support for the INTERVAL data type:
- year_to_month, day_to_fraction, from_months and from_seconds class
methods for creating an Interval object
- +@ and -@ unary operators
- +, * and / operations available with Integer, Rational, Date, Time
and DateTime objects
- methods for returning the respective fields of an Interval object
individually (years, months, days, hours, minutes and seconds)
- to_a method for returning the fields of an Interval object as an array
- methods for converting the Interval object to the given unit, where
apply (to_years, to_months, to_days, to_hours, to_minutes and
to_seconds)
- to_s method for displaying an Interval object as an string according
to ANSI SQL standards
- includes Comparable
* Database#version returns a struct with version information of the database
server.
* Database#each and Database#each_hash shortcut methods for declaring and
opening a cursor in a single step.
Contributed by Reid Morrison <reidmo at gmail>
* Database#execute is not an alias for Database#immediate any more.
It has become a shortcut for preparing and executing a statement in a
single step.
* SequentialCursor includes Enumerable
* Ruby 1.9 compatible
* More and better documentation
Bugs fixed:
* The documentation for class Error was not being recognized by rdoc
Remarks:
* Database.new deprecated in favor of Database.open
* Database#do was removed
* A lot of C code has been reimplemented in Ruby
* Modules and classes have been reorganized
* Database#execute still behaves the same, except that it can also accept
input parameters and return at most one record. Database#immediate is
more efficient though.
--
Gerardo Santana