/[cvs]/nfo/perl/libs/Data/Storage/Result/Tangram.pm
ViewVC logotype

Contents of /nfo/perl/libs/Data/Storage/Result/Tangram.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Wed Apr 9 07:11:01 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.5: +7 -1 lines
minor fix

1 ############################################
2 #
3 # $Id: Tangram.pm,v 1.5 2003/04/09 02:09:47 joko Exp $
4 #
5 # $Log: Tangram.pm,v $
6 # Revision 1.5 2003/04/09 02:09:47 joko
7 # bugfix: check for existance of '->close'-method before calling it on the 'RESULTHANDLE'-instance
8 #
9 # Revision 1.4 2003/03/27 15:31:15 joko
10 # fixes to modules regarding new namespace(s) below Data::Mungle::*
11 #
12 # Revision 1.3 2003/01/31 06:34:49 joko
13 # + fixes to 'getNextEntry' and 'getStatus'
14 #
15 # Revision 1.2 2002/12/05 08:01:26 joko
16 # + sub getStatus utilizing isEmpty to determine if result is set/unset and/or filled/unfilled
17 #
18 # Revision 1.1 2002/11/29 04:55:45 joko
19 # + initial check-in
20 #
21 #
22 ############################################
23
24
25 package Data::Storage::Result::Tangram;
26
27 use strict;
28 use warnings;
29
30 use base ("Data::Storage::Result::Abstract");
31 use Data::Dumper;
32 use Data::Mungle::Compare::Struct qw( isEmpty );
33
34 sub DESTROY {
35 my $self = shift;
36 #$logger->debug( __PACKAGE__ . "->" . "DESTROY" );
37 $self->{RESULTHANDLE} && $self->{RESULTHANDLE}->can('close') && $self->{RESULTHANDLE}->close();
38 }
39
40 sub getNextEntry {
41 my $self = shift;
42
43 return if !$self->{RESULTHANDLE};
44 $self->{resulthandle_type} = ref($self->{RESULTHANDLE}) if !$self->{resulthandle_type};
45
46 # is result already opened?
47 if ($self->{open}) {
48 $self->{entry_count}++;
49 return $self->{RESULTHANDLE}->next()
50 if $self->{resulthandle_type} eq 'Tangram::Cursor';
51 return $self->{members}->[$self->{entry_count}]
52 if $self->{resulthandle_type} eq 'Set::Object';
53
54 # open result!
55 } else {
56 $self->{entry_count} = 0;
57 $self->{open} = 1;
58
59 return $self->{RESULTHANDLE}->execute()
60 if $self->{resulthandle_type} eq 'Tangram::Cursor';
61 #print Dumper($self->{RESULTHANDLE}->members()); exit;
62 if ($self->{resulthandle_type} eq 'Set::Object') {
63 my @members = $self->{RESULTHANDLE}->members();
64 $self->{members} = \@members;
65 return $self->{members}->[$self->{entry_count}];
66 }
67 }
68 }
69
70 sub getStatus {
71 my $self = shift;
72 my $status;
73
74 $self->{resulthandle_type} ||= '';
75
76 if ($self->{resulthandle_type} eq 'Tangram::Cursor') {
77 =pod
78 print Dumper($self->{RESULTHANDLE});
79 $status = {
80 err => $self->{RESULTHANDLE}->err,
81 errstr => $self->{RESULTHANDLE}->errstr,
82 state => $self->{RESULTHANDLE}->state,
83 };
84 =cut
85 }
86 if ($self->{resulthandle_type} eq 'Set::Object') {
87 #print Dumper($self->{RESULTHANDLE}->members());
88 $status = {
89 empty => isEmpty($self->{RESULTHANDLE}),
90 },
91 }
92 return $status;
93 }
94
95
96 1;

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