home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / DBD / NullP.pm < prev    next >
Encoding:
Text File  |  1997-08-10  |  1.9 KB  |  99 lines

  1. {
  2.     package DBD::NullP;
  3.  
  4.     require DBI;
  5.  
  6.     @EXPORT = qw(); # Do NOT @EXPORT anything.
  7.  
  8. #   $Id: NullP.pm,v 1.1 1995/10/24 01:45:52 timbo Exp $
  9. #
  10. #   Copyright (c) 1994, Tim Bunce
  11. #
  12. #   You may distribute under the terms of either the GNU General Public
  13. #   License or the Artistic License, as specified in the Perl README file.
  14.  
  15.     $drh = undef;    # holds driver handle once initialised
  16.     $err = 0;        # The $DBI::err value
  17.  
  18.     sub driver{
  19.     return $drh if $drh;
  20.     my($class, $attr) = @_;
  21.     $class .= "::dr";
  22.     ($drh) = DBI::_new_drh($class, {
  23.         'Name' => 'NullP',
  24.         'Version' => '$Revision: 1.1 $',
  25.         'Attribution' => 'DBD Example Null Perl stub by Tim Bunce',
  26.         }, [ qw'example implementors private data']);
  27.     $drh;
  28.     }
  29.  
  30.     1;
  31. }
  32.  
  33.  
  34. {   package DBD::NullP::dr; # ====== DRIVER ======
  35.     $imp_data_size = 0;
  36.     use strict;
  37.     # we use default (dummy) connect method
  38.  
  39.     sub disconnect_all { }
  40.     sub DESTROY { undef }
  41. }
  42.  
  43.  
  44. {   package DBD::NullP::db; # ====== DATABASE ======
  45.     $imp_data_size = 0;
  46.     use strict;
  47.  
  48.     sub prepare {
  49.     my($dbh, $statement)= @_;
  50.  
  51.     my($outer, $sth) = DBI::_new_sth($dbh, {
  52.         'Statement'     => $statement,
  53.         }, [ qw'example implementors private data']);
  54.  
  55.     $outer;
  56.     }
  57.  
  58.     sub DESTROY { undef }
  59. }
  60.  
  61.  
  62. {   package DBD::NullP::st; # ====== STATEMENT ======
  63.     $imp_data_size = 0;
  64.     use strict;
  65.  
  66.     sub execute {
  67.     my($sth, $dir) = @_;
  68.     1;
  69.     }
  70.  
  71.     sub fetch {
  72.     my($sth) = @_;
  73.     $sth->finish;     # no more data so finish
  74.     return [];
  75.     }
  76.  
  77.     sub finish {
  78.     my($sth) = @_;
  79.     }
  80.  
  81.     sub FETCH {
  82.     my ($sth, $attrib) = @_;
  83.     # would normally validate and only fetch known attributes
  84.     # else pass up to DBI to handle
  85.     return $sth->DBD::_::dr::FETCH($attrib);
  86.     }
  87.  
  88.     sub STORE {
  89.     my ($sth, $attrib, $value) = @_;
  90.     # would normally validate and only store known attributes
  91.     # else pass up to DBI to handle
  92.     return $sth->DBD::_::dr::STORE($attrib, $value);
  93.     }
  94.  
  95.     sub DESTROY { undef }
  96. }
  97.  
  98. 1;
  99.