Synopsis
Description
The DBI Class
Methods Common to All Handles
Attributes Common to All Handles
DBI Database Handle Objects
DBI Statement Handle Objects
Further Information
See Also
Authors
Copyright
Acknowledgments
Translations
Support/ Warranty
Training
This appendix is a slightly edited version of the DBI specification, a "living document" that evolves at a slow but steady pace as new versions of the DBI are released. This document is based on the DBI specification for DBI version 1.14.
Although we know that it will be slightly out of date by the time you read it, we have included this specification in the book because it is important reference material, and we believe the book would be incomplete without it. For up-to-date information, consult the online documentation for the version of the DBI you have installed. You can usually access the online documentation with the perldoc DBI command. The Changes file supplied with the DBI distribution contains detailed change information.
Note that whenever the DBI changes, the drivers take some time to catch up. Recent versions of the DBI have added new features (marked NEW in the text) that may not yet be supported by the drivers you use. Talk to the authors of those drivers if you need support for new features.
use DBI; @driver_names = DBI->available_drivers; @data_sources = DBI->data_sources($driver_name); $dbh = DBI->connect($data_source, $username, $auth, \%attr); $rv = $dbh->do($statement); $rv = $dbh->do($statement, \%attr); $rv = $dbh->do($statement, \%attr, @bind_values); $ary_ref = $dbh->selectall_arrayref($statement); @row_ary = $dbh->selectrow_array($statement); $ary_ref = $dbh->selectcol_arrayref($statement); $sth = $dbh->prepare($statement); $sth = $dbh->prepare_cached($statement); $rv = $sth->bind_param($p_num, $bind_value); $rv = $sth->bind_param($p_num, $bind_value, $bind_type); $rv = $sth->bind_param($p_num, $bind_value, \%attr); $rv = $sth->execute; $rv = $sth->execute(@bind_values); $rc = $sth->bind_col($col_num, \$col_variable); $rc = $sth->bind_columns(@list_of_refs_to_vars_to_bind); @row_ary = $sth->fetchrow_array; $ary_ref = $sth->fetchrow_arrayref; $hash_ref = $sth->fetchrow_hashref; $ary_ref = $sth->fetchall_arrayref; $rv = $sth->rows; $rc = $dbh->commit; $rc = $dbh->rollback; $sql = $dbh->quote($string); $rc = $h->err; $str = $h->errstr; $rv = $h->state; $rc = $dbh->disconnect;
If you have questions about DBI, you can get help from the dbi-users@isc.org mailing list. You can subscribe to the list by visiting:
Also worth a visit is the DBI home page at:
Before asking any questions, reread this document, consult the archives, and read the DBI FAQ. The archives are listed at the end of this document. The FAQ is installed as a DBI::FAQ module, so you can read it by executing perldoc DBI::FAQ.
Please note that Tim Bunce does not maintain the mailing lists or the web page (generous volunteers do that). So please don't send mail directly to him; he just doesn't have the time to answer questions personally. The dbi-users mailing list has lots of experienced people who should be able to help you if you need it.
Copyright © 2001 O'Reilly & Associates. All rights reserved.