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

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

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

revision 1.12 by joko, Thu Jan 30 21:46:32 2003 UTC revision 1.15 by joko, Thu Feb 20 20:19:13 2003 UTC
# Line 2  Line 2 
2  ##    $Id$  ##    $Id$
3  ##    ------------------------------------------------------------------------  ##    ------------------------------------------------------------------------
4  ##    $Log$  ##    $Log$
5    ##    Revision 1.15  2003/02/20 20:19:13  joko
6    ##    tried to get auto-disconnect working again - failed with that
7    ##
8    ##    Revision 1.14  2003/02/09 05:12:28  joko
9    ##    + quoting of strings used in sql-queries!
10    ##
11    ##    Revision 1.13  2003/01/30 22:27:05  joko
12    ##    + added new abstract methods
13    ##
14  ##    Revision 1.12  2003/01/30 21:46:32  joko  ##    Revision 1.12  2003/01/30 21:46:32  joko
15  ##    + fixed behaviour of AUTOLOAD-method  ##    + fixed behaviour of AUTOLOAD-method
16  ##  ##
# Line 55  use base qw( DesignPattern::Object ); Line 64  use base qw( DesignPattern::Object );
64  use Data::Dumper;  use Data::Dumper;
65  use Tie::SecureHash;  use Tie::SecureHash;
66  #use Data::Storage::Handler;  #use Data::Storage::Handler;
67  use Data::Transform::Deep qw( merge );  use Hash::Merge qw( merge );
68    
69    
70  # get logger instance  # get logger instance
# Line 274  sub AUTOLOAD { Line 283  sub AUTOLOAD {
283    
284  sub DESTROY {  sub DESTROY {
285    my $self = shift;    my $self = shift;
286    #if ($self->{COREHANDLE}) {  
287    if ($self->exists('_COREHANDLE')) {  return;
288    
289      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );
290    
291      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};
292      print "meth: ", $disconnectMethod, "\n";
293      
294      #$disconnectMethod && $self->{_COREHANDLE} && ( $self->{_COREHANDLE}->$disconnectMethod() );
295      $self->{_COREHANDLE}->$disconnectMethod();
296      #$self->$disconnectMethod();
297    
298      #my $core1 = $self->getCOREHANDLE() if $self->can('getCOREHANDLE');
299      #$core1->$disconnectMethod();
300    
301    return;
302    
303      print "DESTROY-1", "\n";
304      #if ($self->{__COREHANDLE}) {
305      #if ($self->exists('_COREHANDLE')) {
306    
307      # get corehandle instance from underlying handler
308      my $core;
309      $core = $self->getCOREHANDLE() if $self->can('getCOREHANDLE');
310    
311      #if ($self->{STORAGEHANDLE}) {
312      if ($core) {
313        print "DESTROY-2", "\n";
314      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );
315    
316      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};
# Line 302  sub _typeCheck2 { Line 337  sub _typeCheck2 {
337    sub existsChildNode {    sub existsChildNode {
338      my $self = shift;      my $self = shift;
339      my $nodename = shift;      my $nodename = shift;
340      #$nodename = 'TransactionRoutingTable';  
341      $logger->debug( __PACKAGE__ . "->existsChildNode( nodename $nodename )" );      # TODO: don't use $self->{meta}->{childnodes} directly in here
342        # get it returned from $self->getChildNodes()!!!
343    
344        $logger->debug( __PACKAGE__ . "->existsChildNode( nodename=$nodename )" );
345      $self->getChildNodes() unless $self->{meta}->{childnodes};      $self->getChildNodes() unless $self->{meta}->{childnodes};
346      my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});     # TODO: use "/i" only on win32-systems!  
347        # quote this, it might contain meta characters which don't work in a regex
348          $nodename = quotemeta($nodename);
349    
350        # trace
351          #print Dumper($self->{meta});
352          #print "nodename: $nodename", "\n";
353        
354        # FIXME: use "/i" only on win32-systems!
355        my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});
356        
357      return $result;      return $result;
358    }    }
359    
# Line 426  sub _typeCheck2 { Line 474  sub _typeCheck2 {
474      return;      return;
475    }    }
476    
477      sub getDbName {
478        my $self = shift;
479        $self->_abstract_function('getDbName');
480        return;
481      }
482    
483      sub testAvailability {
484        my $self = shift;
485        $self->_abstract_function('testAvailability');
486        return;
487      }
488    
489      sub isConnected {
490        my $self = shift;
491        $self->_abstract_function('isConnected');
492        return;
493      }
494    
495      sub testDsn {
496        my $self = shift;
497        $self->_abstract_function('testDsn');
498        return;
499      }
500    
501  1;  1;

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

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