Class DBI::DatabaseHandle
In: lib/dbi/handles/database.rb
Parent: Handle

DatabaseHandle is the interface the consumer sees after connecting to the database via DBI.connect.

It is strongly discouraged that DBDs inherit from this class directly; please inherit from the DBI::BaseDatabase instead.

Note: almost all methods in this class will raise InterfaceError if the database is not connected.

Methods

[]   []=   columns   commit   connected?   disconnect   do   driver_name   driver_name=   execute   ping   prepare   quote   rollback   select_all   select_one   tables   transaction  

Public Instance methods

Get an attribute from the DatabaseHandle.

Set an attribute on the DatabaseHandle.

Returns the columns of the provided table as an array of ColumnInfo objects. See BaseDatabase#columns for the minimum parameters that this method must provide.

Force a commit to the database immediately.

Boolean if we are still connected to the database. See ping.

Disconnect from the database. Will raise InterfaceError if this was already done prior.

Perform a statement. This goes straight to the DBD‘s implementation of do (and consequently, BaseDatabase#do), and does not work like execute and prepare. Should return a row modified count.

This is the driver name as supplied by the DBD‘s driver_name method. Its primary utility is in DBI::TypeUtil#convert.

Assign the driver name. This can be leveraged to create custom type management via DBI::TypeUtil#convert.

Prepare and execute a statement. It has block semantics equivalent to prepare.

Attempt to establish if the database is still connected. While connected? returns the state the DatabaseHandle thinks is true, this is an active operation that will contact the database.

Prepare a StatementHandle and return it. If given a block, it will supply that StatementHandle as the first argument to the block, and BaseStatement#finish it when the block is done executing.

Attempt to escape the value, rendering it suitable for inclusion in a SQL statement.

Force a rollback to the database immediately.

Executes a statement and returns all rows from the result. If a block is given, it is executed for each row.

Executes a statement and returns the first row from the result.

Return the tables available to this DatabaseHandle as an array of strings.

Commits, runs the block provided, yielding the DatabaseHandle as it‘s argument. If an exception is raised through the block, rollback occurs. Otherwise, commit occurs.

[Validate]