| Module | Informix |
| In: |
lib/informix.rb
lib/informix/interval.rb lib/informix/scrollcursor.rb lib/informix/seqcursor.rb lib/informix/exceptions.rb ext/informixc.c |
The Informix module contains the mechanisms for connecting to and taking advantage of an existing Informix database by means of a simple model, similar to the one used in ESQL/C.
The interaction with an Informix database is made basically through three classes: Database, Statement and Cursor.
Cursor is actually a module that works as a shortcut for creating three kinds of cursors: SequentialCursor, ScrollCursor and InsertCursor.
There are other classes for supporting some data types not available in Ruby: Slob, SlobStat and Interval.
Again, Interval is actually a module that works as a shortcut for creating two kinds of intervals: IntervalYTM and IntervalDTS.
| VERSION | = | "0.7.0" |
| ExcInfo | = | Struct.new(:sql_code, :sql_state, :class_origin, :subclass_origin, :message, :server_name, :connection_name) |
Shortcut to create a Database object connected to dbname as user with password. If these are not given, connects to dbname as the current user.
The Database object is passed to the block if it‘s given, and automatically closes the connection when the block terminates, returning the value of the block.
Examples:
Connecting to stores with our current credentials:
db = Informix.connect('stores')
Same thing, using a block and using a different server. The connection is closed automatically when the block terminates.
result = Informix.connect('stores@server_shm') do |db|
# do something with db
# the last expression evaluated will be returned
done
# File lib/informix.rb, line 57
57: def self.connect(dbname, user = nil, password = nil, &block)
58: Database.open(dbname, user, password, &block)
59: end