DBI
view release on metacpan or search on metacpan
lib/DBI/PurePerl.pm view on Meta::CPAN
my $h = shift;
$h->{'_fbav'} = undef;
$h->{'Active'} = 0;
return 1;
}
sub rows {
my $h = shift;
my $rows = $h->{'_rows'};
return -1 unless defined $rows;
return $rows;
}
1;
__END__
=pod
=head1 NAME
DBI::PurePerl -- a DBI emulation using pure perl (no C/XS compilation required)
=head1 SYNOPSIS
BEGIN { $ENV{DBI_PUREPERL} = 2 }
use DBI;
=head1 DESCRIPTION
This is a pure perl emulation of the DBI internals. In almost all
cases you will be better off using standard DBI since the portions
of the standard version written in C make it *much* faster.
However, if you are in a situation where it isn't possible to install
a compiled version of standard DBI, and you're using pure-perl DBD
drivers, then this module allows you to use most common features
of DBI without needing any changes in your scripts.
=head1 EXPERIMENTAL STATUS
DBI::PurePerl is new so please treat it as experimental pending
more extensive testing. So far it has passed all tests with DBD::CSV,
DBD::AnyData, DBD::XBase, DBD::Sprite, DBD::mysqlPP. Please send
bug reports to Jeff Zucker at <jeff@vpservices.com> with a cc to
<dbi-dev@perl.org>.
=head1 USAGE
The usage is the same as for standard DBI with the exception
that you need to set the environment variable DBI_PUREPERL if
you want to use the PurePerl version.
DBI_PUREPERL == 0 (the default) Always use compiled DBI, die
if it isn't properly compiled & installed
DBI_PUREPERL == 1 Use compiled DBI if it is properly compiled
& installed, otherwise use PurePerl
DBI_PUREPERL == 2 Always use PurePerl
You may set the environment variable in your shell (e.g. with
set or setenv or export, etc) or else set it in your script like
this:
BEGIN { $ENV{DBI_PUREPERL}=2 }
before you C<use DBI;>.
=head1 INSTALLATION
In most situations simply install DBI (see the DBI pod for details).
In the situation in which you can not install DBI itself, you
may manually copy DBI.pm and PurePerl.pm into the appropriate
directories.
For example:
cp DBI.pm /usr/jdoe/mylibs/.
cp PurePerl.pm /usr/jdoe/mylibs/DBI/.
Then add this to the top of scripts:
BEGIN {
$ENV{DBI_PUREPERL} = 1; # or =2
unshift @INC, '/usr/jdoe/mylibs';
}
(Or should we perhaps patch Makefile.PL so that if DBI_PUREPERL
is set to 2 prior to make, the normal compile process is skipped
and the files are installed automatically?)
=head1 DIFFERENCES BETWEEN DBI AND DBI::PurePerl
=head2 Attributes
Boolean attributes still return boolean values but the actual values
used may be different, i.e., 0 or undef instead of an empty string.
Some handle attributes are either not supported or have very limited
functionality:
ActiveKids
InactiveDestroy
AutoInactiveDestroy
Kids
Taint
TaintIn
TaintOut
(and probably others)
=head2 Tracing
Trace functionality is more limited and the code to handle tracing is
only embedded into DBI:PurePerl if the DBI_TRACE environment variable
is defined. To enable total tracing you can set the DBI_TRACE
environment variable as usual. But to enable individual handle
tracing using the trace() method you also need to set the DBI_TRACE
environment variable, but set it to 0.
=head2 Parameter Usage Checking
( run in 0.477 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )