[Jifty-commit] r5687 - Jifty-DBI/branches/tisql/lib/Jifty/DBI

Jifty commits jifty-commit at lists.jifty.org
Tue Aug 12 02:50:51 EDT 2008


Author: ruz
Date: Tue Aug 12 02:50:51 2008
New Revision: 5687

Modified:
   Jifty-DBI/branches/tisql/lib/Jifty/DBI/Tisql.pm

Log:
* change API of apply_query_tree
* use tisql subclause everywhere
* use $join argument of open_paren/close_paren

Modified: Jifty-DBI/branches/tisql/lib/Jifty/DBI/Tisql.pm
==============================================================================
--- Jifty-DBI/branches/tisql/lib/Jifty/DBI/Tisql.pm	(original)
+++ Jifty-DBI/branches/tisql/lib/Jifty/DBI/Tisql.pm	Tue Aug 12 02:50:51 2008
@@ -82,21 +82,19 @@
 }
 
 sub apply_query_tree {
-    my $self = shift;
-    my $tree = shift;
-    my $current = shift || $tree->{'conditions'};
-    my $ea = shift || 'AND';
+    my ($self, $current, $join, $ea) = @_;
+    $ea ||= 'AND';
 
     my $collection = $self->{'collection'};
 
-    $collection->open_paren('tisql');
+    $collection->open_paren('tisql', $join);
     foreach my $element ( @$current ) {
         unless ( ref $element ) {
             $ea = $element;
             next;
         }
         elsif ( ref $element eq 'ARRAY' ) {
-            $self->apply_query_tree( $tree, $element, $ea );
+            $self->apply_query_tree( $element, $join, $ea );
             next;
         }
         elsif ( ref $element ne 'HASH' ) {
@@ -105,6 +103,7 @@
 
         my %limit = (
             subclause        => 'tisql',
+            leftjoin         => $join,
             entry_aggregator => $ea,
             operator         => $element->{'op'},
         );
@@ -125,7 +124,7 @@
 
         $collection->limit( %limit );
     }
-    $collection->close_paren('tisql');
+    $collection->close_paren('tisql', $join);
 }
 
 sub resolve_join {
@@ -168,6 +167,7 @@
             my $item = $classname->new( handle => $collection->_handle );
             my $right_alias = $collection->new_alias( $item );
             $collection->join(
+                subclause => 'tisql',
                 type    => 'left',
                 alias1  => $last_alias,
                 column1 => $name,


More information about the Jifty-commit mailing list