3 |
# $Id$ |
# $Id$ |
4 |
# |
# |
5 |
# $Log$ |
# $Log$ |
6 |
|
# Revision 1.11 2002/12/04 08:54:08 jonen |
7 |
|
# + untested bugfix: undef($object) after transform to hash at getObjectAsHash |
8 |
|
# |
9 |
|
# Revision 1.10 2002/12/03 15:53:23 joko |
10 |
|
# + small bugfix regarding object hierarchy |
11 |
|
# |
12 |
|
# Revision 1.9 2002/12/03 05:29:40 joko |
13 |
|
# + sub getObject |
14 |
|
# + sub getObjectAsHash |
15 |
|
# |
16 |
# Revision 1.8 2002/12/01 22:25:51 joko |
# Revision 1.8 2002/12/01 22:25:51 joko |
17 |
# + now utilizing metadata from storage locator when connecting to DBI in "raw"-mode |
# + now utilizing metadata from storage locator when connecting to DBI in "raw"-mode |
18 |
# |
# |
66 |
use libp qw( getNewPerlObjectByPkgName ); |
use libp qw( getNewPerlObjectByPkgName ); |
67 |
use Data::Storage::Result::Tangram; |
use Data::Storage::Result::Tangram; |
68 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Compare::Struct qw( isEmpty ); |
69 |
|
use Data::Transform::Deep qw( var_deref ); |
70 |
|
use Data::Transform::Encode qw( var2utf8 ); |
71 |
|
|
72 |
|
|
73 |
# get logger instance |
# get logger instance |
74 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
459 |
sub eraseAll { |
sub eraseAll { |
460 |
my $self = shift; |
my $self = shift; |
461 |
my $classname = shift; |
my $classname = shift; |
462 |
my $remote = $self->{storage}->remote($classname); |
my $remote = $self->{COREHANDLE}->remote($classname); |
463 |
my @objs = $self->{storage}->select($remote); |
my @objs = $self->{COREHANDLE}->select($remote); |
464 |
$self->{COREHANDLE}->erase(@objs); |
$self->{COREHANDLE}->erase(@objs); |
465 |
} |
} |
466 |
|
|
470 |
return $storage->createDb(); |
return $storage->createDb(); |
471 |
} |
} |
472 |
|
|
473 |
|
sub getObject { |
474 |
|
my $self = shift; |
475 |
|
my $oid = shift; |
476 |
|
# TODO: review this |
477 |
|
#if (!$self->{COREHANDLE}) { return; } |
478 |
|
return $self->{COREHANDLE}->load($oid); |
479 |
|
} |
480 |
|
|
481 |
|
sub getObjectAsHash { |
482 |
|
my $self = shift; |
483 |
|
my $oid = shift; |
484 |
|
my $options = shift; |
485 |
|
my $obj = $self->getObject($oid); |
486 |
|
my $deref = var_deref($obj); |
487 |
|
var2utf8($deref) if ($options->{utf8}); |
488 |
|
undef($obj) if($options->{destroy}); |
489 |
|
return $deref; |
490 |
|
} |
491 |
|
|
492 |
1; |
1; |