/[cvs]/nfo/perl/libs/Data/Storage/Handler/Tangram.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage/Handler/Tangram.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by jonen, Wed Dec 4 08:54:08 2002 UTC revision 1.12 by joko, Wed Dec 4 11:34:49 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.12  2002/12/04 11:34:49  joko
7    #  - $schema_tangram doesn't have to be in class?
8    #
9  #  Revision 1.11  2002/12/04 08:54:08  jonen  #  Revision 1.11  2002/12/04 08:54:08  jonen
10  #  + untested bugfix: undef($object) after transform to hash at getObjectAsHash  #  + untested bugfix: undef($object) after transform to hash at getObjectAsHash
11  #  #
# Line 74  use Data::Transform::Encode qw( var2utf8 Line 77  use Data::Transform::Encode qw( var2utf8
77  my $logger = Log::Dispatch::Config->instance;  my $logger = Log::Dispatch::Config->instance;
78    
79    
80    # this holds the complete instantiated schema from tangram
81    my $schema_tangram;
82    
83  sub getMetaInfo {  sub getMetaInfo {
84    my $self = shift;    my $self = shift;
85    $logger->debug( __PACKAGE__ . "->getMetaInfo()"  );    $logger->debug( __PACKAGE__ . "->getMetaInfo()"  );
# Line 85  sub getMetaInfo { Line 91  sub getMetaInfo {
91  sub _initSchema {  sub _initSchema {
92    my $self = shift;    my $self = shift;
93    $logger->debug( __PACKAGE__ . "->_initSchema()" );    $logger->debug( __PACKAGE__ . "->_initSchema()" );
94    #if (!$self->{schema_tangram}) {    #if (!$schema_tangram) {
95      my $obj = getNewPerlObjectByPkgName($self->{locator}->{schema}, { EXPORT_OBJECTS => $self->{locator}->{classnames}, want_transactions => $self->{locator}->{want_transactions} } );      my $obj = getNewPerlObjectByPkgName($self->{locator}->{schema}, { EXPORT_OBJECTS => $self->{locator}->{classnames}, want_transactions => $self->{locator}->{want_transactions} } );
96      $self->{schema_tangram} = $obj->getSchema();      $schema_tangram = $obj->getSchema();
97    #}    #}
98    if (!$self->{schema_tangram}) {    if (!$schema_tangram) {
99      $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" );      $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" );
100      return 0;      return 0;
101    }    }
# Line 118  sub connect { Line 124  sub connect {
124    
125      # create the main tangram storage object      # create the main tangram storage object
126      #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn );      #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn );
127      $self->{COREHANDLE} = Tangram::Relational->connect( $self->{schema_tangram}, $dsn );      $self->{COREHANDLE} = Tangram::Relational->connect( $schema_tangram, $dsn );
128        
129      # some attempts for configuring the wrapped underlying dbi.....      # some attempts for configuring the wrapped underlying dbi.....
130      #$self->{STORAGEHANDLE_UNDERLYING} = $self->getUnderlyingStorage();      #$self->{STORAGEHANDLE_UNDERLYING} = $self->getUnderlyingStorage();
# Line 265  sub deploySchema { Line 271  sub deploySchema {
271    my $ok;    my $ok;
272    if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) {    if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) {
273      return unless $self->_initSchema();      return unless $self->_initSchema();
274      $ok = Tangram::Relational->deploy($self->{schema_tangram}, $dbh );      $ok = Tangram::Relational->deploy($schema_tangram, $dbh );
275      $dbh->disconnect();      $dbh->disconnect();
276    }    }
277    return $ok;    return $ok;
# Line 286  sub retreatSchema { Line 292  sub retreatSchema {
292      #use Data::Dumper; print Dumper($self);      #use Data::Dumper; print Dumper($self);
293      $self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11");      $self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11");
294            
295      $ok = Tangram::Relational->retreat($self->{schema_tangram}, $dbh );      $ok = Tangram::Relational->retreat($schema_tangram, $dbh );
296    
297      # answer "$ok=2" means "maybe" for now - we have to patch this to a constant here because...      # answer "$ok=2" means "maybe" for now - we have to patch this to a constant here because...
298      # - ... Tangram::Relational->retreat doesn't seem to return a valid status      # - ... Tangram::Relational->retreat doesn't seem to return a valid status
# Line 489  sub getObjectAsHash { Line 495  sub getObjectAsHash {
495    return $deref;    return $deref;
496  }  }
497    
498    sub getSchema {
499      return $schema_tangram;
500    }
501    
502  1;  1;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed