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.open
customers[0] # => same as customers.first
customers[-1] # => same as customers.last
customers[2, 5] # => retrieves 5 records starting from the 3rd record
customers.drop


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.

Monday, November 27, 2006

Ruby/Informix 0.3.0 and Rails/Informix 0.1.0 released

Finally, the ActiveRecord adapter for IBM Informix Dynamic Server is ready for its first release. I have tested it succesfully on Solaris 9 and Windows XP with IDS 9.4 and IDS 10.

Eric Herber has been so kind as to cover Ruby/Informix at The Informix Zone as part of a review of database interfaces for popular scripting languages. The Informix Zone is an excellent resource for IBM's Secret Weapon, either if you're a long time Informix user or just curious about the exciting future that IBM is preparing for it.

Guy Bowerman also tested Rails/Informix succesfully and has posted a walkthrough, using Curt Hibb's "Rolling with Ruby on Rails" tutorial, using Informix 10 on Windows 2003. He explains
clearly how to get Ruby on Rails up an running with Informix. Don't forget to come back to Guy's blog for interesting articles about Informix development, among others.

Ruby/Informix 0.3.0 is released and this time includes initial support for Smart Large Objects (SLOB), you can create, read and write them.

Finally, it's sad that after getting the driver and the adapter working fine, it seems that I will be unable to rewrite that legacy, buggy, undocumented and insecure application (SIAPSEP) which started it all. I'm probably quitting my job in one month*.

Anyways, I hope everybody enjoys (Ruby|Rails)/Informix as much as I have. I'll try to keep adding features to them, while I still have access to Informix servers. After that I won't be able to maintain them any more. But the source is open, do whatever you want with them (it's BSD licensed after all!).

* I'll be free for hiring then, here's my résumé if you're interested.

Saturday, November 11, 2006

Ruby/Informix 0.2.1 released

This is a minor release after 0.2.0 that replaces calls to free() with xfree() to avoid crashes on Windows XP SP1.

I missed the announce of Ruby/Informix 0.2.0 which basically got new handy methods to fetch and iterate over records:

fetch_hash_many(n), fetch_hash_all
Fetch records as hashes. fetch_hash_many fetches n records at most, fetch_hash_all fetches all records as hashes. Both return an array.

each_by(n), each_hash_by(n)
Iterate by n records at a time.

fetch!, fetch_hash!, each!, each_hash!
Work the same as their counterparts without the "!" sign, except that these ones reduce the creation of objects, reusing the same ones in each call, which make them faster and memory savy.

I'm looking forward now to implement Smart Large Objects, which may help me with the ActiveRecord adapter.

Monday, April 10, 2006

Ruby/Informix 0.1.0 released!

Finally!, after a month and a half of working on it, as my day job permits, Ruby/Informix is ready for its first release. The Informix adapter for Ruby on Rails will probably follow soon!

Ruby/Informix is a Ruby extension for connecting to IBM Informix Dynamic Server, written in ESQL/C.

It provides a convenient interface for querying an Informix database the Ruby way and bringing the Informix power and flexibility to your Ruby programs.

This initial release has been heavily tested on Solaris/SPARC and has been reported to work on Linux Fedora and Windows XP. Please read the Changelog and README files for details.

Thanks to Matz for bringing the joy back to programming and IBM for maintaining this nice DBMS.

Home page: http://ruby-informix.rubyforge.org
Donwload: http://rubyforge.org/projects/ruby-informix/

Thursday, March 23, 2006

Informix adapter for Ruby on Rails, reloaded

Since my last post about the Informix extension for Ruby, I have been slowly adding features and testing it succesfully with real work at the office (thank you Rafael, Óscar and Andrey), at the point that we are already relying on it, for replacing SQR and ESQL/C (used for reports and batch database processes) with Ruby.

But the point of writing the extension was for having the foundation for an Informix adapter for Ruby on Rails ... for rewriting a legacy payroll application we are suffering from.

It wasn't much difficult to adapt the previous one based on Ruby ODBC to use the native driver. It was even easier to write than the rest of adapters, thanks to some methods implemented in the native driver ad-hoc for the job and to Informix's nobleness.

This adapter is faster than the previous one of course, and relies on less layers of software. I'm still cleaning it up, but you can mail me if you want to try it.

Friday, March 03, 2006

Informix driver for Ruby

I've been very busy at work, solving many legacy problems. One of them is the amount of unmaintainable, undocumented and buggy C programs for accessing an Informix database for generating ... reports. Another one is an insecure and unfriendly application made with an anachronic, unsupported and buggy application builder, with an Informix database as back-end.

I cannot describe enough how awful it looks, and behaves.

But I've always preferred to be part of the solution, not of the problem. It didn't take too much time to come to the conclusion that a web application would fit better, and that a better language for writing reports was needed.

Yes, a lot of work indeed. And not of my business by the way, I'm just "the DBA". But if solving problems is at your hand, why not do it? Besides, it will be fun.

This seemed to me as the opportunity to bridge my favorite language at the moment, Ruby, and Informix. Ruby is a very powerful and versatile language, easy to read and write, among other advantages. It has a Perl-like formats library [FormatR] for reports and a fabulous web development framework [Ruby on Rails].

The problem is there's no adapter for Informix for RoR, not even a native driver. I made a first attempt to write an adapter, using Ruby ODBC, but always missed a native driver for Informix.

Well, I got some time two weeks ago to write the driver, and thanks to the ease of writing Ruby extensions in C, you can find the preliminary results here. It is not complete, but already usable. Testers welcome. I'd like to hear from you either if it did or didn't work for you.

Other uses for binpatch

binpatch was conceived as a mean to create binary patches on one system with the intention of applying them on as many hosts as we need. It has helped me to maintain firewalls that wouldn't be able to patch by source (lack of disk space, CPU power, ...)

However, binpatch was recently being tried by Mike Erdely as a way to create a binary distribution for OpenSSH. With a creative approach, he built a "binary patch" to upgrade OpenSSH to 4.3 on any other server, avoiding the need to build OpenSSH on every system.