/[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.27 by joko, Fri Jan 31 06:30:59 2003 UTC revision 1.29 by joko, Fri Feb 21 01:47:18 2003 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.29  2003/02/21 01:47:18  joko
7    #  purged old code
8    #  minor cosmetics
9    #
10    #  Revision 1.28  2003/02/20 20:20:26  joko
11    #  tried to get auto-disconnect working again - failed with that
12    #
13  #  Revision 1.27  2003/01/31 06:30:59  joko  #  Revision 1.27  2003/01/31 06:30:59  joko
14  #  + enabled 'sendQuery'  #  + enabled 'sendQuery'
15  #  #
# Line 41  Line 48 
48  #  + fix: encapsulated object-loading inside an 'eval'  #  + fix: encapsulated object-loading inside an 'eval'
49  #  #
50  #  Revision 1.15  2002/12/05 13:55:21  joko  #  Revision 1.15  2002/12/05 13:55:21  joko
51  #  + now utilizing 'object2hash' instead of 'var_deref'  #  + now utilizing 'expand' instead of 'var_deref'
52  #  + played around with having fresh-objects - no progress....  #  + played around with having fresh-objects - no progress....
53  #  #
54  #  Revision 1.14  2002/12/05 09:40:30  jonen  #  Revision 1.14  2002/12/05 09:40:30  jonen
# Line 114  use warnings; Line 121  use warnings;
121  use base ("Data::Storage::Handler");  use base ("Data::Storage::Handler");
122  use base ("Data::Storage::Handler::Abstract");  use base ("Data::Storage::Handler::Abstract");
123    
124  use Tangram;  
125  use Data::Dumper;  use Data::Dumper;
126    use Tangram;
127    
128  use DesignPattern::Object;  use DesignPattern::Object;
129  use Data::Storage::Result::Tangram;  use Data::Storage::Result::Tangram;
130  use Data::Compare::Struct qw( isEmpty );  use Data::Compare::Struct qw( isEmpty );
131  use Data::Transform::Deep qw( object2hash );  use Data::Transform::Deep qw( expand );
 use Data::Transform::Encode qw( var2utf8 );  
132    
133  # get logger instance  # get logger instance
134  my $logger = Log::Dispatch::Config->instance;  my $logger = Log::Dispatch::Config->instance;
# Line 636  sub getObjectAsHash { Line 644  sub getObjectAsHash {
644    # build options (a callback to unload autovivified objects) for 'expand'    # build options (a callback to unload autovivified objects) for 'expand'
645    # TODO: use $logger to write to debug here!    # TODO: use $logger to write to debug here!
646    my $cb; # = sub {};    my $cb; # = sub {};
647    
648      # deactivated way to get rid of used instances, if requested
649  =pod  =pod
650    if ($options->{destroy}) {      if ($options->{destroy}) {
651      $options->{cb}->{destroy} = sub {        $options->{cb}->{destroy} = sub {
652        print "================ DESTROY", "\n";          print "================ DESTROY", "\n";
653        my $object = shift;          my $object = shift;
654        #print Dumper($object);          #print Dumper($object);
655        $self->{_COREHANDLE}->unload($object);          $self->{_COREHANDLE}->unload($object);
656        #undef($object);          #undef($object);
657      };        };
658    }      }
659  =cut  =cut
660    
661    my $hash = object2hash($obj, $options);    my $hash = expand($obj, $options);
662    #$options->{cb}->{destroy}->($obj);  
663    #$self->{_COREHANDLE}->unload($obj);    # old (unsuccessful) attempts to get rid of used instances, if requested
664      
665    # convert values in hash to utf8 to be ready for (e.g.) encapsulation in XML      # V1:
666    # now done in object2hash      #$options->{cb}->{destroy}->($obj);
667    #var2utf8($hash) if ($options->{utf8});      #$self->{_COREHANDLE}->unload($obj);
668        
669    # old (wrong) attempts to get rid of used instances, if requested      # V2:
670      #$obj->clear_refs;      #$obj->clear_refs;
671      #$self->{COREHANDLE}->unload($obj) if($options->{destroy});      #$self->{COREHANDLE}->unload($obj) if($options->{destroy});
672      #$obj->DESTROY;      #$obj->DESTROY;
# Line 686  sub testAvailability { Line 696  sub testAvailability {
696    return $storage->testAvailability();    return $storage->testAvailability();
697  }  }
698    
699    sub disconnect2 {
700      my $self = shift;
701      my $storage = $self->_getSubLayerHandle();
702      print "DISC!", "\n";
703    
704      my $storage_ll = $storage->{_COREHANDLE};
705      $storage_ll->disconnect();
706      
707      print Dumper($storage);
708      exit;
709      
710      #$self->{_COREHANDLE}
711      #$storage->disconnect();
712      $self->{dataStorageLayer}->disconnect();
713    }
714    
715  1;  1;
716  __END__  __END__

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.29

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