@EXPORT = qw(); # Do NOT @EXPORT anything.
$VERSION = substr(q
$Revision: 10.4 $, 9,-1);
# $Id: NullP.pm,v 10.4 2001/05/29 23:25:55 timbo Exp $
# Copyright (c) 1994, Tim Bunce
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the Perl README file.
$drh = undef; # holds driver handle once initialised
$err = 0; # The $DBI::err value
($drh) = DBI
::_new_drh
($class, {
'Attribution' => 'DBD Example Null Perl stub by Tim Bunce',
}, [ qw
'example implementors private data']);
{ package DBD
::NullP
::dr
; # ====== DRIVER ======
# we use default (dummy) connect method
{ package DBD
::NullP
::db
; # ====== DATABASE ======
my($dbh, $statement)= @_;
my($outer, $sth) = DBI
::_new_sth
($dbh, {
'Statement' => $statement,
}, [ qw
'example implementors private data']);
# In reality this would interrogate the database engine to
# either return dynamic values that cannot be precomputed
# or fetch and cache attribute values too expensive to prefetch.
return 1 if $attrib eq 'AutoCommit';
# else pass up to DBI to handle
return $dbh->DBD::_
::db
::FETCH
($attrib);
my ($dbh, $attrib, $value) = @_;
# would normally validate and only store known attributes
# else pass up to DBI to handle
if ($attrib eq 'AutoCommit') {
return 1 if $value; # is already set
croak
("Can't disable AutoCommit");
return $dbh->DBD::_
::db
::STORE
($attrib, $value);
{ package DBD
::NullP
::st
; # ====== STATEMENT ======
$sth->{dbd_nullp_data
} = $dir if $dir;
my $data = $sth->{dbd_nullp_data
};
$sth->{dbd_nullp_data
} = undef;
$sth->finish; # no more data so finish
# would normally validate and only fetch known attributes
# else pass up to DBI to handle
return [ "fieldname" ] if $attrib eq 'NAME';
return $sth->DBD::_
::st
::FETCH
($attrib);
my ($sth, $attrib, $value) = @_;
# would normally validate and only store known attributes
# else pass up to DBI to handle
return $sth->DBD::_
::st
::STORE
($attrib, $value);