The following methods are available under DBI.
@drivers = DBI->available_drivers([nowarn])
Returns a list of available drivers by searching @INC for the presence of DBD::* modules.
$result = $st_handle->bind_col(col, \variable [, \%attr ])
Binds a field of a select statement to a variable, to be updated whenever the row is fetched.
$result = $st_handle->bind_columns(\%attr, @reflist )
Runs bind_col on each column of the statement.
$result = $st_handle->bind_param(n, value [, type ])
Binds a value with a placeholder in a prepared statement.
$result = $db_handle->commit
Commits the most recent changes. See also the AutoCommit attribute.
$db_handle = DBI->connect(data_source, user, passwd,[\%attr])
Connects to the specified database, returning a database handle object. The connect method automatically installs the driver if it has not already been installed.
DBI:$driver:database=$database;host=$hostname;port= $port
@drivers = DBI->data_sources(driver)
Returns a list of all databases available for the named driver. (The database server must be running for data_sources to return any results.)
$result = $db_handle->disconnect
Disconnects the database.
$rows = $db_handle->do(statement [, \%attr, @bind_values ])
Prepares and executes a statement, returning the number of rows affected.
$rows = DBI::dump_results(st_handle, maxlen, ldelim, fdelim, fileh)
Runs DBI::neat( ) on all the rows of a statement handle and prints them for testing purposes.
$handle->err
Returns the error code from the last driver function called.
$handle->errstr
Returns the error message from the last driver function called.
$result = $st_handle->execute([@bind_values])
Executes a prepared statement.
$arrayref = $st_handle->fetch
Fetches the next row of data, returning an array reference with the field values.
$arrayref = $st_handle->fetchall_arrayref
Fetches all data from a prepared statement and returns a reference to an array of references.
$array = $st_handle->fetchrow_array
Fetches the next row of data, returning an array with the field values.
$arrayref = $st_handle->fetchrow_arrayref
Fetches the next row of data, returning an array reference with the field values. Synonym for fetch.
$hashref = $st_handle->fetchrow_hashref
Fetches the next row of data, returning a hash reference containing the field values. The keys of the hash are the same as $st_handle->{NAME}.
$result = $st_handle->finish
Disables further fetching from a statement.
$handle->func(@arguments, function)
Calls a private nonportable method on the specific handle.
$newstring = DBI::neat(string, maxlength)
Converts a string to one with quoted strings, null values shown as undef, and unprintable characters shown as ".".
$newstring = DBI::neat_list(\@list, maxlength, delim)
Converts each element of a list with DBI::neat and returns it as a string.
$result = $db_handle->ping
Determines if the database is still connected.
$st_handle = $db_handle->prepare(statement [, \%attr ])
Prepares a statement for execution and returns a reference to a statement handle object.
$sql = $db_handle->quote(string)
Escapes special characters in a string for use in a SQL statement.
$result = $db_handle->rollback
Undoes the most recent database changes if not yet committed.
$rows = $st_handle->rows
Returns the number of rows affected by the last change to the database.
$handle->state
Returns an error code in a five-character format.
DBI->trace(n, filename)
Traces the execution of DBI.
$handle->trace(n, filename)
Same as the class method DBI->trace, but for a specific database, statement, or driver handle.
Copyright © 2002 O'Reilly & Associates. All rights reserved.