--- nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2003/06/25 22:57:54 1.40 +++ nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2003/07/02 11:07:12 1.43 @@ -1,8 +1,18 @@ ############################################ # -# $Id: Tangram.pm,v 1.40 2003/06/25 22:57:54 joko Exp $ +# $Id: Tangram.pm,v 1.43 2003/07/02 11:07:12 jonen Exp $ # # $Log: Tangram.pm,v $ +# Revision 1.43 2003/07/02 11:07:12 jonen +# re-activate filtering of results *after* results are fetched from tangram +# (needed for e.g. UserManagment) +# +# Revision 1.42 2003/07/01 23:24:17 joko +# now using package before using function +# +# Revision 1.41 2003/06/29 02:03:45 joko +# fix:? initialize schema on startup +# # Revision 1.40 2003/06/25 22:57:54 joko # major rework of "sub sendQuery / sub getListFiltered": now should be capable of "sorting" # @@ -163,6 +173,7 @@ use Data::Dumper; use Tangram; +use Class::Tangram; use DesignPattern::Object; use Data::Storage::Result::Tangram; @@ -190,10 +201,10 @@ #if (!$schema_tangram) { #my $obj = getNewPerlObjectByPkgName($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} } ); - $schema_tangram = $obj->getSchema(); + $schema_tangram = $obj->getSchema() if $obj; #} if (!$schema_tangram) { - $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" ); + $logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{locator}->{schema}." ); return 0; } #$self->_patchSchema(); @@ -239,8 +250,8 @@ # return; # } - #return unless $self->_initSchema(); - $self->_initSchema(); + return unless $self->_initSchema(); + #$self->_initSchema(); # create the main tangram storage object #$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn ); @@ -612,12 +623,11 @@ #@results = eval($evalstring); #die $@ if $@; -=pod - # filter results - if ($filters->[0]->{op} && ($filters->[0]->{op} eq "ref")) { + # filter results - NEEDED for e.g. UserManagment !! + if ($in->{filters}->[0]->{op} && ($in->{filters}->[0]->{op} eq "ref")) { #print "Filter->op eq 'ref'.\n"; - my $att_name = $filters->[0]->{key}; - my $att_val = $filters->[0]->{val}; + my $att_name = $in->{filters}->[0]->{key}; + my $att_val = $in->{filters}->[0]->{val}; my @filtered; foreach(@results) { if(ref($_->{$att_name}) eq $att_val) { @@ -626,7 +636,6 @@ } @results = @filtered; } -=cut #print "results: " . Dumper(\@results);