NAME
Bio::DB::GFF::Adaptor::dbi::caching_handle -- Cache for database handles
SYNOPSIS
use Bio::DB::GFF::Adaptor::dbi::caching_handle;$db = Bio::DB::GFF::Adaptor::dbi::caching_handle->new('dbi:mysql:test');$sth = $db->prepare('select * from foo');@h = $sth->fetch_rowarray;$sth->finish
DESCRIPTION
This module handles a pool of database handles. It was motivated by the MYSQL driver's {mysql_use_result} attribute, which dramatically improves query speed and memory usage, but forbids additional query statements from being evaluated while an existing one is in use.
This module is a plug-in replacement for vanilla DBI. It automatically activates the {mysql_use_result} attribute for the mysql driver, but avoids problems with multiple active statement handlers by creating new database handles as needed.
USAGE
The object constructor is Bio::DB::GFF::Adaptor::dbi::caching_handle->new(). This is called like DBI->connect() and takes the same arguments. The returned object looks and acts like a conventional database handle.
In addition to all the standard DBI handle methods, this package adds the following:
dbi_quote
Title : dbi_quoteUsage : $string = $db->dbi_quote($sql,@args)Function: perform bind variable substitutionReturns : query stringArgs : the query string and bind argumentsStatus : public
This method replaces the bind variable "?" in a SQL statement with appropriately quoted bind arguments. It is used internally to handle drivers that don't support argument binding.
do_query
Title : do_queryUsage : $sth = $db->do_query($query,@args)Function: perform a DBI queryReturns : a statement handlerArgs : query string and list of bind argumentsStatus : Public
This method performs a DBI prepare() and execute(), returning a statement handle. You will typically call fetch() of fetchrow_array() on the statement handle. The parsed statement handle is cached for later use.
debug
Title : debugUsage : $debug = $db->debug([$debug])Function: activate debugging messagesReturns : current state of flagArgs : optional new setting of flagStatus : public
attribute
Title : attributeUsage : $value = $db->attribute(AttributeName , [$newvalue])Function: get/set DBI::db handle attributeReturns : current state of the attributeArgs : name of the attribute and optional new setting of attributeStatus : publicUnder Bio::DB::GFF::Adaptor::dbi::caching_handle the DBI::dbattributes that are usually set using hashref calls are unavailable.Use attribute() instead. For example, instead of:$dbh->{AutoCommit} = 0;use$dbh->attribute(AutoCommit=>0);
BUGS
Report to the author.
SEE ALSO
DBI, Bio::DB::GFF, bioperl
AUTHOR
Lincoln Stein <[email protected]>.
Copyright (c) 2001 Cold Spring Harbor Laboratory.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.