--- nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2003/12/14 01:48:36 1.45 +++ nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2004/11/03 14:12:34 1.49 @@ -1,8 +1,20 @@ ############################################ # -# $Id: Tangram.pm,v 1.45 2003/12/14 01:48:36 jonen Exp $ +# $Id: Tangram.pm,v 1.49 2004/11/03 14:12:34 jonen Exp $ # # $Log: Tangram.pm,v $ +# Revision 1.49 2004/11/03 14:12:34 jonen +# replaced print with logger->info +# +# Revision 1.48 2004/10/28 11:35:51 jonen +# + bugfix related to select-criterias(filter) +# +# Revision 1.47 2004/08/31 14:26:08 jonen +# updated +# +# Revision 1.46 2004/05/06 12:54:34 jonen +# + bugfix related to multiple select-'filter' +# # Revision 1.45 2003/12/14 01:48:36 jonen # small HACK at _insertChildNode: some special Childnodes should not be created because existing objects have to be selected! # TODO: make this more generic, e.g. implement a special flag at Schema @@ -529,7 +541,7 @@ my @results; $logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $in->{nodename} . "' )" ); - #print Dumper($filters); + #print "Filter_payload: " . Dumper($in->{filters}) . "\n"; # 1. "Remote Object Handle" - get set of objects from odbms by object name my $remote = $self->{_COREHANDLE}->remote($in->{nodename}); @@ -585,7 +597,7 @@ $orm_filter_tmp = $left->$op($right); } - if (not $orm_filter) { + if (!ref($orm_filter)) { $orm_filter = $orm_filter_tmp; } else { $orm_filter = $orm_filter->and($orm_filter_tmp); @@ -594,6 +606,9 @@ } $orm_query->{filter} = $orm_filter; + + # debug point: + #print "Filter: " . Dumper($orm_query->{filter}) . "\n"; # was: @@ -715,13 +730,20 @@ } elsif (my $guid = $query->{options}->{GUID}) { $type = 'TRANSPARENT'; - $query->{criterias} = [ { key => 'guid', op => 'eq', val => $guid } ]; - + if(ref($query->{criterias}) eq 'ARRAY') { + push @{$query->{criterias}}, { key => 'guid', op => 'eq', val => $guid }; + } else { + $query->{criterias} = [ { key => 'guid', op => 'eq', val => $guid } ]; + } + } # if operator is different (dispatcher for 'getListFiltered') - } elsif (my $op = $query->{options}->{op}) { + if (my $op = $query->{options}->{op}) { $type = 'TRANSPARENT'; - $query->{criterias} = [ { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} } ]; - + if(ref($query->{criterias}) eq 'ARRAY') { + push @{$query->{criterias}}, { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} }; + } else { + $query->{criterias} = [ { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} } ]; + } } # HACK: special case: querying by id does not translate into a common tangram query @@ -835,14 +857,15 @@ my $object = $cursor->getNextEntry(); $self->erase($object); + $self->unload($object); } elsif ($crud eq 'CREATE') { my $nodename = $query->{node}; my $newnode = $self->createNode($nodename); my $id = $self->{_COREHANDLE}->insert($newnode); - - print "Saved new node $nodename with GUID $newnode->{guid}, OID '$id': " . Dumper($newnode) . "\n"; + + $logger->info( __PACKAGE__ . "->sendQuery: Saved new node $nodename with GUID $newnode->{guid}, OID '$id'."); return $newnode; @@ -1029,7 +1052,7 @@ # because they maybe exists and should only be SETTED not CREATED! # TODO: Create a flag at the scheme for that reason! # (e.g child_node => 1 for child-nodes only like e.g. UserData) - if($attr_options->{$_}->{class} eq 'NetPerson' || $attr_options->{$_}->{class} eq 'Event') { + if($attr_options->{$_}->{class} eq 'NetPerson' || $attr_options->{$_}->{class} eq 'Event' || $attr_options->{$_}->{class} eq 'BetRule') { #$obj->{$_} = undef(); } else { $obj->{$_} = $self->createNode($attr_options->{$_}->{class});