--- nfo/perl/libs/Data/Storage.pm 2002/11/29 04:48:23 1.8 +++ nfo/perl/libs/Data/Storage.pm 2002/12/01 22:15:45 1.9 @@ -1,4 +1,4 @@ -# $Id: Storage.pm,v 1.8 2002/11/29 04:48:23 joko Exp $ +# $Id: Storage.pm,v 1.9 2002/12/01 22:15:45 joko Exp $ # # Copyright (c) 2002 Andreas Motl # @@ -7,6 +7,9 @@ ############################################ # # $Log: Storage.pm,v $ +# Revision 1.9 2002/12/01 22:15:45 joko +# - sub createDb: moved to handler +# # Revision 1.8 2002/11/29 04:48:23 joko # + updated pod # @@ -362,7 +365,10 @@ 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 ); @@ -376,31 +382,6 @@ return $status; } -sub createDb { - my $self = shift; - my $dsn = $self->{locator}->{dbi}->{dsn}; - - $logger->debug( __PACKAGE__ . "->createDb( dsn $dsn )" ); - - $dsn =~ s/database=(.+?);//; - my $database_name = $1; - - my $ok; - - if ( my $dbh = DBI->connect($dsn, '', '', { - PrintError => 0, - } ) ) { - if ($database_name) { - if ($dbh->do("CREATE DATABASE $database_name;")) { - $ok = 1; - } - } - $dbh->disconnect(); - } - - return $ok; - -} sub dropDb { my $self = shift; @@ -421,7 +402,9 @@ $ok = 1; } } + $dbh->disconnect(); + } return $ok;