Sunday, December 17, 2006

Ruby/Informix 0.4.0 released

Ruby/Informix is almost full-featured and closer to 1.0.0. Don't hesitate to e-mail me if you have any suggestion, comment, criticism, feature request, bug report or question.

In this release there are two new major features added: multiple connections to databases and scroll cursors.

The interface to scroll cursors provided by Ruby/Informix resembles that of Array objects for accessing elements. Besides prev, next, first, last and current for traversing a scroll cursor, it counts with [] and slice methods that let you access a scroll cursor as an Array:

customers = db.cursor('select * from customers', :scroll=>true)
customers[0] # => same as customers.first
customers[-1] # => same as customers.last
customers[2, 5] # => retrieves 5 records starting from the 3rd record

Just like Ruby Arrays, negative values for indices mean an offset from the end of the Array, being -1 the last element. Similarly, when using the [start, length] syntax, it retrieves an array of at most length elements starting from start. More details in the documentation.

Starting from this release, a Ruby gem will be provided for easily downloading, building and installing Ruby/Informix. Just type

gem install ruby-informix

from a command prompt on any platform supported.

Expect more exciting things to come for Ruby/Informix.

And just after releasing 0.4.0, there are news from IBM for officially supporting Ruby, according to Jerry Keesee, Director of the Informix Lab (read complete note here.) But this support won't be available until mid-2007.


srlopez said...

Hola amigo, en Suse SLES 64, estoy instalando ruby-informix y obtengo el siguiente error. ¿es un bug o estoy haciendo algo mal?
Gracias de antemano.

# gem install ruby-informix
Building native extensions. This could take a while...
ERROR: Error installing ruby-informix:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install ruby-informix
creating Makefile

gcc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/informix/incl/esql -fPIC -g -O2 -c informixc.c error: static declaration of ‘rb_cArray’ follows non-static declaration
/usr/lib/ruby/1.8/x86_64-linux/ruby.h:622: error: previous declaration of ‘rb_cArray’ was here
make: *** [informixc.o] Error 1

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ruby-informix-0.7.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ruby-informix-0.7.1/ext/gem_make.outbigsuse:

Gerardo Santana said...

Qué tal srlopez,

sí es un bug.

Por favor, elimina la declaración de rb_cArray, línea 52.

Una disculpa. La próxima versión estará reparada.

srlopez said...

Gracias Gerardo,
Tu consejo ha valido. He podido instalarlo modificando el Makefile ya que obtenía un error a la hora de compilar.
He añadido la linea

libdir64 = $(exec_prefix)/lib64

y modificado las lineas

libpath = . $(libdir64) /opt/IBM/informix/lib /opt/IBM/informix/lib/esql
LIBPATH = -L. -L$(libdir64) -Wl,-R$(libdir64) -L/opt/IBM/informix/lib -Wl,-R/opt/IBM/informix/lib -L/opt/IBM/informix/lib/esql -Wl,-R/opt/IBM/informix/lib/esql

del Makefile generado.

Así que me alegré mucho, pero ...
algo no he debido hacer bien ya que al correr los test, siempre obtengo el mismo mensaje

testcase.rb:1:in `require': no such file to load -- informix (LoadError)
from testcase.rb:1

Mis conocimientos de Ruby no me dan para solocionarlo yo solo.
Por favor Gerardo, dime que debo de hacer.
srlopez significa Santiago Rodrigo Lopez, y no "sr. Lopez"

Gerardo Santana said...

Después de la reestructuración de la biblioteca, los tests no pueden encontrar el binario, a menos que se instale.