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

AUTHORS

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