[siesta-commit] siesta/lib/Siesta/Storage DBI.pm,1.12,1.13

[prev] [thread] [next] [lurker] [Date index for 2002/09/08]

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta/Storage DBI.pm,1.12,1.13
Date: 15:20 on 08 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta/Storage
In directory usw-pr-cvs1:/tmp/cvs-serv4909

Modified Files:
	DBI.pm 
Log Message:
simplify the where thing away


Index: DBI.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Storage/DBI.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- DBI.pm	8 Sep 2002 14:13:36 -0000	1.12
+++ DBI.pm	8 Sep 2002 14:20:08 -0000	1.13
@@ -19,18 +19,17 @@
 sub _get_rows {
     my $self = shift;
     my %args = @_;
-    my %where   = %{ $args{where} };
+    my %where   = %{ $args{where}  || {} };
     my @columns = @{ $args{columns} };
 
-    my $sql = join ('', 
+    my $sql = join ('',
                     "SELECT ", join(', ', @columns), " FROM ", $args{table},
                    );
 
-    $sql = join ('', $sql, 
-                        " WHERE ", join(' AND ', 
-                                    map { "$_ = '$where{$_}'" } keys %where)
-                ) if %where;
-
+    $sql .= join ('',
+                  " WHERE ", join(' AND ', 
+                                  map { "$_ = '$where{$_}'" } keys %where)
+                 ) if %where;
 
     return map {
         my %foo;
@@ -45,16 +44,14 @@
 
     return map { Siesta::List->new_from_hash($_) } 
       $self->_get_rows(table   => 'lists',
-                       where   => {},
                        columns => \@Siesta::List::fields);
 }
 
 sub get_users {
     my $self = shift;
-        
+
     return map { Siesta::User->new_from_hash($_) }
       $self->_get_rows(table   => 'users',
-                       where   => {},
                        columns => \@Siesta::User::fields);
 }
 



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52