[Jifty-commit] jifty-dbi branch, master, updated. 0.66-1-gc214967

Jifty commits jifty-commit at lists.jifty.org
Thu Feb 17 13:51:29 EST 2011


The branch, master has been updated
       via  c214967784aae148a6b3a3b5f1e4b804dad24673 (commit)
      from  8836d89fc13c95efe7addb6c0eecf0feee7ec621 (commit)

Summary of changes:
 lib/Jifty/DBI/Collection.pm |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit c214967784aae148a6b3a3b5f1e4b804dad24673
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Feb 17 11:04:59 2011 -0500

    Make ->distinct_column_values use ->simple_query, thus going through our SQL logging infrastructure, etc

diff --git a/lib/Jifty/DBI/Collection.pm b/lib/Jifty/DBI/Collection.pm
index 6f71ed9..d6a8f28 100755
--- a/lib/Jifty/DBI/Collection.pm
+++ b/lib/Jifty/DBI/Collection.pm
@@ -972,9 +972,16 @@ sub distinct_column_values {
             .' '. ($args{'sort'} =~ /^des/i ? 'DESC' : 'ASC');
     }
 
-    my $dbh = $self->_handle->dbh;
-    my $list = $dbh->selectcol_arrayref( $query_string, { MaxRows => $args{'max'} } );
-    return $list? @$list : ();
+    my $sth  = $self->_handle->simple_query( $query_string ) or return;
+    my $value;
+    $sth->bind_col(1, \$value) or return;
+    my @col;
+    if ($args{max}) {
+        push @col, $value while 0 < $args{max}-- && $sth->fetch;
+    } else {
+        push @col, $value while $sth->fetch;
+    }
+    return @col;
 }
 
 =head2 items_array_ref

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list