/[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.4 - (hide 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 joko 1.1 ############################################
2     #
3 joko 1.4 # $Id: Tangram.pm,v 1.3 2003/01/31 06:34:49 joko Exp $
4 joko 1.2 #
5     # $Log: Tangram.pm,v $
6 joko 1.4 # Revision 1.3 2003/01/31 06:34:49 joko
7     # + fixes to 'getNextEntry' and 'getStatus'
8     #
9 joko 1.3 # 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 joko 1.2 # Revision 1.1 2002/11/29 04:55:45 joko
13     # + initial check-in
14 joko 1.1 #
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 joko 1.4 use Data::Mungle::Compare::Struct qw( isEmpty );
27 joko 1.1
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 joko 1.2 # open result!
49 joko 1.1 } else {
50     $self->{entry_count} = 0;
51 joko 1.3 $self->{open} = 1;
52    
53 joko 1.1 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 joko 1.2 }
62     }
63    
64     sub getStatus {
65     my $self = shift;
66     my $status;
67     if ($self->{resulthandle_type} eq 'Tangram::Cursor') {
68 joko 1.3 =pod
69     print Dumper($self->{RESULTHANDLE});
70 joko 1.2 $status = {
71     err => $self->{RESULTHANDLE}->err,
72     errstr => $self->{RESULTHANDLE}->errstr,
73     state => $self->{RESULTHANDLE}->state,
74     };
75 joko 1.3 =cut
76 joko 1.2 }
77     if ($self->{resulthandle_type} eq 'Set::Object') {
78     #print Dumper($self->{RESULTHANDLE}->members());
79     $status = {
80     empty => isEmpty($self->{RESULTHANDLE}),
81     },
82 joko 1.1 }
83 joko 1.2 return $status;
84 joko 1.1 }
85    
86    
87     1;

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