/[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.40 by joko, Wed Jun 25 22:57:54 2003 UTC revision 1.43 by jonen, Wed Jul 2 11:07:12 2003 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.43  2003/07/02 11:07:12  jonen
7    #  re-activate filtering of results *after* results are fetched from tangram
8    #    (needed for e.g. UserManagment)
9    #
10    #  Revision 1.42  2003/07/01 23:24:17  joko
11    #  now using package before using function
12    #
13    #  Revision 1.41  2003/06/29 02:03:45  joko
14    #  fix:? initialize schema on startup
15    #
16  #  Revision 1.40  2003/06/25 22:57:54  joko  #  Revision 1.40  2003/06/25 22:57:54  joko
17  #  major rework of "sub sendQuery / sub getListFiltered": now should be capable of "sorting"  #  major rework of "sub sendQuery / sub getListFiltered": now should be capable of "sorting"
18  #  #
# Line 163  use base ("Data::Storage::Handler::Abstr Line 173  use base ("Data::Storage::Handler::Abstr
173    
174  use Data::Dumper;  use Data::Dumper;
175  use Tangram;  use Tangram;
176    use Class::Tangram;
177    
178  use DesignPattern::Object;  use DesignPattern::Object;
179  use Data::Storage::Result::Tangram;  use Data::Storage::Result::Tangram;
# Line 190  sub _initSchema { Line 201  sub _initSchema {
201    #if (!$schema_tangram) {    #if (!$schema_tangram) {
202      #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} } );
203      my $obj = DesignPattern::Object->fromPackage($self->{locator}->{schema}, { 'EXPORT_OBJECTS' => $self->{locator}->{classnames}, 'want_transactions' => $self->{locator}->{want_transactions} } );      my $obj = DesignPattern::Object->fromPackage($self->{locator}->{schema}, { 'EXPORT_OBJECTS' => $self->{locator}->{classnames}, 'want_transactions' => $self->{locator}->{want_transactions} } );
204      $schema_tangram = $obj->getSchema();      $schema_tangram = $obj->getSchema() if $obj;
205    #}    #}
206    if (!$schema_tangram) {    if (!$schema_tangram) {
207      $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" );      $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{locator}->{schema}." );
208      return 0;      return 0;
209    }    }
210    #$self->_patchSchema();    #$self->_patchSchema();
# Line 239  sub connect { Line 250  sub connect {
250  #      return;  #      return;
251  #    }  #    }
252    
253      #return unless $self->_initSchema();      return unless $self->_initSchema();
254      $self->_initSchema();      #$self->_initSchema();
255    
256      # create the main tangram storage object      # create the main tangram storage object
257      #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn );      #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn );
# Line 612  sub getListFiltered { Line 623  sub getListFiltered {
623      #@results = eval($evalstring);      #@results = eval($evalstring);
624      #die $@ if $@;      #die $@ if $@;
625    
626  =pod    # filter results - NEEDED for e.g. UserManagment !!
627    # filter results    if ($in->{filters}->[0]->{op} && ($in->{filters}->[0]->{op} eq "ref")) {
   if ($filters->[0]->{op} && ($filters->[0]->{op} eq "ref")) {  
628        #print "Filter->op eq 'ref'.\n";        #print "Filter->op eq 'ref'.\n";
629        my $att_name = $filters->[0]->{key};        my $att_name = $in->{filters}->[0]->{key};
630        my $att_val = $filters->[0]->{val};        my $att_val = $in->{filters}->[0]->{val};
631        my @filtered;        my @filtered;
632        foreach(@results) {        foreach(@results) {
633          if(ref($_->{$att_name}) eq $att_val) {          if(ref($_->{$att_name}) eq $att_val) {
# Line 626  sub getListFiltered { Line 636  sub getListFiltered {
636        }        }
637        @results = @filtered;        @results = @filtered;
638    }    }
 =cut  
639    
640    #print "results: " . Dumper(\@results);    #print "results: " . Dumper(\@results);
641        

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.43

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