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 |
## |
## |
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! |
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__ |