| 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 |
# |
# |
| 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; |
| 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(); |
| 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 ); |
| 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) { |
| 636 |
} |
} |
| 637 |
@results = @filtered; |
@results = @filtered; |
| 638 |
} |
} |
|
=cut |
|
| 639 |
|
|
| 640 |
#print "results: " . Dumper(\@results); |
#print "results: " . Dumper(\@results); |
| 641 |
|
|