Apache-LoggedAuthDBI
view release on metacpan or search on metacpan
I<The synopsis above only lists the major methods and parameters.>
=head2 GETTING HELP
If you have questions about DBI, or DBD driver modules, you can get
help from the I<dbi-users@perl.org> mailing list. You can get help
on subscribing and using the list by emailing I<dbi-users-help@perl.org>.
(To help you make the best use of the dbi-users mailing list,
and any other lists or forums you may use, I I<strongly>
recommend that you read "How To Ask Questions The Smart Way"
by Eric Raymond: L<http://www.catb.org/~esr/faqs/smart-questions.html>)
The DBI home page at L<http://dbi.perl.org/> is always worth a visit
and includes an FAQ and links to other resources.
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 and on the DBI home page.
*DBI::DBI_tie::FETCH = \&DBI::DBI_tie::STORE;
}
tie %DBI::DBI => 'DBI::DBI_tie';
# --- Driver Specific Prefix Registry ---
my $dbd_prefix_registry = {
ad_ => { class => 'DBD::AnyData', },
ado_ => { class => 'DBD::ADO', },
amzn_ => { class => 'DBD::Amazon', },
best_ => { class => 'DBD::BestWins', },
csv_ => { class => 'DBD::CSV', },
db2_ => { class => 'DBD::DB2', },
dbi_ => { class => 'DBI', },
dbm_ => { class => 'DBD::DBM', },
df_ => { class => 'DBD::DF', },
f_ => { class => 'DBD::File', },
file_ => { class => 'DBD::TextFile', },
ib_ => { class => 'DBD::InterBase', },
ing_ => { class => 'DBD::Ingres', },
ix_ => { class => 'DBD::Informix', },
}
my $t2 = new Benchmark;
my $td = Benchmark::timediff($t2, $t1);
printf "Made %2d connections in %s\n", $loops*$par, Benchmark::timestr($td);
print "\n";
return $td;
}
# Help people doing DBI->errstr, might even document it one day
# XXX probably best moved to cheaper XS code
sub err { $DBI::err }
sub errstr { $DBI::errstr }
# --- Private Internal Function for Creating New DBI Handles
sub _new_handle {
my ($class, $parent, $attr, $imp_data, $imp_class) = @_;
Carp::croak('Usage: DBI::_new_handle'
to the data.
=item C<type_info>
@type_info = $dbh->type_info($data_type);
Returns a list of hash references holding information about one or more
variants of $data_type. The list is ordered by C<DATA_TYPE> first and
then by how closely each type maps to the corresponding ODBC SQL data
type, closest first. If called in a scalar context then only the first
(best) element is returned.
If $data_type is undefined or C<SQL_ALL_TYPES>, then the list will
contain hashes for all data type variants supported by the database and driver.
If $data_type is an array reference then C<type_info> returns the
information for the I<first> type in the array that has any matches.
The keys of the hash follow the same letter case conventions as the
rest of the DBI (see L</Naming Conventions and Name Space>). The
following uppercase items should always exist, though may be undef:
or return $sth->set_err(1234, "The magic failed", undef, "fetch");
return $row;
}
When calling a SUPER::method that returns a handle, be careful to
check the return value before trying to do other things with it in
your overridden method. This is especially important if you want
to set a hash attribute on the handle, as Perl's autovivification
will bite you by (in)conveniently creating an unblessed hashref,
which your method will then return with usually baffling results
later on. It's best to check right after the call and return undef
immediately on error, just like DBI would and just like the example
above.
If your method needs to record an error it should call the set_err()
method with the error code and error string, as shown in the example
above. The error code and error string will be recorded in the
handle and available via C<$h-E<gt>err> and C<$DBI::errstr> etc.
The set_err() method always returns an undef or empty list as
approriate. Since your method should nearly always return an undef
or empty list as soon as an error is detected it's handy to simply
Trace I<levels> are as follows:
0 - Trace disabled.
1 - Trace DBI method calls returning with results or errors.
2 - Trace method entry with parameters and returning with results.
3 - As above, adding some high-level information from the driver
and some internal information from the DBI.
4 - As above, adding more detailed information from the driver.
5 to 15 - As above but with more and more obscure information.
Trace level 1 is best for a simple overview of what's happening.
Trace level 2 is a good choice for general purpose tracing.
Levels 3 and above are best reserved for investigating a specific
problem, when you need to see "inside" the driver and DBI.
The trace output is detailed and typically very useful. Much of the
trace output is formatted using the L</neat> function, so strings
in the trace output may be edited and truncated by that function.
=head2 Trace Flags
Trace I<flags> are used to enable tracing of specific activities
within the DBI and drivers. The DBI defines some trace flags and
( run in 0.370 second using v1.01-cache-2.11-cpan-501359838a1 )