/[wait]/trunk/lib/WAIT/Query/Base.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WAIT/Query/Base.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/CPAN/lib/WAIT/Query/Base.pm revision 11 by unknown, Fri Apr 28 15:41:10 2000 UTC trunk/lib/WAIT/Query/Base.pm revision 108 by dpavlin, Tue Jul 13 17:41:12 2004 UTC
# Line 1  Line 1 
1  #                              -*- Mode: Perl -*-  #                              -*- Mode: Cperl -*-
2  # Query.pm --  # Query.pm --
3  # ITIID           : $ITI$ $Header $__Header$  # ITIID           : $ITI$ $Header $__Header$
4  # Author          : Ulrich Pfeifer  # Author          : Ulrich Pfeifer
5  # Created On      : Fri Sep 13 13:05:52 1996  # Created On      : Fri Sep 13 13:05:52 1996
6  # Last Modified By: Ulrich Pfeifer  # Last Modified By: Ulrich Pfeifer
7  # Last Modified On: Sun Nov 22 18:44:40 1998  # Last Modified On: Fri Apr 14 16:27:01 2000
8  # Language        : CPerl  # Language        : CPerl
9  # Update Count    : 55  # Update Count    : 57
10  # Status          : Unknown, Use with caution!  # Status          : Unknown, Use with caution!
11  #  #
12  # Copyright (c) 1996-1997, Ulrich Pfeifer  # Copyright (c) 1996-1997, Ulrich Pfeifer
13  #  #
14    
15  package WAIT::Query::Base;  package WAIT::Query::Base;
16    
# Line 18  sub new { Line 18  sub new {
18    my $type  = shift;    my $type  = shift;
19    my $table = shift;    my $table = shift;
20    my $self  = {Table => $table};    my $self  = {Table => $table};
21      
22    bless $self, ref($type) || $type;    bless $self, ref($type) || $type;
23    if (@_) {    if (@_) {
24      $self->add(@_);      $self->add(@_);
# Line 72  sub clone { Line 72  sub clone {
72    my $self = shift;    my $self = shift;
73    my %copy;    my %copy;
74    my $fld;    my $fld;
75      
76    for $fld (keys %{$self->{Plain}}) {    for $fld (keys %{$self->{Plain}}) {
77      $copy{Plain}->{$fld} = $self->{Plain}->{$fld};      $copy{Plain}->{$fld} = $self->{Plain}->{$fld};
78    }    }
# Line 89  sub execute { Line 89  sub execute {
89    my $tb   = $self->{Table};    my $tb   = $self->{Table};
90    my %result;    my %result;
91    my $fld;    my $fld;
92      
93    for $fld (keys %{$self->{Plain}}, keys %{$self->{Raw}}) {    for $fld (keys %{$self->{Plain}}, keys %{$self->{Raw}}) {
94      %r = $tb->search($fld,      $r = $tb->search_ref(
95                       $self->{Plain}->{$fld},                       { attr => $fld,
96                       $self->{Raw}->{$fld},                         cont => $self->{Plain}->{$fld},
97                           raw  => $self->{Raw}->{$fld},
98                           @_
99                         }
100                      );                      );
101        # warn sprintf("DEBUG: attr[%s]cont[%s]raw[%s]scalar keys %%r[%d]",
102        #             $fld,
103        #             $self->{Plain}->{$fld},
104        #             $self->{Raw}->{$fld},
105        #             scalar keys %r
106        #            );
107      my ($key, $val);      my ($key, $val);
108      while (($key, $val) = each %r) {      while (($key, $val) = each %$r) {
109        if (exists $result{$key}) {        if (exists $result{$key}) {
110          $result{$key} += $val;          $result{$key} += $val;
111        } else {        } else {

Legend:
Removed from v.11  
changed lines
  Added in v.108

  ViewVC Help
Powered by ViewVC 1.1.26