/[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.4 - (show annotations)
Thu Mar 27 15:31:15 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.3: +5 -2 lines
fixes to modules regarding new namespace(s) below Data::Mungle::*

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

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