$Id: utils.rb,v 1.5 2006/01/29 06:14:19 djberg96 Exp $
| VERSION | = | "0.4.0" | ||
| DEFAULT_TRACE_MODE | = | 2 | Module functions (of DBI) | |
| DEFAULT_TRACE_OUTPUT | = | STDERR | ||
| SQL_FETCH_NEXT | = | 1 | Constants for fetch_scroll | |
| SQL_FETCH_PRIOR | = | 2 | ||
| SQL_FETCH_FIRST | = | 3 | ||
| SQL_FETCH_LAST | = | 4 | ||
| SQL_FETCH_ABSOLUTE | = | 5 | ||
| SQL_FETCH_RELATIVE | = | 6 | ||
| SQL_CHAR | = | 1 | SQL type constants | |
| SQL_NUMERIC | = | 2 | ||
| SQL_DECIMAL | = | 3 | ||
| SQL_INTEGER | = | 4 | ||
| SQL_SMALLINT | = | 5 | ||
| SQL_FLOAT | = | 6 | ||
| SQL_REAL | = | 7 | ||
| SQL_DOUBLE | = | 8 | ||
| SQL_DATE | = | 9 | ||
| SQL_TIME | = | 10 | ||
| SQL_TIMESTAMP | = | 11 | ||
| SQL_VARCHAR | = | 12 | ||
| SQL_BOOLEAN | = | 13 | ||
| SQL_LONGVARCHAR | = | -1 | ||
| SQL_BINARY | = | -2 | ||
| SQL_VARBINARY | = | -3 | ||
| SQL_LONGVARBINARY | = | -4 | ||
| SQL_BIGINT | = | -5 | ||
| SQL_TINYINT | = | -6 | ||
| SQL_BIT | = | -7 | ||
| SQL_BLOB | = | -10 | TODO Find types for these (XOPEN?)SQL_ARRAY = |
|
| SQL_CLOB | = | -11 | ||
| SQL_OTHER | = | 100 | SQL_DISTINCT = SQL_OBJECT = SQL_NULL = | |
| SQL_TYPE_NAMES | = | { SQL_BIT => 'BIT', SQL_TINYINT => 'TINYINT', SQL_SMALLINT => 'SMALLINT', SQL_INTEGER => 'INTEGER', SQL_BIGINT => 'BIGINT', SQL_FLOAT => 'FLOAT', SQL_REAL => 'REAL', SQL_DOUBLE => 'DOUBLE', SQL_NUMERIC => 'NUMERIC', SQL_DECIMAL => 'DECIMAL', SQL_CHAR => 'CHAR', SQL_VARCHAR => 'VARCHAR', SQL_LONGVARCHAR => 'LONG VARCHAR', SQL_DATE => 'DATE', SQL_TIME => 'TIME', SQL_TIMESTAMP => 'TIMESTAMP', SQL_BINARY => 'BINARY', SQL_VARBINARY => 'VARBINARY', SQL_LONGVARBINARY => 'LONG VARBINARY', SQL_BLOB => 'BLOB', SQL_CLOB => 'CLOB', SQL_OTHER => nil, SQL_BOOLEAN => 'BOOLEAN', } | SQL_REF = SQL_STRUCT = |
Returns a list (of String) of the currently available drivers on your system in ‘dbi:driver:’ format.
This currently does not work for rubygems installations, please see DBI.collect_drivers for reasons.
Return a list (of String) of the available drivers.
| NOTE: | This is non-functional for gem installations, due to the nature of how it currently works. A better solution for this will be provided in DBI 0.6.0. |
Establish a database connection.
Format goes as such: "dbi:Driver:database_conn_args"
Return the current status of type conversion at this level. This status will be propogated to any new DatabaseHandles created.
Set the current status of type conversion at this level. This status will be propogated to any new DatabaseHandles created.
Attempt to collect the available data sources to the driver, specified in DBI.connect format.
The result is heavily dependent on the driver‘s ability to enumerate these sources, and results will vary.
Attempt to disconnect all database handles. If a driver is provided, disconnections will happen under that scope. Otherwise, all loaded drivers (and their handles) will be attempted.
Enable tracing mode. Requires that ‘dbi/trace’ be required before it does anything.
As of 0.4.0, this mode does not do anything either way, so this currently just throws an InterfaceError. This issue is expected to be resolved in the next release.
Given a driver name, locate and load the associated DBD package, generate a DriverHandle and return it.
Splits a DBI URL into two components - the database driver name and the datasource (along with any options, if any) and returns a two element array, e.g. ‘dbi:foo:bar’ would return [‘foo’,’bar’].
A regular expression is used instead of a simple split to validate the proper format for the URL. If it isn‘t correct, an Interface error is raised.