--- nfo/perl/libs/Data/Storage/Handler/DBI.pm 2002/12/01 22:20:43 1.8 +++ nfo/perl/libs/Data/Storage/Handler/DBI.pm 2002/12/05 07:58:20 1.9 @@ -1,8 +1,12 @@ ################################# # -# $Id: DBI.pm,v 1.8 2002/12/01 22:20:43 joko Exp $ +# $Id: DBI.pm,v 1.9 2002/12/05 07:58:20 joko Exp $ # # $Log: DBI.pm,v $ +# Revision 1.9 2002/12/05 07:58:20 joko +# + now using Tie::SecureHash as a base for the COREHANDLE +# + former public COREHANDLE becomes private _COREHANDLE now +# # Revision 1.8 2002/12/01 22:20:43 joko # + sub createDb (from Storage.pm) # @@ -74,8 +78,8 @@ #use Data::Dumper; print Dumper($self->{dbi}); eval { - $self->{COREHANDLE} = DBI->connect( $dsn, '', '', $self->{locator}->{dbi} ); - if (!$self->{COREHANDLE}) { + $self->{_COREHANDLE} = DBI->connect( $dsn, '', '', $self->{locator}->{dbi} ); + if (!$self->{_COREHANDLE}) { $logger->warning( __PACKAGE__ . "->connect failed: " . DBI::errstr ); return; } @@ -97,20 +101,20 @@ $logger->debug( __PACKAGE__ . "->configureCOREHANDLE" ); - return if !$self->{COREHANDLE}; + return if !$self->{_COREHANDLE}; # apply configured modifications to DBI-handle if (exists $self->{locator}->{dbi}->{trace_level} && exists $self->{locator}->{dbi}->{trace_file}) { - $self->{COREHANDLE}->trace($self->{locator}->{dbi}->{trace_level}, $self->{locator}->{dbi}->{trace_file}); + $self->{_COREHANDLE}->trace($self->{locator}->{dbi}->{trace_level}, $self->{locator}->{dbi}->{trace_file}); } if (exists $self->{locator}->{dbi}->{RaiseError}) { - $self->{COREHANDLE}->{RaiseError} = $self->{locator}->{dbi}->{RaiseError}; + $self->{_COREHANDLE}->{RaiseError} = $self->{locator}->{dbi}->{RaiseError}; } if (exists $self->{locator}->{dbi}->{PrintError}) { - $self->{COREHANDLE}->{PrintError} = $self->{locator}->{dbi}->{PrintError}; + $self->{_COREHANDLE}->{PrintError} = $self->{locator}->{dbi}->{PrintError}; } if (exists $self->{locator}->{dbi}->{HandleError}) { - $self->{COREHANDLE}->{HandleError} = $self->{locator}->{dbi}->{HandleError}; + $self->{_COREHANDLE}->{HandleError} = $self->{locator}->{dbi}->{HandleError}; } } @@ -121,18 +125,18 @@ # two-level handling for implicit connect: # if there's no corehandle ... - if (!$self->{COREHANDLE}) { + if (!$self->{_COREHANDLE}) { # ... try to connect, but ... $self->connect(); # ... if this still fails, there's something wrong probably, so we won't continue - if (!$self->{COREHANDLE}) { + if (!$self->{_COREHANDLE}) { return; } } #print "prepare sql: $sql\n"; - my $sth = $self->{COREHANDLE}->prepare($sql); + my $sth = $self->{_COREHANDLE}->prepare($sql); $sth->execute(); return $sth; } @@ -151,6 +155,8 @@ my $self = shift; my @nodes; $logger->debug( __PACKAGE__ . "->getChildNodes()" ); + my $locator = $self->{locator}; + #print Dumper($locator); exit; if (my $result = $self->sendCommand( 'SHOW TABLES;' ) ) { my $dbname = getDbNameByDsn($self->{locator}->{dbi}->{dsn}); my $key = "Tables_in_$dbname"; @@ -244,4 +250,9 @@ } +sub getCOREHANDLE2 { + my $self = shift; + return $self->{_COREHANDLE}; +} + 1;