1DBI::PurePerl(3)      User Contributed Perl Documentation     DBI::PurePerl(3)
2
3
4

NAME

6       DBI::PurePerl -- a DBI emulation using pure perl (no C/XS compilation
7       required)
8

SYNOPSIS

10        BEGIN { $ENV{DBI_PUREPERL} = 2 }
11        use DBI;
12

DESCRIPTION

14       This is a pure perl emulation of the DBI internals.  In almost all
15       cases you will be better off using standard DBI since the portions of
16       the standard version written in C make it *much* faster.
17
18       However, if you are in a situation where it isn't possible to install a
19       compiled version of standard DBI, and you're using pure-perl DBD
20       drivers, then this module allows you to use most common features of DBI
21       without needing any changes in your scripts.
22

EXPERIMENTAL STATUS

24       DBI::PurePerl is new so please treat it as experimental pending more
25       extensive testing.  So far it has passed all tests with DBD::CSV,
26       DBD::AnyData, DBD::XBase, DBD::Sprite, DBD::mysqlPP.  Please send bug
27       reports to Jeff Zucker at <jeff@vpservices.com> with a cc to
28       <dbi-dev@perl.org>.
29

USAGE

31       The usage is the same as for standard DBI with the exception that you
32       need to set the environment variable DBI_PUREPERL if you want to use
33       the PurePerl version.
34
35        DBI_PUREPERL == 0 (the default) Always use compiled DBI, die
36                          if it isn't properly compiled & installed
37
38        DBI_PUREPERL == 1 Use compiled DBI if it is properly compiled
39                          & installed, otherwise use PurePerl
40
41        DBI_PUREPERL == 2 Always use PurePerl
42
43       You may set the enviornment variable in your shell (e.g. with set or
44       setenv or export, etc) or else set it in your script like this:
45
46        BEGIN { $ENV{DBI_PUREPERL}=2 }
47
48       before you "use DBI;".
49

INSTALLATION

51       In most situations simply install DBI (see the DBI pod for details).
52
53       In the situation in which you can not install DBI itself, you may
54       manually copy DBI.pm and PurePerl.pm into the appropriate directories.
55
56       For example:
57
58        cp DBI.pm      /usr/jdoe/mylibs/.
59        cp PurePerl.pm /usr/jdoe/mylibs/DBI/.
60
61       Then add this to the top of scripts:
62
63        BEGIN {
64          $ENV{DBI_PUREPERL} = 1;      # or =2
65          unshift @INC, '/usr/jdoe/mylibs';
66        }
67
68       (Or should we perhaps patch Makefile.PL so that if DBI_PUREPERL is set
69       to 2 prior to make, the normal compile process is skipped and the files
70       are installed automatically?)
71

DIFFERENCES BETWEEN DBI AND DBI::PurePerl

73   Attributes
74       Boolean attributes still return boolean values but the actual values
75       used may be different, i.e., 0 or undef instead of an empty string.
76
77       Some handle attributes are either not supported or have very limited
78       functionality:
79
80         ActiveKids
81         InactiveDestroy
82         Kids
83         Taint
84         TaintIn
85         TaintOut
86
87       (and probably others)
88
89   Tracing
90       Trace functionality is more limited and the code to handle tracing is
91       only embedded into DBI:PurePerl if the DBI_TRACE environment variable
92       is defined.  To enable total tracing you can set the DBI_TRACE
93       environment variable as usual.  But to enable individual handle tracing
94       using the trace() method you also need to set the DBI_TRACE environment
95       variable, but set it to 0.
96
97   Parameter Usage Checking
98       The DBI does some basic parameter count checking on method calls.
99       DBI::PurePerl doesn't.
100
101   Speed
102       DBI::PurePerl is slower. Although, with some drivers in some contexts
103       this may not be very significant for you.
104
105       By way of example... the test.pl script in the DBI source distribution
106       has a simple benchmark that just does:
107
108           my $null_dbh = DBI->connect('dbi:NullP:','','');
109           my $i = 10_000;
110           $null_dbh->prepare('') while $i--;
111
112       In other words just prepares a statement, creating and destroying a
113       statement handle, over and over again.  Using the real DBI this runs at
114       ~4550 handles per second whereas DBI::PurePerl manages ~2800 per second
115       on the same machine (not too bad really).
116
117   May not fully support hash()
118       If you want to use type 1 hash, i.e., "hash($string,1)" with
119       DBI::PurePerl, you'll need version 1.56 or higher of Math::BigInt
120       (available on CPAN).
121
122   Doesn't support preparse()
123       The DBI->preparse() method isn't supported in DBI::PurePerl.
124
125   Doesn't support DBD::Proxy
126       There's a subtle problem somewhere I've not been able to identify.
127       DBI::ProxyServer seem to work fine with DBI::PurePerl but DBD::Proxy
128       does not work 100% (which is sad because that would be far more useful
129       :) Try re-enabling t/80proxy.t for DBI::PurePerl to see if the problem
130       that remains will affect you're usage.
131
132   Others
133         can() - doesn't have any special behaviour
134
135       Please let us know if you find any other differences between DBI and
136       DBI::PurePerl.
137

AUTHORS

139       Tim Bunce and Jeff Zucker.
140
141       Tim provided the direction and basis for the code.  The original idea
142       for the module and most of the brute force porting from C to Perl was
143       by Jeff. Tim then reworked some core parts to boost the performance and
144       accuracy of the emulation. Thanks also to Randal Schwartz and John
145       Tobey for patches.
146
148       Copyright (c) 2002  Tim Bunce  Ireland.
149
150       See COPYRIGHT section in DBI.pm for usage and distribution rights.
151
152
153
154perl v5.12.1                      2010-06-08                  DBI::PurePerl(3)
Impressum