[Jifty-commit] r2384 - in Jifty-DBI/trunk: lib/Jifty/DBI

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Dec 13 02:59:41 EST 2006


Author: agentz
Date: Wed Dec 13 02:59:41 2006
New Revision: 2384

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
   Jifty-DBI/trunk/t/13collection.t

Log:
[lib/Jifty/DBI/Collection.pm]
- made _order_clause more flexible by dealing with
  empty aliases
[t/13collection.t]
- added one test for it.

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm	Wed Dec 13 02:59:41 2006
@@ -1233,12 +1233,12 @@
             $clause .= $rowhash{'function'} . ' ';
             $clause .= $rowhash{'order'};
 
-        } elsif ( ( $rowhash{'alias'} )
+        } elsif ( (defined $rowhash{'alias'} )
             and ( $rowhash{'column'} ) )
         {
 
             $clause .= ( $clause ? ", " : " " );
-            $clause .= $rowhash{'alias'} . ".";
+            $clause .= $rowhash{'alias'} . "." if $rowhash{'alias'};
             $clause .= $rowhash{'column'} . " ";
             $clause .= $rowhash{'order'};
         }

Modified: Jifty-DBI/trunk/t/13collection.t
==============================================================================
--- Jifty-DBI/trunk/t/13collection.t	(original)
+++ Jifty-DBI/trunk/t/13collection.t	Wed Dec 13 02:59:41 2006
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 my $package;
 BEGIN { 
@@ -82,6 +82,6 @@
     ],
 }, $package;
 
-#is $obj->_order_clause,
-#   ' ORDER BY name ASC, sent ASC, ab.msg_session ASC ',
-#   'asc works';
+is $obj->_order_clause,
+   ' ORDER BY name ASC, sent ASC, ab.msg_session ASC ',
+   'asc works';


More information about the Jifty-commit mailing list