[Bps-public-commit] dbix-searchbuilder branch, distinct-in-join, created. 1.61-8-g47d75fb

? sunnavy sunnavy at bestpractical.com
Tue Sep 4 08:33:10 EDT 2012


The branch, distinct-in-join has been created
        at  47d75fb2eff108dd31a9fb7438215235130e26e6 (commit)

- Log -----------------------------------------------------------------
commit 47d75fb2eff108dd31a9fb7438215235130e26e6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 4 20:30:56 2012 +0800

    add distinct_in_join flag to avoid DISTINCT in sql

diff --git a/lib/DBIx/SearchBuilder.pm b/lib/DBIx/SearchBuilder.pm
index 538a787..bed0c59 100755
--- a/lib/DBIx/SearchBuilder.pm
+++ b/lib/DBIx/SearchBuilder.pm
@@ -134,6 +134,7 @@ sub CleanSlate {
     $self->{'first_row'}        = 0;
     $self->{'must_redo_search'} = 1;
     $self->{'show_rows'}        = 0;
+    $self->{'distinct_in_join'} = 1;
     @{ $self->{'aliases'} } = ();
 
     delete $self->{$_} for qw(
@@ -437,7 +438,7 @@ sub BuildSelectQuery {
         $QueryString .= $clause;
         $QueryString .= $self->_OrderClause;
     }
-    elsif ($self->_isJoined) {
+    elsif ($self->_isJoined && $self->{'distinct_in_join'}) {
         $self->_DistinctQuery(\$QueryString);
     }
     else {

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



More information about the Bps-public-commit mailing list