.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBI::PurePerl 3" .TH DBI::PurePerl 3 2024-09-13 "perl v5.40.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME DBI::PurePerl \-\- a DBI emulation using pure perl (no C/XS compilation required) .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& BEGIN { $ENV{DBI_PUREPERL} = 2 } \& use DBI; .Ve .SH DESCRIPTION .IX Header "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. .PP 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. .SH "EXPERIMENTAL STATUS" .IX Header "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 with a cc to . .SH USAGE .IX Header "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. .PP .Vb 2 \& DBI_PUREPERL == 0 (the default) Always use compiled DBI, die \& if it isn\*(Aqt properly compiled & installed \& \& DBI_PUREPERL == 1 Use compiled DBI if it is properly compiled \& & installed, otherwise use PurePerl \& \& DBI_PUREPERL == 2 Always use PurePerl .Ve .PP 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: .PP .Vb 1 \& BEGIN { $ENV{DBI_PUREPERL}=2 } .Ve .PP before you \f(CW\*(C`use DBI;\*(C'\fR. .SH INSTALLATION .IX Header "INSTALLATION" In most situations simply install DBI (see the DBI pod for details). .PP In the situation in which you can not install DBI itself, you may manually copy DBI.pm and PurePerl.pm into the appropriate directories. .PP For example: .PP .Vb 2 \& cp DBI.pm /usr/jdoe/mylibs/. \& cp PurePerl.pm /usr/jdoe/mylibs/DBI/. .Ve .PP Then add this to the top of scripts: .PP .Vb 4 \& BEGIN { \& $ENV{DBI_PUREPERL} = 1; # or =2 \& unshift @INC, \*(Aq/usr/jdoe/mylibs\*(Aq; \& } .Ve .PP (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?) .SH "DIFFERENCES BETWEEN DBI AND DBI::PurePerl" .IX Header "DIFFERENCES BETWEEN DBI AND DBI::PurePerl" .SS Attributes .IX Subsection "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. .PP Some handle attributes are either not supported or have very limited functionality: .PP .Vb 7 \& ActiveKids \& InactiveDestroy \& AutoInactiveDestroy \& Kids \& Taint \& TaintIn \& TaintOut .Ve .PP (and probably others) .SS Tracing .IX Subsection "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 \fBtrace()\fR method you also need to set the DBI_TRACE environment variable, but set it to 0. .SS "Parameter Usage Checking" .IX Subsection "Parameter Usage Checking" The DBI does some basic parameter count checking on method calls. DBI::PurePerl doesn't. .SS Speed .IX Subsection "Speed" DBI::PurePerl is slower. Although, with some drivers in some contexts this may not be very significant for you. .PP By way of example... the test.pl script in the DBI source distribution has a simple benchmark that just does: .PP .Vb 3 \& my $null_dbh = DBI\->connect(\*(Aqdbi:NullP:\*(Aq,\*(Aq\*(Aq,\*(Aq\*(Aq); \& my $i = 10_000; \& $null_dbh\->prepare(\*(Aq\*(Aq) while $i\-\-; .Ve .PP In other words just prepares a statement, creating and destroying a statement handle, over and over again. Using the real DBI this runs at ~4550 handles per second whereas DBI::PurePerl manages ~2800 per second on the same machine (not too bad really). .SS "May not fully support \fBhash()\fP" .IX Subsection "May not fully support hash()" If you want to use type 1 hash, i.e., \f(CW\*(C`hash($string,1)\*(C'\fR with DBI::PurePerl, you'll need version 1.56 or higher of Math::BigInt (available on CPAN). .SS "Doesn't support \fBpreparse()\fP" .IX Subsection "Doesn't support preparse()" The DBI\->\fBpreparse()\fR method isn't supported in DBI::PurePerl. .SS "Doesn't support DBD::Proxy" .IX Subsection "Doesn't support DBD::Proxy" There's a subtle problem somewhere I've not been able to identify. DBI::ProxyServer seem to work fine with DBI::PurePerl but DBD::Proxy does not work 100% (which is sad because that would be far more useful :) Try re-enabling t/80proxy.t for DBI::PurePerl to see if the problem that remains will affect you're usage. .SS Others .IX Subsection "Others" .Vb 1 \& can() \- doesn\*(Aqt have any special behaviour .Ve .PP Please let us know if you find any other differences between DBI and DBI::PurePerl. .SH AUTHORS .IX Header "AUTHORS" Tim Bunce and Jeff Zucker. .PP Tim provided the direction and basis for the code. The original idea for the module and most of the brute force porting from C to Perl was by Jeff. Tim then reworked some core parts to boost the performance and accuracy of the emulation. Thanks also to Randal Schwartz and John Tobey for patches. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c) 2002 Tim Bunce Ireland. .PP See COPYRIGHT section in DBI.pm for usage and distribution rights.