DataObject.rb

The Data Objects project is an effort to rewrite existing Ruby database drivers so they conform to a single interface. It was started October 8, 2007, and an initial release of the MySQL, Postgres, and SQLite drivers was made available on October 14, 2007.

The general DataObject interface is loosely based on ADO.net, but only as far as the low-level driver is concerned. It defines classes for a database connection, command, and reader. Rather than attempt to provide Ruby-esque abstractions on top of the database reader, DO.rb keeps it simple by exposing the resultset as a forward-only cursor that also provides functions that provide other metadata. It is also exposed as a simple Enumerable, just to simplify the act of enumerating over rows.

Drivers

All of the drivers for DataObject.rb are written from scratch. At the moment, they all use SWIG to pull the C API into Ruby, and in general, use a very small subset of the available API.

Specs

DO.rb comes with a set of universal specs that all pass for all three supported databases. More specs will be added as edge-case failures are identified.

Maturity

The DO.rb drivers are extremely young, and require some use before they can be considered for production use. There is a fair amount of error-handling in the drivers, but there are likely edge-case situations that might slip through the cracks. I also intend to add some support of useful metadata (such as last_inserted_id), as well as support for pulling out some schema data (Schema#primary_key(table_name).