--- nfo/perl/libs/Data/Storage.pm 2003/01/20 16:52:13 1.16 +++ nfo/perl/libs/Data/Storage.pm 2003/01/30 22:12:17 1.18 @@ -1,6 +1,6 @@ ## ------------------------------------------------------------------------ ## -## $Id: Storage.pm,v 1.16 2003/01/20 16:52:13 joko Exp $ +## $Id: Storage.pm,v 1.18 2003/01/30 22:12:17 joko Exp $ ## ## Copyright (c) 2002 Andreas Motl ## @@ -9,6 +9,12 @@ ## ------------------------------------------------------------------------ ## ## $Log: Storage.pm,v $ +## Revision 1.18 2003/01/30 22:12:17 joko +## - removed/refactored old code: ->Data::Storage::Handler::Tangram|DBI +## +## Revision 1.17 2003/01/30 21:42:22 joko +## + minor update: renamed method +## ## Revision 1.16 2003/01/20 16:52:13 joko ## + now using 'DesignPattern::Object' to create a new 'Data::Storage::Handler::Xyz' on demand - before we did this in a hand-rolled fashion ## @@ -154,7 +160,8 @@ # filtering AUTOLOAD calls and first-time-touch of the actual storage impl if ($self->_filter_AUTOLOAD($method)) { - $self->_accessStorage(); + #print "=== FILTER!", "\n"; + $self->_accessStorageHandle(); if ($self->{STORAGEHANDLE}) { return $self->{STORAGEHANDLE}->$method(@_); } else { @@ -177,20 +184,12 @@ } -sub normalizeArgs { - my %args = @_; - if (!$args{dsn} && $args{meta}{dsn}) { - $args{dsn} = $args{meta}{dsn}; - } - my @result = %args; - return @result; -} - -sub _accessStorage { +sub _accessStorageHandle { my $self = shift; # TODO: to some tracelevel! + #print "=========== _accessStorage", "\n"; if ($TRACELEVEL) { - $logger->debug( __PACKAGE__ . "[$self->{locator}->{type}]" . "->_accessStorage()" ); + $logger->debug( __PACKAGE__ . "[$self->{locator}->{type}]" . "->_accessStorageHandle()" ); } if (!$self->{STORAGEHANDLE}) { return $self->_createStorageHandle(); @@ -292,45 +291,6 @@ $logger->remove($name); } -=pod -sub getDbName { - my $self = shift; - my $dsn = $self->{locator}->{dbi}->{dsn}; - $dsn =~ m/database=(.+?);/; - my $database_name = $1; - return $database_name; -} - -sub testAvailability { - my $self = shift; - my $status = $self->testDsn(); - $self->{locator}->{status}->{available} = $status; - return $status; -} - -sub isConnected { - my $self = shift; - # TODO: REVIEW! - return 1 if $self->{STORAGEHANDLE}; -} - -sub testDsn { - my $self = shift; - my $dsn = $self->{locator}->{dbi}->{dsn}; - my $result; - if ( my $dbh = DBI->connect($dsn, '', '', { - PrintError => 0, - } ) ) { - - # TODO: REVIEW - $dbh->disconnect(); - - return 1; - } else { - $logger->warning( __PACKAGE__ . "[$self->{locator}->{type}]" . "->testDsn(): " . "DBI-error: " . $DBI::errstr ); - } -} -=cut 1; __END__