DBD-drizzle
view release on metacpan or search on metacpan
lib/DBD/drizzle.pm view on Meta::CPAN
defaults to '' and password, defaults to ''). A driver handle can be
obtained with
$drh = DBI->install_driver('drizzle');
Otherwise reuse the existing connection of a database handle (dbh).
There's only one function available for administrative purposes, comparable
to the m(y)sqladmin programs. The command being execute depends on the
first argument:
=over
=item createdb
Creates the database $dbname. Equivalent to "m(y)sqladmin create $dbname".
=item dropdb
Drops the database $dbname. Equivalent to "m(y)sqladmin drop $dbname".
It should be noted that database deletion is
I<not prompted for> in any way. Nor is it undo-able from DBI.
Once you issue the dropDB() method, the database will be gone!
These method should be used at your own risk.
=item shutdown
Silently shuts down the database engine. (Without prompting!)
Equivalent to "m(y)sqladmin shutdown".
=item reload
Reloads the servers configuration files and/or tables. This can be particularly
important if you modify access privileges or create new users.
=back
=back
=head1 DATABASE HANDLES
The DBD::drizzle driver supports the following attributes of database
handles (read only):
$errno = $dbh->{'drizzle_errno'};
$error = $dbh->{'drizzle_error'};
$info = $dbh->{'drizzle_hostinfo'};
$info = $dbh->{'drizzle_info'};
$insertid = $dbh->{'drizzle_insertid'};
$info = $dbh->{'drizzle_protoinfo'};
$info = $dbh->{'drizzle_serverinfo'};
$info = $dbh->{'drizzle_stat'};
$threadId = $dbh->{'drizzle_thread_id'};
These correspond to drizzle_errno(), drizzle_error(), drizzle_get_host_info(),
drizzle_info(), drizzle_insert_id(), drizzle_get_proto_info(),
drizzle_get_server_info(), drizzle_stat() and drizzle_thread_id(),
respectively.
$info_hashref = $dhb->{drizzle_dbd_stats}
DBD::drizzle keeps track of some statistics in the drizzle_dbd_stats attribute.
The following stats are being maintained:
=over
=item auto_reconnects_ok
The number of times that DBD::drizzle successfully reconnected to the drizzle
server.
=item auto_reconnects_failed
The number of times that DBD::drizzle tried to reconnect to drizzle but failed.
=back
The DBD::drizzle driver also supports the following attribute(s) of database
handles (read/write):
$bool_value = $dbh->{drizzle_auto_reconnect};
$dbh->{drizzle_auto_reconnect} = $AutoReconnect ? 1 : 0;
=item drizzle_auto_reconnect
This attribute determines whether DBD::drizzle will automatically reconnect
to drizzle if the connection be lost. This feature defaults to off; however,
if either the GATEWAY_INTERFACE or MOD_PERL envionment variable is set,
DBD::drizzle will turn drizzle_auto_reconnect on. Setting drizzle_auto_reconnect
to on is not advised if 'lock tables' is used because if DBD::drizzle reconnect
to drizzle all table locks will be lost. This attribute is ignored when
AutoCommit is turned off, and when AutoCommit is turned off, DBD::drizzle will
not automatically reconnect to the server.
=item drizzle_use_result
This attribute forces the driver to use drizzle_use_result rather than
drizzle_store_result. The former is faster and less memory consuming, but
tends to block other processes. (That's why drizzle_store_result is the
default.)
It is possible to set default value of the C<drizzle_use_result> attribute
for $dbh using several ways:
- through DSN
$dbh= DBI->connect("DBI:drizzle:test;drizzle_use_result=1", "root", "");
- after creation of database handle
$dbh->{'drizzle_use_result'}=0; #disable
$dbh->{'drizzle_use_result'}=1; #enable
It is possible to set/unset the C<drizzle_use_result> attribute after
creation of statement handle. See below.
( run in 2.061 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )