--- nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2002/12/01 04:46:19 1.7 +++ nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2002/12/01 22:25:51 1.8 @@ -1,8 +1,11 @@ ############################################ # -# $Id: Tangram.pm,v 1.7 2002/12/01 04:46:19 joko Exp $ +# $Id: Tangram.pm,v 1.8 2002/12/01 22:25:51 joko Exp $ # # $Log: Tangram.pm,v $ +# Revision 1.8 2002/12/01 22:25:51 joko +# + now utilizing metadata from storage locator when connecting to DBI in "raw"-mode +# # Revision 1.7 2002/12/01 04:46:19 joko # + sub eraseAll # @@ -138,7 +141,8 @@ #print Dumper($self); #if (my $result = $self->sendCommand( 'SHOW TABLES;' ) ) { - $storage->disconnect(); + # TODO: REVIEW + #$storage->disconnect(); $self->{meta}->{childnodes} = \@nodes; @@ -242,18 +246,12 @@ my $args = shift; my $dsn = $self->{locator}->{dbi}->{dsn}; - #my $dsn = $self->{dbi}->{dsn}; $logger->debug( __PACKAGE__ . "->deploySchema( dsn $dsn )" ); my $ok; - # TODO: is this DBI->connect okay here like it is? regarding errors.....??? - if ( my $dbh = DBI->connect($dsn, '', '', { - PrintError => 0, - } ) ) { - + if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { return unless $self->_initSchema(); - $ok = Tangram::Relational->deploy($self->{schema_tangram}, $dbh ); $dbh->disconnect(); } @@ -264,15 +262,11 @@ my $self = shift; my $dsn = $self->{locator}->{dbi}->{dsn}; - #my $dsn = $self->{dbi}->{dsn}; $logger->debug( __PACKAGE__ . "->retreatSchema( dsn $dsn )" ); my $ok; - if ( my $dbh = DBI->connect($dsn, '', '', { - #PrintError => 0, - #RaiseError => 0, - } ) ) { + if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { return unless $self->_initSchema(); @@ -280,10 +274,17 @@ $self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11"); $ok = Tangram::Relational->retreat($self->{schema_tangram}, $dbh ); - $ok = 2; # answer is "maybe" for now since Tangram::Relational->retreat doesn't seem to return a valid status - # idea: test this by checking for count of tables in database - - # problem with this: there may be some left not having been included to the schema + + # answer "$ok=2" means "maybe" for now - we have to patch this to a constant here because... + # - ... Tangram::Relational->retreat doesn't seem to return a valid status + # - possible improvement: + # - test this by checking for count of tables in database + # - problem with this: there may be some left not having been included to the schema + # - maybe better: use "->getChildNodes"? + $ok = 2; + $dbh->disconnect(); + } return $ok; } @@ -450,4 +451,10 @@ $self->{COREHANDLE}->erase(@objs); } +sub createDb { + my $self = shift; + my $storage = $self->_getSubLayerHandle(); + return $storage->createDb(); +} + 1;