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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Fri Jan 31 06:34:49 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.2: +9 -2 lines
+ fixes to 'getNextEntry' and 'getStatus'

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

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