"http://www.w3.org/TR/html4/strict.dtd">
The module to encapsulate the Ruby ODBC binding.
datasources
drivers
error
info
raise(value)
newenv
connection_pooling[=value]
to_time(timestamp)
to_time(date,
[time])
to_time(time,
[date])
Time
object from the specified arguments,
which must be ODBC::Date,
ODBC::Time, or
ODBC::TimeStamp objects.
to_date(timestamp)
to_date(date)
Date
object from the specified arguments,
which must be ODBC::Date, or
ODBC::TimeStamp objects.
connect(dsn,
[user, passwd])
[{|dbc| block}]
Some constants of the ODBC API are defined in order to set connection options and to deal with SQL data types:
The class to represent the root of all other ODBC related objects.
Object
error
info
raise(value)
error
info
raise(value)
The class to represent the environment for ODBC::Databases.
ODBC::Object
connect
environment
commit
rollback
transaction {|env| block}
connection_pooling[=value]
cp_match[=value]
odbc_version[=value]
new
The class to represent a connection to an ODBC data source.
When underlying ODBC SQL functions report an error, an ODBC::Error exception with a corresponding error message from the ODBC driver manager and/or driver is raised.
ODBC::Environment
connected?
true
when the object is in connected
state, false otherwise.
drvconnect(drv)
disconnect(no_drop=false)
tables([pattern])
columns([table])
indexes([table[,unique]])
types([tcode])
primary_keys([table])
foreign_keys([table])
table_privileges([table])
procedures([p])
procedure_columns([p])
special_columns([table[,id,
scope]])
ODBC::SQL_BEST_ROWID
or
ODBC::SQL_ROW_VER
. scope may be
specified as ODBC::SQL_SCOPE_CURROW
,
ODBC::SQL_SCOPE_TRANSACTION
, or
ODBC::SQL_SCOPE_SESSION
. If omitted the
defaults are ODBC::SQL_BEST_ROWID
and
ODBC::SQL_SCOPE_CURROW
.
run(sql,
[args ...])
do(sql,
[args ...])
prepare(sql)
proc(sql)
{|stmt| block}
# add customer given name and id # and return number of affected rows addcust = dbc.proc("insert into customer values(?, ?)") { |stmt| stmt.nrows } addcust.call("J.R. User", 9999) # alternative to call: addcust["J.R. User", 9999]
autocommit[=bool]
concurrency[=intval]
maxrows[=intval]
timeout[=intval]
maxlength[=intval]
rowsetsize[=intval]
cursortype[=intval]
noscan[=bool]
ignorecase[=bool]
drop_all
new
drvconnect
method call.
new(dsn,
[user, passwd])
SQLExecDirect()
when the SQL statement has no
parameters.
The class to represent the query result. The object of this class is created as the result of every query. You may need to invoke the close or drop methods for the finished object for better memory performance.
When underlying ODBC SQL functions report an error, an ODBC::Error exception with a corresponding error message from the ODBC driver manager and/or driver is raised.
ODBC to Ruby type mapping:
ODBC | Ruby |
---|---|
SQL_SMALLINT, SQL_INTEGER, SQL_TINYINT, SQL_BIT | T_FIXNUM, T_BIGNUM |
SQL_FLOAT, SQL_DOUBLE, SQL_REAL | T_FLOAT |
SQL_DATE, SQL_TYPE_DATE | ODBC::Date |
SQL_TIME, SQL_TYPE_TIME | ODBC::Time |
SQL_TIMESTAMP, SQL_TYPE_TIMESTAMP | ODBC::TimeStamp |
all others | T_STRING |
Enumerable
cancel
close
drop
column(n)
columns(as_ary=false)
FOOBAR
, FOOBAR#1
.
columns
{|col| block}
ncols
nrows
cursorname[=name]
ignorecase[=bool]
ODBC::Database.ignorecase
but affecting this statement only.
Inherited by the current state of the
ODBC::Database at the time the
statement is created.
fetch
fetch_first
fetch_scroll(direction,
offset=1)
SQL_FETCH_LAST
as an array. offset is
used for SQL_FETCH_RELATIVE
and
SQL_FETCH_ABSOLUTE
.
fetch_many(count)
fetch_all
fetch_many
except that all remaining rows
are returned.
fetch_hash(with_table_names=false)
columns
method are applied.
each {|row|
block}
fetch
for each row.
each_hash(with_table_names=false)
{|row| block}
fetch_hash
for each row.
execute([args ...])
more_results
fetch
,
fetch_hash
,
and execute
methods can be invoked with a block. In this case the block is
executed with one row of the result set (fetch
and
fetch_hash
) or with the
ODBC::Statement (execute
)
as parameter.
If the ignorecase
option
is turned on, all column names used in the column
,
columns
, and *_hash
methods are converted to
upper case.
The class to represent information of a column of a query.
Objects of this class are created as result of the column
and columns
methods of
ODBC::Statement.
name
table
length
nullable
searchable
unsigned
precision
scale
type
The class to represent a SQL_DATE
column in a table.
Comparable
<=>(adate)
day[=num]
month[=num]
year[=num]
to_s
YYYY-MM-DD
.
clone
new([year, month,
day])
new(date)
new(time)
new(string)
Date
, Time
, or String
object. Recognized string formats are eg
2001-01-01 2001-01-01 12:00:01 {ts '2001-01-01 12:00:01.1'} {d '2001-01-01'}
The class to represent a SQL_TIME
column in a table.
Comparable
<=>(atime)
second[=num]
minute[=num]
hour[=num]
to_s
hh:mm:ss
.
clone
new([hour, minute,
second])
new(time)
new(string)
Time
or String
object.
Recognized string formats are eg
12:00:01 2001-01-01 12:00:01 {ts '2001-01-01 12:00:01.1'} {t '12:00:01'}
The class to represent a SQL_TIMESTAMP
column in a table.
Comparable
<=>(atimestamp)
fraction[=num]
second[=num]
minute[=num]
hour[=num]
day[=num]
month[=num]
year[=num]
to_s
YYYY-MM-DD hh:mm:ss fraction
.
clone
new([year, month,
day, hour, minute,
second, fraction])
new(time)
new(string)
Time
or String
object.
Recognized string formats are eg
12:00:01 2001-01-01 2001-01-01 12:00:01 {ts '2001-01-01 12:00:01.1'} {d '2001-01-01'} {t '12:00:01'}
The class to represent a data source name. Objects of this class are created as result of a ODBC::datasources module function call.
name[=name]
descr[=descr]
The class to represent an ODBC driver with name and attributes. Objects of this class are created as result of a ODBC::drivers module function call.
name[=name]
attrs[[key][=value]]
new
The class to represent a procedure with ODBC database/statement context. Objects of this class are created as result of a ODBC::Database.proc method call.
Proc
call([args*])
[[args*]]
call
.
The class to represent ODBC related exceptions. The descriptive string is made up of the first ODBC driver or driver manager message as concatenation of SQL state, native error, driver manager name, database name/vendor, DSN, and error text, eg
S1000 (1146) [unixODBC][TCX][MySQL]Table 'test.foo' doesn't existFor internally generated errors, eg method invocation on a broken connection, the descriptive string starts with 'INTERN' and native error 0, eg
INTERN (0) [RubyODBC]No connectionFor errors programmatically generated by the
raise
method,
the descriptive string starts with 'INTERN' and native error 1,
eg INTERN (1) [RubyODBC]Programmer forgot to RTFM
StandardError
ODBC::add_dsn(driver, issys=false)
ODBC::add_dsn(name, attrs,
issys=false)
ODBC::config_dsn(driver, issys=false)
ODBC::config_dsn(name, attrs,
issys=false)
ODBC::del_dsn(driver, issys=false)
ODBC::del_dsn(name, attrs,
issys=false)
ODBC::trace([mask])
ODBC::Statement.parameter([n])
ODBC::Statement.parameters
ODBC::Statement.nparams
ODBC::Statement.fetch!
ODBC::Statement.fetch_first!
ODBC::Statement.fetch_first_hash(with_table_names=false)
ODBC::Statement.fetch_scroll!(direction,
offset=1)
ODBC::Statement.fetch_hash!(with_table_names=false)
ODBC::Statement.make_proc(stmt)
ODBC::Parameter ...