/[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.7 by joko, Sun Dec 1 04:46:19 2002 UTC revision 1.8 by joko, Sun Dec 1 22:25:51 2002 UTC
# Line 3  Line 3 
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  #  #
# Line 138  sub getChildNodes { Line 141  sub getChildNodes {
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        
# Line 242  sub deploySchema { Line 246  sub deploySchema {
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    }    }
# Line 264  sub retreatSchema { Line 262  sub retreatSchema {
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            
# Line 280  sub retreatSchema { Line 274  sub retreatSchema {
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  }  }
# Line 450  sub eraseAll { Line 451  sub eraseAll {
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;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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