/[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.19 by joko, Mon Dec 16 06:46:09 2002 UTC revision 1.23 by joko, Thu Dec 19 16:31:53 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.23  2002/12/19 16:31:53  joko
7    #  +- renamed sub to 'rebuildDb'
8    #
9    #  Revision 1.22  2002/12/18 22:28:16  jonen
10    #  + added extended logging at 'getObjectByGuid()'
11    #
12    #  Revision 1.21  2002/12/16 22:20:49  jonen
13    #  + fixed bug at 'getObjectByGuid()'
14    #
15    #  Revision 1.20  2002/12/16 20:49:17  jonen
16    #  + added sub 'getObjectByGuid()'
17    #  + added functionality to use 'getObjectByGuid' at 'getObjectAsHash()'
18    #
19  #  Revision 1.19  2002/12/16 06:46:09  joko  #  Revision 1.19  2002/12/16 06:46:09  joko
20  #  + attempt to introduce a generic '_patchSchema' - cancelled!  #  + attempt to introduce a generic '_patchSchema' - cancelled!
21  #  #
# Line 355  sub retreatSchema { Line 368  sub retreatSchema {
368    return $ok;    return $ok;
369  }  }
370    
371  sub rebuildDbAndSchema {  sub rebuildDb {
372    my $self = shift;    my $self = shift;
373    $logger->info( __PACKAGE__ . "->rebuildDbAndSchema()" );    $logger->info( __PACKAGE__ . "->rebuildDb()" );
374    my @results;    my @results;
375    
376    # sum up results (bool (0/1)) in array    # sum up results (bool (0/1)) in array
# Line 549  sub getObject { Line 562  sub getObject {
562    return $object if $object;    return $object if $object;
563  }  }
564    
565    sub getObjectByGuid {
566      my $self = shift;
567      my $guid = shift;
568      my $options = shift;
569      
570      # Guid and Classname is needed
571      if(!$guid || !$options->{classname}) {
572       $logger->error( __PACKAGE__ . "->getObjectByGuid: No 'guid' OR no Classname in options hash was given but needed!" );
573        return;
574      }
575      
576      # TODO: create a deep_unload method (currently _all_ objects are unloaded)
577      # unload($oid) will only unload object, not deep object hashes
578      $self->{_COREHANDLE}->unload() if ($options->{destroy});
579    
580      # search for object with given Classname and Guid
581      my $obj_tmp = $self->{_COREHANDLE}->remote($options->{classname});
582      my @result = $self->{_COREHANDLE}->select($obj_tmp, $obj_tmp->{guid} eq $guid);
583      
584      # we searched for global unique identifer of some object,
585      # so I think we can trust there would be only one result
586      if($result[0]) {
587        return $result[0];
588      } else {
589        $logger->error( __PACKAGE__ . "->getObjectByGuid: No Object with Classname $options->{classname} and GUID $guid found!" );
590        return;
591      }
592      
593    }
594    
595  sub getObjectAsHash {  sub getObjectAsHash {
596    my $self = shift;    my $self = shift;
597    my $oid = shift;    my $oid = shift;
598    my $options = shift;    my $options = shift;  
599    my $obj = $self->getObject($oid, $options);    my $obj;
600      
601      if($options->{guid}) {
602        $obj = $self->getObjectByGuid($oid, $options);
603      } else {
604        $obj = $self->getObject($oid, $options);
605      }
606        
607    # build options (a callback to unload autovivified objects) for 'expand'    # build options (a callback to unload autovivified objects) for 'expand'
608    # TODO: use $logger to write to debug here!    # TODO: use $logger to write to debug here!

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.23

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