/[cvs]/nfo/perl/libs/Data/Storage.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by joko, Thu Jan 30 21:42:22 2003 UTC revision 1.18 by joko, Thu Jan 30 22:12:17 2003 UTC
# Line 9  Line 9 
9  ## ------------------------------------------------------------------------  ## ------------------------------------------------------------------------
10  ##  ##
11  ##  $Log$  ##  $Log$
12    ##  Revision 1.18  2003/01/30 22:12:17  joko
13    ##  - removed/refactored old code: ->Data::Storage::Handler::Tangram|DBI
14    ##
15  ##  Revision 1.17  2003/01/30 21:42:22  joko  ##  Revision 1.17  2003/01/30 21:42:22  joko
16  ##  + minor update: renamed method  ##  + minor update: renamed method
17  ##  ##
# Line 181  sub _filter_AUTOLOAD { Line 184  sub _filter_AUTOLOAD {
184  }  }
185    
186    
 sub normalizeArgs {  
   my %args = @_;  
   if (!$args{dsn} && $args{meta}{dsn}) {  
     $args{dsn} = $args{meta}{dsn};  
   }  
   my @result = %args;  
   return @result;  
 }  
   
187  sub _accessStorageHandle {  sub _accessStorageHandle {
188    my $self = shift;    my $self = shift;
189    # TODO: to some tracelevel!    # TODO: to some tracelevel!
# Line 297  sub removeLogDispatchHandler { Line 291  sub removeLogDispatchHandler {
291    $logger->remove($name);    $logger->remove($name);
292  }  }
293    
 =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  
294    
295  1;  1;
296  __END__  __END__

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed