Author: spadkins
Date: Tue Aug  7 12:09:18 2007
New Revision: 9824

Modified:
   p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm

Log:
use App::Repository::DBI::_do instead of DBI methods

Modified: p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/ValueDomain/Repository.pm Tue Aug  7 
12:09:18 2007
@@ -177,26 +177,10 @@
         if ($sql) {
             $sql = $self->substitute($sql, undef, {undef_value => "NULL"});
 
-            # TODO. I might want to use $db->_do($sql) here.
-            my $dbh = $rep->{dbh};
-            my $sth = $dbh->prepare($sql);
-            return("Prepare error: $DBI::errstr\n") if ($DBI::err);
-            
-            my $rc =  $sth->execute;
-            return("Execute error: $DBI::errstr\n") if ($DBI::err);
-
-            while (1) {
-                my @row = $sth->fetchrow;
-                return("Fetch error: $DBI::errstr\n") if ($DBI::err);
-                if ($#row < 0) {
-                   $sth->finish;
-                   return("Finish error: $DBI::errstr\n") if ($DBI::err);
-                   last;
-                }
-                my ($val, $lbl) = @row;
-                
-                push(@$values, $val);
-                $labels->{$val} = $lbl;
+            my $rows = $rep->_do($sql);
+            foreach my $row (@$rows) {
+                push(@$values, $row->[0]);
+                $labels->{$row->[0]} = $row->[1];
             }
 
             $self->{values} = $values;

Reply via email to