--- nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2002/12/04 08:54:08 1.11 +++ nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2002/12/04 11:34:49 1.12 @@ -1,8 +1,11 @@ ############################################ # -# $Id: Tangram.pm,v 1.11 2002/12/04 08:54:08 jonen Exp $ +# $Id: Tangram.pm,v 1.12 2002/12/04 11:34:49 joko Exp $ # # $Log: Tangram.pm,v $ +# Revision 1.12 2002/12/04 11:34:49 joko +# - $schema_tangram doesn't have to be in class? +# # Revision 1.11 2002/12/04 08:54:08 jonen # + untested bugfix: undef($object) after transform to hash at getObjectAsHash # @@ -74,6 +77,9 @@ my $logger = Log::Dispatch::Config->instance; +# this holds the complete instantiated schema from tangram +my $schema_tangram; + sub getMetaInfo { my $self = shift; $logger->debug( __PACKAGE__ . "->getMetaInfo()" ); @@ -85,11 +91,11 @@ sub _initSchema { my $self = shift; $logger->debug( __PACKAGE__ . "->_initSchema()" ); - #if (!$self->{schema_tangram}) { + #if (!$schema_tangram) { my $obj = getNewPerlObjectByPkgName($self->{locator}->{schema}, { EXPORT_OBJECTS => $self->{locator}->{classnames}, want_transactions => $self->{locator}->{want_transactions} } ); - $self->{schema_tangram} = $obj->getSchema(); + $schema_tangram = $obj->getSchema(); #} - if (!$self->{schema_tangram}) { + if (!$schema_tangram) { $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" ); return 0; } @@ -118,7 +124,7 @@ # create the main tangram storage object #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn ); - $self->{COREHANDLE} = Tangram::Relational->connect( $self->{schema_tangram}, $dsn ); + $self->{COREHANDLE} = Tangram::Relational->connect( $schema_tangram, $dsn ); # some attempts for configuring the wrapped underlying dbi..... #$self->{STORAGEHANDLE_UNDERLYING} = $self->getUnderlyingStorage(); @@ -265,7 +271,7 @@ my $ok; if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { return unless $self->_initSchema(); - $ok = Tangram::Relational->deploy($self->{schema_tangram}, $dbh ); + $ok = Tangram::Relational->deploy($schema_tangram, $dbh ); $dbh->disconnect(); } return $ok; @@ -286,7 +292,7 @@ #use Data::Dumper; print Dumper($self); $self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11"); - $ok = Tangram::Relational->retreat($self->{schema_tangram}, $dbh ); + $ok = Tangram::Relational->retreat($schema_tangram, $dbh ); # 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 @@ -489,4 +495,8 @@ return $deref; } +sub getSchema { + return $schema_tangram; +} + 1;