3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
5 |
# $Log$ |
# $Log$ |
6 |
|
# Revision 1.8 2002/12/01 22:25:51 joko |
7 |
|
# + now utilizing metadata from storage locator when connecting to DBI in "raw"-mode |
8 |
|
# |
9 |
# Revision 1.7 2002/12/01 04:46:19 joko |
# Revision 1.7 2002/12/01 04:46:19 joko |
10 |
# + sub eraseAll |
# + sub eraseAll |
11 |
# |
# |
141 |
#print Dumper($self); |
#print Dumper($self); |
142 |
#if (my $result = $self->sendCommand( 'SHOW TABLES;' ) ) { |
#if (my $result = $self->sendCommand( 'SHOW TABLES;' ) ) { |
143 |
|
|
144 |
$storage->disconnect(); |
# TODO: REVIEW |
145 |
|
#$storage->disconnect(); |
146 |
|
|
147 |
$self->{meta}->{childnodes} = \@nodes; |
$self->{meta}->{childnodes} = \@nodes; |
148 |
|
|
246 |
my $args = shift; |
my $args = shift; |
247 |
|
|
248 |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
|
#my $dsn = $self->{dbi}->{dsn}; |
|
249 |
|
|
250 |
$logger->debug( __PACKAGE__ . "->deploySchema( dsn $dsn )" ); |
$logger->debug( __PACKAGE__ . "->deploySchema( dsn $dsn )" ); |
251 |
|
|
252 |
my $ok; |
my $ok; |
253 |
# TODO: is this DBI->connect okay here like it is? regarding errors.....??? |
if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { |
|
if ( my $dbh = DBI->connect($dsn, '', '', { |
|
|
PrintError => 0, |
|
|
} ) ) { |
|
|
|
|
254 |
return unless $self->_initSchema(); |
return unless $self->_initSchema(); |
|
|
|
255 |
$ok = Tangram::Relational->deploy($self->{schema_tangram}, $dbh ); |
$ok = Tangram::Relational->deploy($self->{schema_tangram}, $dbh ); |
256 |
$dbh->disconnect(); |
$dbh->disconnect(); |
257 |
} |
} |
262 |
|
|
263 |
my $self = shift; |
my $self = shift; |
264 |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
|
#my $dsn = $self->{dbi}->{dsn}; |
|
265 |
|
|
266 |
$logger->debug( __PACKAGE__ . "->retreatSchema( dsn $dsn )" ); |
$logger->debug( __PACKAGE__ . "->retreatSchema( dsn $dsn )" ); |
267 |
|
|
268 |
my $ok; |
my $ok; |
269 |
if ( my $dbh = DBI->connect($dsn, '', '', { |
if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { |
|
#PrintError => 0, |
|
|
#RaiseError => 0, |
|
|
} ) ) { |
|
270 |
|
|
271 |
return unless $self->_initSchema(); |
return unless $self->_initSchema(); |
272 |
|
|
274 |
$self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11"); |
$self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11"); |
275 |
|
|
276 |
$ok = Tangram::Relational->retreat($self->{schema_tangram}, $dbh ); |
$ok = Tangram::Relational->retreat($self->{schema_tangram}, $dbh ); |
277 |
$ok = 2; # answer is "maybe" for now since Tangram::Relational->retreat doesn't seem to return a valid status |
|
278 |
# idea: test this by checking for count of tables in database - |
# answer "$ok=2" means "maybe" for now - we have to patch this to a constant here because... |
279 |
# problem with this: there may be some left not having been included to the schema |
# - ... Tangram::Relational->retreat doesn't seem to return a valid status |
280 |
|
# - possible improvement: |
281 |
|
# - test this by checking for count of tables in database |
282 |
|
# - problem with this: there may be some left not having been included to the schema |
283 |
|
# - maybe better: use "->getChildNodes"? |
284 |
|
$ok = 2; |
285 |
|
|
286 |
$dbh->disconnect(); |
$dbh->disconnect(); |
287 |
|
|
288 |
} |
} |
289 |
return $ok; |
return $ok; |
290 |
} |
} |
451 |
$self->{COREHANDLE}->erase(@objs); |
$self->{COREHANDLE}->erase(@objs); |
452 |
} |
} |
453 |
|
|
454 |
|
sub createDb { |
455 |
|
my $self = shift; |
456 |
|
my $storage = $self->_getSubLayerHandle(); |
457 |
|
return $storage->createDb(); |
458 |
|
} |
459 |
|
|
460 |
1; |
1; |