An RDBI driver for Firebird databases using the rubyfb bindings by George Georgiev.
github.com/pilcrow/rdbi-driver-rubyfb
-
Ruby: ruby-lang.org
-
Firebird: www.firebirdsql.org
-
rubyfb: github.com/georgiev/rubyfb
-
RDBI: rdbi.hollensbe.org/
ruby 1.9.2, Firebird 2.1.3, RDBI 0.9.1 and rubyfb 0.5.5.
Should work under ruby 1.8.7, as well. Firebird >= 1.5 needed (for CASE support under the hood).
By default, rewindable_result
is false and query result sets are “forward only” iterables, such that any attempt to look behind the current fetch index is an error.
If rewindable_result
is true, rdbi-driver-rubyfb
provides fully rewindable (and, indeed, random access) cursors which have the side effect of reading the entire result set into memory.
-
“Manual commit” only There is no autocommit mode at present. This may change in a future release, but you should use explicit transactions anyway.
-
Transactional DDL requires commit Firebird supports transactional DDL like other industrial databases. However, DDL statements must be committed before their effects are visible to subsequent DML/query statements.
For example, this won’t work:
dbh.transaction do dbh.execute('create table TBL (I integer not null)') dbh.execute('insert into TBL (I) values (?)', 1) # Error: "TBL" not yet # visible end
Instead do this:
dbh.transaction do dbh.execute('create table ...') ... other DML ... end dbh.transaction do dbh.execute('insert into ...') end
-
Fixed-length CHAR fields are automatically right-trimmed. Firebird and Interbase databases pad CHAR columns with spaces. (In strict SQL trailing spaces are ignored on string comparisons, so ‘foo ’ = ‘foo’.)
-
TIMESTAMPs are understood _in the local time zone_ There is currently no way to override this.
-
BOOLEANs perhaps not supported Not all Firebird/Interbase databases offer a native BOOLEAN type, instead using CHAR(1) or SMALLINT flags, or user-defined SQL DOMAINs. Firebird 3.0 offers a BOOLEAN type.
-
table_schema
does not yet supportdefault
column values
Tests make use of the RDBI::DBRC role ‘rubyfb_test’ to test against a local database. On a *NIX system, your ~/.dbrc might look like this:
rubyfb_test: driver: Rubyfb user: SYSDBA # $ISC_USER, if omitted password: masterkey # $ISC_PASSWORD, if omitted database: employee
Copyright © 2011 Michael Pomraning. See LICENSE for details.