[Rt-commit] r3995 - in Jifty-DBI/trunk: . ex/Example/Model lib/Jifty/DBI lib/Jifty/DBI/Collection lib/Jifty/DBI/Handle t

jesse at bestpractical.com jesse at bestpractical.com
Sat Oct 29 16:02:32 EDT 2005


Author: jesse
Date: Sat Oct 29 16:02:28 2005
New Revision: 3995

Added:
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection/
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Union.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm
Removed:
   Jifty-DBI/trunk/lib/Jifty/DBI/Union.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Unique.pm
Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/Changes
   Jifty-DBI/trunk/META.yml
   Jifty-DBI/trunk/Makefile.PL
   Jifty-DBI/trunk/ex/Example/Model/Address.pm
   Jifty-DBI/trunk/ex/Example/Model/Employee.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
   Jifty-DBI/trunk/t/01records.t
   Jifty-DBI/trunk/t/01searches.t
   Jifty-DBI/trunk/t/02records_object.t
   Jifty-DBI/trunk/t/06filter_datetime.t
   Jifty-DBI/trunk/t/06filter_truncate.t
   Jifty-DBI/trunk/t/06filter_utf8.t
   Jifty-DBI/trunk/t/10schema.t
   Jifty-DBI/trunk/t/11schema_records.t
   Jifty-DBI/trunk/t/utils.pl
Log:
 r18059 at truegrounds:  jesse | 2005-10-29 02:36:33 -0400
 * lowercased the collections API


Modified: Jifty-DBI/trunk/Changes
==============================================================================
--- Jifty-DBI/trunk/Changes	(original)
+++ Jifty-DBI/trunk/Changes	Sat Oct 29 16:02:28 2005
@@ -206,7 +206,7 @@
 
 1.02_03 Thu Jul 22 13:29:17 EDT 2004
         - Additional bullet proofing for joins.
-          Now we default to ALIAS1 being "main"  (cubic at acronis.ru)
+          Now we default to alias1 being "main"  (cubic at acronis.ru)
 
 1.02_02 Tue Jul 20 13:06:06 EDT 2004
         - Fixed a join bug that mostly manifests as a 'Dependency chain'

Modified: Jifty-DBI/trunk/META.yml
==============================================================================
--- Jifty-DBI/trunk/META.yml	(original)
+++ Jifty-DBI/trunk/META.yml	Sat Oct 29 16:02:28 2005
@@ -15,11 +15,6 @@
   Cache::Simple::TimedExpiry: 0.21
   DateTime: 0
   DateTime::Format::Strptime: 0
-bundles:
-  DateTime::Duration: DateTime-0.2901
-  DateTime::Locale::Base: DateTime-Locale-0.22
-  DateTime::Duration: DateTime-0.2901
-  DateTime::Locale::Base: DateTime-Locale-0.22
 no_index:
   directory:
     - inc

Modified: Jifty-DBI/trunk/Makefile.PL
==============================================================================
--- Jifty-DBI/trunk/Makefile.PL	(original)
+++ Jifty-DBI/trunk/Makefile.PL	Sat Oct 29 16:02:28 2005
@@ -22,7 +22,7 @@
 	  'Class::Accessor' => '',
 	],
 );
-auto_bundle_deps();
+#auto_bundle_deps();
 auto_install();
 &WriteAll;
 

Modified: Jifty-DBI/trunk/ex/Example/Model/Address.pm
==============================================================================
--- Jifty-DBI/trunk/ex/Example/Model/Address.pm	(original)
+++ Jifty-DBI/trunk/ex/Example/Model/Address.pm	Sat Oct 29 16:02:28 2005
@@ -10,8 +10,8 @@
 
 sub Schema {
     return {
-        Name => { TYPE => 'varchar', },
-        Phone => { TYPE => 'varchar', },
+        Name => { type => 'varchar', },
+        Phone => { type => 'varchar', },
         EmployeeId => { REFERENCES => 'Example::Model::Employee', },
     }
 }

Modified: Jifty-DBI/trunk/ex/Example/Model/Employee.pm
==============================================================================
--- Jifty-DBI/trunk/ex/Example/Model/Employee.pm	(original)
+++ Jifty-DBI/trunk/ex/Example/Model/Employee.pm	Sat Oct 29 16:02:28 2005
@@ -6,8 +6,8 @@
 
 sub Schema {
     return {
-      Name => { TYPE => 'varchar', },
-      Dexterity => { TYPE => 'integer', },
+      Name => { type => 'varchar', },
+      Dexterity => { type => 'integer', },
     }
 }
 

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	Sat Oct 29 16:02:28 2005
@@ -17,12 +17,6 @@
   package My::Things;
   use base qw/Jifty::DBI::Collection/;
   
-  sub _init {
-      my $self = shift;
-      return $self->SUPER::_init(@_);
-  }
-  
-  
   package main;
 
   use Jifty::DBI::Handle;
@@ -31,7 +25,7 @@
 
   my $sb = My::Things->new( handle => $handle );
 
-  $sb->limit( FIELD => "column_1", VALUE => "matchstring" );
+  $sb->limit( field => "column_1", value => "matchstring" );
 
   while ( my $record = $sb->next ) {
       print $record->my_column_name();
@@ -128,7 +122,7 @@
 
     delete $self->{$_} for qw(
         items
-        left_joins
+        leftjoins
         raw_rows
         count_all
         subclauses
@@ -302,7 +296,7 @@
 
 sub _is_joined {
     my $self = shift;
-    if ( keys( %{ $self->{'left_joins'} } ) ) {
+    if ( keys( %{ $self->{'leftjoins'} } ) ) {
         return (1);
     } else {
         return ( @{ $self->{'aliases'} } );
@@ -575,18 +569,18 @@
 
 =over 4
 
-=item TABLE 
+=item table 
 
 Can be set to something different than this table if a join is
 wanted (that means we can't do recursive joins as for now).  
 
-=item ALIAS
+=item alias
 
-Unless ALIAS is set, the join criterias will be taken from EXT_LINKFIELD
-and INT_LINKFIELD and added to the criterias.  If ALIAS is set, new
+Unless alias is set, the join criterias will be taken from EXT_LINKcolumn
+and INT_LINKcolumn and added to the criterias.  If alias is set, new
 criterias about the foreign table will be added.
 
-=item FIELD
+=item column
 
 Column to be checked against.
 
@@ -594,9 +588,9 @@
 
 Should always be set and will always be quoted. 
 
-=item OPERATOR
+=item operator
 
-OPERATOR is the SQL operator to use for this phrase.  Possible choices include:
+operator is the SQL operator to use for this phrase.  Possible choices include:
 
 =over 4
 
@@ -620,13 +614,13 @@
 
 =back
 
-=item ENTRYAGGREGATOR 
+=item entry_aggregator 
 
 Can be AND or OR (or anything else valid to aggregate two clauses in SQL)
 
-=item CASESENSITIVE
+=item case_sensitive
 
-on some databases, such as postgres, setting CASESENSITIVE to 1 will make
+on some databases, such as postgres, setting case_sensitive to 1 will make
 this search case sensitive
 
 =back
@@ -636,16 +630,16 @@
 sub limit {
     my $self = shift;
     my %args = (
-        TABLE           => $self->table,
-        FIELD           => undef,
-        VALUE           => undef,
-        ALIAS           => undef,
-        QUOTEVALUE      => 1,
-        ENTRYAGGREGATOR => 'or',
-        CASESENSITIVE   => undef,
-        OPERATOR        => '=',
-        SUBCLAUSE       => undef,
-        LEFTJOIN        => undef,
+        table           => $self->table,
+        column           => undef,
+        value           => undef,
+        alias           => undef,
+        quote_value      => 1,
+        entry_aggregator => 'or',
+        case_sensitive   => undef,
+        operator        => '=',
+        subclause       => undef,
+        leftjoin        => undef,
         @_    # get the real argumentlist
     );
 
@@ -654,37 +648,40 @@
     #since we're changing the search criteria, we need to redo the search
     $self->redo_search();
 
-    if ( $args{'FIELD'} ) {
+    if ( $args{'column'} ) {
 
         #If it's a like, we supply the %s around the search term
-        if ( $args{'OPERATOR'} =~ /LIKE/i ) {
-            $args{'VALUE'} = "%" . $args{'VALUE'} . "%";
-        } elsif ( $args{'OPERATOR'} =~ /STARTSWITH/i ) {
-            $args{'VALUE'}    = $args{'VALUE'} . "%";
-            $args{'OPERATOR'} = "LIKE";
-        } elsif ( $args{'OPERATOR'} =~ /ENDSWITH/i ) {
-            $args{'VALUE'}    = "%" . $args{'VALUE'};
-            $args{'OPERATOR'} = "LIKE";
+        if ( $args{'operator'} =~ /LIKE/i ) {
+            $args{'value'} =  $args{'value'} ;
+        } elsif ( $args{'operator'} =~ /MATCHES/i ) {
+            $args{'value'}    = "%".$args{'value'} . "%";
+            $args{'operator'} = "LIKE";
+        } elsif ( $args{'operator'} =~ /STARTSWITH/i ) {
+            $args{'value'}    = $args{'value'} . "%";
+            $args{'operator'} = "LIKE";
+        } elsif ( $args{'operator'} =~ /ENDSWITH/i ) {
+            $args{'value'}    = "%" . $args{'value'};
+            $args{'operator'} = "LIKE";
         }
 
         #if we're explicitly told not to to quote the value or
         # we're doing an IS or IS NOT (null), don't quote the operator.
 
-        if ( $args{'QUOTEVALUE'} && $args{'OPERATOR'} !~ /IS/i ) {
-            my $tmp = $self->_handle->dbh->quote( $args{'VALUE'} );
+        if ( $args{'quote_value'} && $args{'operator'} !~ /IS/i ) {
+            my $tmp = $self->_handle->dbh->quote( $args{'value'} );
 
             # Accomodate DBI drivers that don't understand UTF8
             if ( $] >= 5.007 ) {
                 require Encode;
-                if ( Encode::is_utf8( $args{'VALUE'} ) ) {
+                if ( Encode::is_utf8( $args{'value'} ) ) {
                     Encode::_utf8_on($tmp);
                 }
             }
-            $args{'VALUE'} = $tmp;
+            $args{'value'} = $tmp;
         }
     }
 
-    $Alias = $self->_generic_restriction(%args);
+    $Alias = $self->_compile_phrase(%args);
 
     warn "No table alias set!"
         unless $Alias;
@@ -700,54 +697,54 @@
     }
 }
 
-sub _generic_restriction {
+sub _compile_phrase {
     my $self = shift;
     my %args = (
-        TABLE           => $self->table,
-        FIELD           => undef,
-        VALUE           => undef,
-        ALIAS           => undef,
-        LEFTJOIN        => undef,
-        ENTRYAGGREGATOR => undef,
-        OPERATOR        => '=',
-        SUBCLAUSE       => undef,
-        CASESENSITIVE   => undef,
-        QUOTEVALUE      => undef,
+        table           => $self->table,
+        column           => undef,
+        value           => undef,
+        alias           => undef,
+        leftjoin        => undef,
+        entry_aggregator => undef,
+        operator        => '=',
+        subclause       => undef,
+        case_sensitive   => undef,
+        quote_value      => undef,
         @_
     );
 
     my ( $Clause, $QualifiedField );
 
-    #TODO: $args{'VALUE'} should take an array of values and generate
+    #TODO: $args{'value'} should take an array of values and generate
     # the proper where clause.
 
     #If we're performing a left join, we really want the alias to be the
     #left join criterion.
 
-    if (   ( defined $args{'LEFTJOIN'} )
-        && ( !defined $args{'ALIAS'} ) )
+    if (   ( defined $args{'leftjoin'} )
+        && ( !defined $args{'alias'} ) )
     {
-        $args{'ALIAS'} = $args{'LEFTJOIN'};
+        $args{'alias'} = $args{'leftjoin'};
     }
 
     # {{{ if there's no alias set, we need to set it
 
-    unless ( $args{'ALIAS'} ) {
+    unless ( $args{'alias'} ) {
 
         #if the table we're looking at is the same as the main table
-        if ( $args{'TABLE'} eq $self->table ) {
+        if ( $args{'table'} eq $self->table ) {
 
             # TODO this code assumes no self joins on that table.
             # if someone can name a case where we'd want to do that,
             # I'll change it.
 
-            $args{'ALIAS'} = 'main';
+            $args{'alias'} = 'main';
         }
 
         # {{{ if we're joining, we need to work out the table alias
 
         else {
-            $args{'ALIAS'} = $self->new_alias( $args{'TABLE'} );
+            $args{'alias'} = $self->new_alias( $args{'table'} );
         }
 
         # }}}
@@ -758,10 +755,10 @@
     # Set this to the name of the field and the alias, unless we've been
     # handed a subclause name
 
-    $QualifiedField = $args{'ALIAS'} . "." . $args{'FIELD'};
+    $QualifiedField = $args{'alias'} . "." . $args{'column'};
 
-    if ( $args{'SUBCLAUSE'} ) {
-        $Clause = $args{'SUBCLAUSE'};
+    if ( $args{'subclause'} ) {
+        $Clause = $args{'subclause'};
     } else {
         $Clause = $QualifiedField;
     }
@@ -775,8 +772,8 @@
     # If we're trying to get a leftjoin restriction, lets set
     # $restriction to point htere. otherwise, lets construct normally
 
-    if ( $args{'LEFTJOIN'} ) {
-        $restriction = \$self->{'left_joins'}{ $args{'LEFTJOIN'} }{'criteria'}
+    if ( $args{'leftjoin'} ) {
+        $restriction = \$self->{'leftjoins'}{ $args{'leftjoin'} }{'criteria'}
             {"$Clause"};
     } else {
         $restriction = \$self->{'restrictions'}{"$Clause"};
@@ -785,21 +782,21 @@
     # If it's a new value or we're overwriting this sort of restriction,
 
     if (   $self->_handle->case_sensitive
-        && defined $args{'VALUE'}
-        && $args{'VALUE'} ne ''
-        && $args{'VALUE'} ne "''"
-        && ( $args{'OPERATOR'} !~ /IS/ && $args{'VALUE'} !~ /^null$/i ) )
+        && defined $args{'value'}
+        && $args{'value'} ne ''
+        && $args{'value'} ne "''"
+        && ( $args{'operator'} !~ /IS/ && $args{'value'} !~ /^null$/i ) )
     {
 
-        unless ( $args{'CASESENSITIVE'} || !$args{'QUOTEVALUE'} ) {
-            ( $QualifiedField, $args{'OPERATOR'}, $args{'VALUE'} )
+        unless ( $args{'case_sensitive'} || !$args{'quote_value'} ) {
+            ( $QualifiedField, $args{'operator'}, $args{'value'} )
                 = $self->_handle->_make_clause_case_insensitive(
-                $QualifiedField, $args{'OPERATOR'}, $args{'VALUE'} );
+                $QualifiedField, $args{'operator'}, $args{'value'} );
         }
 
     }
 
-    my $clause = "($QualifiedField $args{'OPERATOR'} $args{'VALUE'})";
+    my $clause = "($QualifiedField $args{'operator'} $args{'value'})";
 
     # Juju because this should come _AFTER_ the EA
     my $prefix = "";
@@ -808,8 +805,8 @@
         delete $self->{_open_parens}{$Clause};
     }
 
-    if ((       ( exists $args{'ENTRYAGGREGATOR'} )
-            and ( $args{'ENTRYAGGREGATOR'} || "" ) eq 'none'
+    if ((       ( exists $args{'entry_aggregator'} )
+            and ( $args{'entry_aggregator'} || "" ) eq 'none'
         )
         or ( !$$restriction )
         )
@@ -818,10 +815,10 @@
         $$restriction = $prefix . $clause;
 
     } else {
-        $$restriction .= $args{'ENTRYAGGREGATOR'} . $prefix . $clause;
+        $$restriction .= $args{'entry_aggregator'} . $prefix . $clause;
     }
 
-    return ( $args{'ALIAS'} );
+    return ( $args{'alias'} );
 
 }
 
@@ -841,7 +838,7 @@
     }
 }
 
-sub _add_sub_clause {
+sub _add_subclause {
     my $self      = shift;
     my $clauseid  = shift;
     my $subclause = shift;
@@ -900,12 +897,12 @@
 
 =head2 order_by PARAMHASH
 
-Orders the returned results by ALIAS.FIELD ORDER. (by default 'main.id ASC')
+Orders the returned results by alias.column order. (by default 'main.id ASC')
 
-Takes a paramhash of ALIAS, FIELD and ORDER.  
-ALIAS defaults to main
-FIELD defaults to the primary key of the main table.  Also accepts C<FUNCTION(FIELD)> format
-ORDER defaults to ASC(ending).  DESC(ending) is also a valid value for order_by
+Takes a paramhash of alias, column and order.  
+alias defaults to main
+C<column> defaults to the primary key of the main table.  Also accepts C<function(column)> format
+order defaults to ASC(ending).  DESC(ending) is also a valid value for order_by
 
 
 =cut
@@ -933,33 +930,33 @@
     foreach $row (@args) {
 
         my %rowhash = (
-            ALIAS => 'main',
-            FIELD => undef,
-            ORDER => 'ASC',
+            alias => 'main',
+            column => undef,
+            order => 'ASC',
             %$row
         );
-        if ( $rowhash{'ORDER'} =~ /^des/i ) {
-            $rowhash{'ORDER'} = "DESC";
+        if ( $rowhash{'order'} =~ /^des/i ) {
+            $rowhash{'order'} = "DESC";
         } else {
-            $rowhash{'ORDER'} = "ASC";
+            $rowhash{'order'} = "ASC";
         }
 
-        if (    ( $rowhash{'ALIAS'} )
-            and ( $rowhash{'FIELD'} )
-            and ( $rowhash{'ORDER'} ) )
+        if (    ( $rowhash{'alias'} )
+            and ( $rowhash{'column'} )
+            and ( $rowhash{'order'} ) )
         {
 
-            if ( $rowhash{'FIELD'} =~ /^(\w+\()(.*\))$/ ) {
+            if ( $rowhash{'column'} =~ /^(\w+\()(.*\))$/ ) {
 
-                # handle 'FUNCTION(FIELD)' formatted fields
-                $rowhash{'ALIAS'} = $1 . $rowhash{'ALIAS'};
-                $rowhash{'FIELD'} = $2;
+                # handle 'function(column)' formatted fields
+                $rowhash{'alias'} = $1 . $rowhash{'alias'};
+                $rowhash{'column'} = $2;
             }
 
             $clause .= ( $clause ? ", " : " " );
-            $clause .= $rowhash{'ALIAS'} . ".";
-            $clause .= $rowhash{'FIELD'} . " ";
-            $clause .= $rowhash{'ORDER'};
+            $clause .= $rowhash{'alias'} . ".";
+            $clause .= $rowhash{'column'} . " ";
+            $clause .= $rowhash{'order'};
         }
     }
 
@@ -986,7 +983,7 @@
 
 =head2 group_by_cols ARRAY_OF_HASHES
 
-Each hash contains the keys ALIAS and FIELD. ALIAS defaults to 'main'
+Each hash contains the keys alias and column. alias defaults to 'main'
 if ignored.
 
 =cut
@@ -999,21 +996,21 @@
 
     foreach $row (@args) {
         my %rowhash = (
-            ALIAS => 'main',
-            FIELD => undef,
+            alias => 'main',
+            column => undef,
             %$row
         );
-        if ( $rowhash{'FUNCTION'} ) {
+        if ( $rowhash{'function'} ) {
             $clause .= ( $clause ? ", " : " " );
-            $clause .= $rowhash{'FUNCTION'};
+            $clause .= $rowhash{'function'};
 
-        } elsif ( ( $rowhash{'ALIAS'} )
-            and ( $rowhash{'FIELD'} ) )
+        } elsif ( ( $rowhash{'alias'} )
+            and ( $rowhash{'column'} ) )
         {
 
             $clause .= ( $clause ? ", " : " " );
-            $clause .= $rowhash{'ALIAS'} . ".";
-            $clause .= $rowhash{'FIELD'};
+            $clause .= $rowhash{'alias'} . ".";
+            $clause .= $rowhash{'column'};
         }
     }
 
@@ -1038,7 +1035,7 @@
     return ( $self->{'group_clause'} );
 }
 
-=head2 new_alias TABLE_OR_CLASS
+=head2 new_alias table_OR_CLASS
 
 Takes the name of a table or a Jifty::DBI::Record subclass.
 Returns the string of a new Alias for that table, which can be used 
@@ -1087,32 +1084,32 @@
 
 Join instructs Jifty::DBI::Collection to join two tables.  
 
-The standard form takes a param hash with keys ALIAS1, FIELD1, ALIAS2
-and FIELD2. ALIAS1 and ALIAS2 are column aliases obtained from
-$self->new_alias or a $self->limit. FIELD1 and FIELD2 are the fields
-in ALIAS1 and ALIAS2 that should be linked, respectively.  For this
+The standard form takes a param hash with keys alias1, column1, alias2
+and column2. alias1 and alias2 are column aliases obtained from
+$self->new_alias or a $self->limit. column1 and column2 are the fields
+in alias1 and alias2 that should be linked, respectively.  For this
 type of join, this method has no return value.
 
-Supplying the parameter TYPE => 'left' causes Join to preform a left
-join.  in this case, it takes ALIAS1, FIELD1, TABLE2 and
-FIELD2. Because of the way that left joins work, this method needs a
-TABLE for the second field rather than merely an alias.  For this type
+Supplying the parameter type => 'left' causes Join to preform a left
+join.  in this case, it takes alias1, column1, table2 and
+column2. Because of the way that left joins work, this method needs a
+table for the second field rather than merely an alias.  For this type
 of join, it will return the alias generated by the join.
 
-Instead of ALIAS1/FIELD1, it's possible to specify EXPRESSION, to join
-ALIAS2/TABLE2 on an arbitrary expression.
+Instead of alias1/column1, it's possible to specify EXPRESSION, to join
+alias2/table2 on an arbitrary expression.
 
 =cut
 
 sub join {
     my $self = shift;
     my %args = (
-        TYPE   => 'normal',
-        FIELD1 => undef,
-        ALIAS1 => 'main',
-        TABLE2 => undef,
-        FIELD2 => undef,
-        ALIAS2 => undef,
+        type   => 'normal',
+        column1 => undef,
+        alias1 => 'main',
+        table2 => undef,
+        column2 => undef,
+        alias2 => undef,
         @_
     );
 
@@ -1307,11 +1304,11 @@
     return ( $self->{'DEBUG'} );
 }
 
-=head2 column { FIELD => undef } 
+=head2 column { column => undef } 
 
-Specify that we want to load the column  FIELD. 
+Specify that we want to load the column  column. 
 
-Other parameters are TABLE ALIAS AND FUNCTION.
+Other parameters are table alias AND function.
 
 Autrijus and Ruslan owe docs.
 
@@ -1320,15 +1317,15 @@
 sub column {
     my $self = shift;
     my %args = (
-        TABLE    => undef,
-        ALIAS    => undef,
-        FIELD    => undef,
-        FUNCTION => undef,
+        table    => undef,
+        alias    => undef,
+        column    => undef,
+        function => undef,
         @_
     );
 
-    my $table = $args{TABLE} || do {
-        if ( my $alias = $args{ALIAS} ) {
+    my $table = $args{table} || do {
+        if ( my $alias = $args{alias} ) {
             $alias =~ s/_\d+$//;
             $alias;
         } else {
@@ -1336,8 +1333,8 @@
         }
     };
 
-    my $name = ( $args{ALIAS} || 'main' ) . '.' . $args{FIELD};
-    if ( my $func = $args{FUNCTION} ) {
+    my $name = ( $args{alias} || 'main' ) . '.' . $args{column};
+    if ( my $func = $args{function} ) {
         if ( $func =~ /^DISTINCT\s*COUNT$/i ) {
             $name = "COUNT(DISTINCT $name)";
         }
@@ -1357,7 +1354,7 @@
     }
 
     my $column = "col" . @{ $self->{columns} ||= [] };
-    $column = $args{FIELD} if $table eq $self->table and !$args{ALIAS};
+    $column = $args{column} if $table eq $self->table and !$args{alias};
     push @{ $self->{columns} }, "$name AS \L$column";
     return $column;
 }
@@ -1370,12 +1367,12 @@
 
 sub columns {
     my $self = shift;
-    $self->column( FIELD => $_ ) for @_;
+    $self->column( column => $_ ) for @_;
 }
 
-=head2 fields TABLE
+=head2 fields table
 
-Return a list of fields in TABLE, lowercased.
+Return a list of fields in table, lowercased.
 
 TODO: Why are they lowercased?
 
@@ -1399,9 +1396,9 @@
         };
 }
 
-=head2 has_field  { TABLE => undef, FIELD => undef }
+=head2 has_field  { table => undef, column => undef }
 
-Returns true if TABLE has field FIELD.
+Returns true if table has field column.
 Return false otherwise
 
 =cut
@@ -1409,17 +1406,17 @@
 sub has_field {
     my $self = shift;
     my %args = (
-        FIELD => undef,
-        TABLE => undef,
+        column => undef,
+        table => undef,
         @_
     );
 
-    my $table = $args{TABLE} or die;
-    my $field = $args{FIELD} or die;
+    my $table = $args{table} or die;
+    my $field = $args{column} or die;
     return grep { $_ eq $field } $self->fields($table);
 }
 
-=head2 table [TABLE]
+=head2 table [table]
 
 If called with an argument, sets this collection's table.
 

Added: Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Union.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Union.pm	Sat Oct 29 16:02:28 2005
@@ -0,0 +1,241 @@
+package Jifty::DBI::Collection::Union;
+use strict;
+use warnings;
+
+# WARNING --- This is still development code.  It is experimental.
+
+our $VERSION = '0';
+
+# This could inherit from Jifty::DBI, but there are _a lot_
+# of things in Jifty::DBI that we don't want, like Limit and
+# stuff.  It probably makes sense to (eventually) split out
+# Jifty::DBI::Collection to contain all the iterator logic.
+# This could inherit from that.
+
+=head1 NAME
+
+Jifty::DBI::Collection::Union - Deal with multiple L<Jifty::DBI::Collection>
+result sets as one
+
+=head1 SYNOPSIS
+
+  use Jifty::DBI::Collection::Union;
+  my $U = new Jifty::DBI::Collection::Union;
+  $U->add( $tickets1 );
+  $U->add( $tickets2 );
+
+  $U->GotoFirstItem;
+  while (my $z = $U->Next) {
+    printf "%5d %30.30s\n", $z->Id, $z->Subject;
+  }
+
+=head1 WARNING
+
+This module is still experimental.
+
+=head1 DESCRIPTION
+
+Implements a subset of the L<Jifty::DBI::Collection> methods, but
+enough to do iteration over a bunch of results.  Useful for displaying
+the results of two unrelated searches (for the same kind of objects)
+in a single list.
+
+=head1 METHODS
+
+=head2 new
+
+Create a new L<Jifty::DBI::Collection::Union> object.  No arguments.
+
+=cut
+
+sub new {
+    bless {
+        data  => [],
+        curp  => 0,       # current offset in data
+        item  => 0,       # number of indiv items from First
+        count => undef,
+        },
+        shift;
+}
+
+=head2 add COLLECTION
+
+Add L<Jifty::DBI::Collection> object I<COLLECTION> to the Union
+object.
+
+It must be the same type as the first object added.
+
+=cut
+
+sub add {
+    my $self   = shift;
+    my $newobj = shift;
+
+    unless ( @{ $self->{data} } == 0
+        || ref($newobj) eq ref( $self->{data}[0] ) )
+    {
+        die
+            "All elements of a Jifty::DBI::Collection::Union must be of the same type.  Looking for a "
+            . ref( $self->{data}[0] ) . ".";
+    }
+
+    $self->{count} = undef;
+    push @{ $self->{data} }, $newobj;
+}
+
+=head2 first
+
+Return the very first element of the Union (which is the first element
+of the first Collection).  Also reset the current pointer to that
+element.
+
+=cut
+
+sub first {
+    my $self = shift;
+
+    die "No elements in Jifty::DBI::Collection::Union"
+        unless @{ $self->{data} };
+
+    $self->{curp} = 0;
+    $self->{item} = 0;
+    $self->{data}[0]->First;
+}
+
+=head2 next
+
+Return the next element in the Union.
+
+=cut
+
+sub next {
+    my $self = shift;
+
+    return undef unless defined $self->{data}[ $self->{curp} ];
+
+    my $cur = $self->{data}[ $self->{curp} ];
+    if ( $cur->_items_counter == $cur->count ) {
+
+        # move to the next element
+        $self->{curp}++;
+        return undef unless defined $self->{data}[ $self->{curp} ];
+        $cur = $self->{data}[ $self->{curp} ];
+        $self->{data}[ $self->{curp} ]->goto_first_item;
+    }
+    $self->{item}++;
+    $cur->next;
+}
+
+=head2 last
+
+Returns the last item
+
+=cut
+
+sub last {
+    die "Last doesn't work right now";
+    my $self = shift;
+    $self->goto_item( ( $self->count ) - 1 );
+    return ( $self->next );
+}
+
+=head2 count
+
+Returns the total number of elements in the Union'ed Collection
+
+=cut
+
+sub count {
+    my $self = shift;
+    my $sum  = 0;
+
+    # cache the results
+    return $self->{count} if defined $self->{count};
+
+    $sum += $_->count for ( @{ $self->{data} } );
+
+    $self->{count} = $sum;
+
+    return $sum;
+}
+
+=head2 goto_first_item
+
+Starts the recordset counter over from the first item. the next time
+you call L</next>, you'll get the first item returned by the database,
+as if you'd just started iterating through the result set.
+
+=cut
+
+sub goto_first_item {
+    my $self = shift;
+    $self->goto_item(0);
+}
+
+sub goto_item {
+    my $self = shift;
+    my $item = shift;
+
+    die "We currently only support going to the First item"
+        unless $item == 0;
+
+    $self->{curp} = 0;
+    $self->{item} = 0;
+    $self->{data}[0]->goto_item(0);
+
+    return $item;
+}
+
+=head2 is_last
+
+Returns true if the current row is the last record in the set.
+
+=cut
+
+sub is_last {
+    my $self = shift;
+
+    $self->{item} == $self->count ? 1 : undef;
+}
+
+=head2 items_array_ref
+
+Return a refernece to an array containing all objects found by this search.
+
+Will destroy any positional state.
+
+=cut
+
+sub items_array_ref {
+    my $self = shift;
+
+    return [] unless $self->count;
+
+    $self->goto_first_item();
+    my @ret;
+    while ( my $r = $self->next ) {
+        push @ret, $r;
+    }
+
+    return \@ret;
+}
+
+=head1 AUTHOR
+
+Copyright (c) 2004 Robert Spier
+
+All rights reserved.
+
+This library is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Jifty::DBI>, L<Jifty::DBI::Collection>
+
+=cut
+
+1;
+
+__END__
+

Added: Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm
==============================================================================
--- (empty file)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm	Sat Oct 29 16:02:28 2005
@@ -0,0 +1,63 @@
+package Jifty::DBI::Collection::Unique;
+use base 'Exporter';
+our @EXPORT  = qw(AddRecord);
+our $VERSION = "0.01";
+use strict;
+use warnings;
+
+sub AddRecord {
+    my $self   = shift;
+    my $record = shift;
+
+    # We're a mixin, so we can't override _CleanSlate, but if an object
+    # gets reused, we need to clean ourselves out.  If there are no items,
+    # we're clearly doing a new search
+    $self->{"dbix_sb_unique_cache"} = {} unless ( @{ $self->{'items'} }[0] );
+    return if $self->{"dbix_sb_unique_cache"}->{ $record->id }++;
+    push @{ $self->{'items'} }, $record;
+}
+
+1;
+
+=head1 NAME
+
+Jifty::DBI::Collection::Unique - Ensure uniqueness of records in a collection
+
+=head1 SYNOPSIS
+
+    package Foo::Collection;
+    use base 'Jifty::DBI::Collection';
+
+    use Jifty::DBI::Collection::Unique; # mixin
+
+    my $collection = Foo::Collection->New();
+    $collection->SetupComplicatedJoins;
+    $collection->OrderByMagic;
+    
+    while (my $thing = $collection->Next) {
+        # $thing is going to be distinct
+    }
+
+=head1 DESCRIPTION
+
+Currently, Jifty::DBI makes exceptions for databases which
+cannot handle both C<SELECT DISTINCT> and ordering in the same
+statement; it drops the C<DISTINCT> requirement. This, of course, means
+that you can get the same row twice, which you might not want. If that's
+the case, use this module as a mix-in, and it will provide you with an
+C<AddRecord> method which ensures that a record will not appear twice in
+the same search.
+
+=head1 AUTHOR
+
+Simon Cozens.
+
+=head1 COPYRIGHT
+
+Copyright 2005 Best Practical Solutions, LLC
+
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	Sat Oct 29 16:02:28 2005
@@ -306,7 +306,7 @@
     return ( $DBIHandle{$self} ||= $PrevHandle );
 }
 
-=head2 insert $TABLE_NAME @KEY_VALUE_PAIRS
+=head2 insert $table_NAME @KEY_VALUE_PAIRS
 
 Takes a table name and a set of key-value pairs in an array. splits the key value pairs, constructs an INSERT statement and performs the insert. Returns the row_id of this row.
 
@@ -382,9 +382,9 @@
     return ( $self->simple_query( $query_str, @bind ) );
 }
 
-=head2 update_table_value TABLE COLUMN NEW_VALUE RECORD_ID IS_SQL
+=head2 update_table_value table COLUMN NEW_value RECORD_ID IS_SQL
 
-Update column COLUMN of table TABLE where the record id = RECORD_ID.  if IS_SQL is set,
+Update column COLUMN of table table where the record id = RECORD_ID.  if IS_SQL is set,
 don\'t quote the NEW_VALUE
 
 =cut
@@ -533,7 +533,7 @@
     return (1);
 }
 
-=head2 blob_params FIELD_NAME FIELD_TYPE
+=head2 blob_params column_NAME column_type
 
 Returns a hash ref for the bind_param call to identify BLOB types used by 
 the current database for a particular column type.                 
@@ -598,12 +598,12 @@
     return (1);
 }
 
-=head2 _make_clause_case_insensitive FIELD OPERATOR VALUE
+=head2 _make_clause_case_insensitive column operator VALUE
 
 Takes a field, operator and value. performs the magic necessary to make
 your database treat this clause as case insensitive.
 
-Returns a FIELD OPERATOR VALUE triple.
+Returns a column operator value triple.
 
 =cut
 
@@ -757,12 +757,12 @@
     my $self = shift;
     my %args = (
         collection => undef,
-        TYPE       => 'normal',
-        FIELD1     => 'main',
-        ALIAS1     => undef,
-        TABLE2     => undef,
-        FIELD2     => undef,
-        ALIAS2     => undef,
+        type       => 'normal',
+        column1     => 'main',
+        alias1     => undef,
+        table2     => undef,
+        column2     => undef,
+        alias2     => undef,
         EXPRESSION => undef,
         @_
     );
@@ -771,19 +771,19 @@
 
     my $alias;
 
-#If we're handed in an ALIAS2, we need to go remove it from the
+#If we're handed in an alias2, we need to go remove it from the
 # Aliases array.  Basically, if anyone generates an alias and then
 # tries to use it in a join later, we want to be smart about creating
 # joins, so we need to go rip it out of the old aliases table and drop
 # it in as an explicit join
-    if ( $args{'ALIAS2'} ) {
+    if ( $args{'alias2'} ) {
 
         # this code is slow and wasteful, but it's clear.
         my @aliases = @{ $args{'collection'}->{'aliases'} };
         my @new_aliases;
         foreach my $old_alias (@aliases) {
-            if ( $old_alias =~ /^(.*?) ($args{'ALIAS2'})$/ ) {
-                $args{'TABLE2'} = $1;
+            if ( $old_alias =~ /^(.*?) ($args{'alias2'})$/ ) {
+                $args{'table2'} = $1;
                 $alias = $2;
 
             }
@@ -796,18 +796,18 @@
         unless ($alias) {
 
             # if we can't do that, can we reverse the join and have it work?
-            my $a1 = $args{'ALIAS1'};
-            my $f1 = $args{'FIELD1'};
-            $args{'ALIAS1'} = $args{'ALIAS2'};
-            $args{'FIELD1'} = $args{'FIELD2'};
-            $args{'ALIAS2'} = $a1;
-            $args{'FIELD2'} = $f1;
+            my $a1 = $args{'alias1'};
+            my $f1 = $args{'column1'};
+            $args{'alias1'} = $args{'alias2'};
+            $args{'column1'} = $args{'column2'};
+            $args{'alias2'} = $a1;
+            $args{'column2'} = $f1;
 
             @aliases     = @{ $args{'collection'}->{'aliases'} };
             @new_aliases = ();
             foreach my $old_alias (@aliases) {
-                if ( $old_alias =~ /^(.*?) ($args{'ALIAS2'})$/ ) {
-                    $args{'TABLE2'} = $1;
+                if ( $old_alias =~ /^(.*?) ($args{'alias2'})$/ ) {
+                    $args{'table2'} = $1;
                     $alias = $2;
 
                 }
@@ -818,7 +818,7 @@
 
         }
 
-        if ( !$alias || $args{'ALIAS1'} ) {
+        if ( !$alias || $args{'alias1'} ) {
             return ( $self->_normal_join(%args) );
         }
 
@@ -826,18 +826,18 @@
     }
 
     else {
-        $alias = $args{'collection'}->_get_alias( $args{'TABLE2'} );
+        $alias = $args{'collection'}->_get_alias( $args{'table2'} );
 
     }
 
-    if ( $args{'TYPE'} =~ /LEFT/i ) {
+    if ( $args{'type'} =~ /LEFT/i ) {
 
-        $string = " LEFT JOIN " . $args{'TABLE2'} . " $alias ";
+        $string = " LEFT JOIN " . $args{'table2'} . " $alias ";
 
     }
     else {
 
-        $string = " JOIN " . $args{'TABLE2'} . " $alias ";
+        $string = " JOIN " . $args{'table2'} . " $alias ";
 
     }
 
@@ -846,16 +846,16 @@
         $criterion = $args{'EXPRESSION'};
     }
     else {
-        $criterion = $args{'ALIAS1'} . "." . $args{'FIELD1'};
+        $criterion = $args{'alias1'} . "." . $args{'column1'};
     }
 
-    $args{'collection'}->{'left_joins'}{"$alias"}{'alias_string'}
+    $args{'collection'}->{'leftjoins'}{"$alias"}{'alias_string'}
         = $string;
-    $args{'collection'}->{'left_joins'}{"$alias"}{'depends_on'}
-        = $args{'ALIAS1'};
-    $args{'collection'}->{'left_joins'}{"$alias"}{'criteria'}
+    $args{'collection'}->{'leftjoins'}{"$alias"}{'depends_on'}
+        = $args{'alias1'};
+    $args{'collection'}->{'leftjoins'}{"$alias"}{'criteria'}
         { 'criterion' . $args{'collection'}->{'criteria_count'}++ }
-        = " $alias.$args{'FIELD2'} = $criterion";
+        = " $alias.$args{'column2'} = $criterion";
 
     return ($alias);
 }
@@ -865,35 +865,35 @@
     my $self = shift;
     my %args = (
         collection => undef,
-        TYPE       => 'normal',
-        FIELD1     => undef,
-        ALIAS1     => undef,
-        TABLE2     => undef,
-        FIELD2     => undef,
-        ALIAS2     => undef,
+        type       => 'normal',
+        column1     => undef,
+        alias1     => undef,
+        table2     => undef,
+        column2     => undef,
+        alias2     => undef,
         @_
     );
 
     my $sb = $args{'collection'};
 
-    if ( $args{'TYPE'} =~ /LEFT/i ) {
-        my $alias = $sb->_get_alias( $args{'TABLE2'} );
+    if ( $args{'type'} =~ /LEFT/i ) {
+        my $alias = $sb->_get_alias( $args{'table2'} );
 
-        $sb->{'left_joins'}{"$alias"}{'alias_string'}
-            = " LEFT JOIN $args{'TABLE2'} $alias ";
+        $sb->{'leftjoins'}{"$alias"}{'alias_string'}
+            = " LEFT JOIN $args{'table2'} $alias ";
 
-        $sb->{'left_joins'}{"$alias"}{'criteria'}{'base_criterion'}
-            = " $args{'ALIAS1'}.$args{'FIELD1'} = $alias.$args{'FIELD2'}";
+        $sb->{'leftjoins'}{"$alias"}{'criteria'}{'base_criterion'}
+            = " $args{'alias1'}.$args{'column1'} = $alias.$args{'column2'}";
 
         return ($alias);
     }
     else {
         $sb->Jifty::DBI::Collection::limit(
-            ENTRYAGGREGATOR => 'AND',
-            QUOTEVALUE      => 0,
-            ALIAS           => $args{'ALIAS1'},
-            FIELD           => $args{'FIELD1'},
-            VALUE           => $args{'ALIAS2'} . "." . $args{'FIELD2'},
+            entry_aggregator => 'AND',
+            quote_value      => 0,
+            alias           => $args{'alias1'},
+            column           => $args{'column1'},
+            value           => $args{'alias2'} . "." . $args{'column2'},
             @_
         );
     }
@@ -918,18 +918,18 @@
 
     my $join_clause = $sb->table . " main ";
 
-    my @keys = ( keys %{ $sb->{'left_joins'} } );
+    my @keys = ( keys %{ $sb->{'leftjoins'} } );
     my %seen;
 
     while ( my $join = shift @keys ) {
-        if ( !$sb->{'left_joins'}{$join}{'depends_on'}
-            || $seen_aliases{ $sb->{'left_joins'}{$join}{'depends_on'} } )
+        if ( !$sb->{'leftjoins'}{$join}{'depends_on'}
+            || $seen_aliases{ $sb->{'leftjoins'}{$join}{'depends_on'} } )
         {
             $join_clause = "(" . $join_clause;
             $join_clause
-                .= $sb->{'left_joins'}{$join}{'alias_string'} . " ON (";
+                .= $sb->{'leftjoins'}{$join}{'alias_string'} . " ON (";
             $join_clause .= CORE::join( ') AND( ',
-                values %{ $sb->{'left_joins'}{$join}{'criteria'} } );
+                values %{ $sb->{'leftjoins'}{$join}{'criteria'} } );
             $join_clause .= ")) ";
 
             $seen_aliases{$join} = 1;

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm	Sat Oct 29 16:02:28 2005
@@ -165,7 +165,7 @@
     return (undef);
 }
 
-=head2 blob_params FIELD_NAME FIELD_TYPE
+=head2 blob_params column_NAME column_type
 
 Returns a hash ref for the bind_param call to identify BLOB types used
 by the current database for a particular column type.  The current

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm	Sat Oct 29 16:02:28 2005
@@ -113,12 +113,12 @@
 
 }
 
-=head2 _make_clause_case_insensitive FIELD OPERATOR VALUE
+=head2 _make_clause_case_insensitive column operator VALUE
 
 Takes a field, operator and value. performs the magic necessary to make
 your database treat this clause as case insensitive.
 
-Returns a FIELD OPERATOR VALUE triple.
+Returns a column operator value triple.
 
 =cut
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm	Sat Oct 29 16:02:28 2005
@@ -121,19 +121,19 @@
 
     my $join_clause = $sb->table . " main ";
 
-    my @keys = ( keys %{ $sb->{'left_joins'} } );
+    my @keys = ( keys %{ $sb->{'leftjoins'} } );
     my %seen;
 
     while ( my $join = shift @keys ) {
-        if ( !$sb->{'left_joins'}{$join}{'depends_on'}
-            || $seen_aliases{ $sb->{'left_joins'}{$join}{'depends_on'} } )
+        if ( !$sb->{'leftjoins'}{$join}{'depends_on'}
+            || $seen_aliases{ $sb->{'leftjoins'}{$join}{'depends_on'} } )
         {
 
             #$join_clause = "(" . $join_clause;
             $join_clause
-                .= $sb->{'left_joins'}{$join}{'alias_string'} . " ON (";
+                .= $sb->{'leftjoins'}{$join}{'alias_string'} . " ON (";
             $join_clause .= join( ') AND( ',
-                values %{ $sb->{'left_joins'}{$join}{'criteria'} } );
+                values %{ $sb->{'leftjoins'}{$join}{'criteria'} } );
             $join_clause .= ") ";
 
             $seen_aliases{$join} = 1;

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	Sat Oct 29 16:02:28 2005
@@ -503,7 +503,7 @@
     return unless UNIVERSAL::isa( $classname, 'Jifty::DBI::Collection' );
 
     my $coll = $classname->new( handle => $self->_handle );
-    $coll->limit( FIELD => $column->by(), VALUE => $self->id );
+    $coll->limit( column => $column->by(), value => $self->id );
     return $coll;
 }
 
@@ -769,9 +769,9 @@
     return ( $ret->return_value );
 }
 
-=head2 _Validate FIELD VALUE
+=head2 _Validate column VALUE
 
-Validate that VALUE will be an acceptable value for FIELD. 
+Validate that value will be an acceptable value for column. 
 
 Currently, this routine does nothing whatsoever. 
 

Modified: Jifty-DBI/trunk/t/01records.t
==============================================================================
--- Jifty-DBI/trunk/t/01records.t	(original)
+++ Jifty-DBI/trunk/t/01records.t	Sat Oct 29 16:02:28 2005
@@ -209,7 +209,7 @@
 
 sub schema_mysql {
 <<EOF;
-CREATE TEMPORARY TABLE addresses (
+CREATE TEMPORARY table addresses (
         id integer AUTO_INCREMENT,
         name varchar(36),
         phone varchar(18),
@@ -221,7 +221,7 @@
 
 sub schema_pg {
 <<EOF;
-CREATE TEMPORARY TABLE addresses (
+CREATE TEMPORARY table addresses (
         id serial PRIMARY KEY,
         name varchar,
         phone varchar,
@@ -234,7 +234,7 @@
 sub schema_sqlite {
 
 <<EOF;
-CREATE TABLE addresses (
+CREATE table addresses (
         id  integer primary key,
         name varchar(36),
         phone varchar(18),

Modified: Jifty-DBI/trunk/t/01searches.t
==============================================================================
--- Jifty-DBI/trunk/t/01searches.t	(original)
+++ Jifty-DBI/trunk/t/01searches.t	Sat Oct 29 16:02:28 2005
@@ -77,7 +77,7 @@
 # basic limits
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'login', VALUE => 'obra' );
+	$users_obj->limit( column => 'login', value => 'obra' );
 	is( $users_obj->count, 1, 'found one user with login obra' );
 	TODO: {
 		local $TODO = 'require discussion';
@@ -103,11 +103,11 @@
 	isa_ok( $items_ref, 'ARRAY', 'items_array_ref always returns array reference' );
 	is( scalar @{$items_ref}, 1, 'items_array_ref has only 1 record' );
 
-# similar basic limit, but with different OPERATORS and less first/next/last tests
+# similar basic limit, but with different operatorS and less first/next/last tests
 	# LIKE
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'name', OPERATOR => 'LIKE', VALUE => 'Glass' );
+	$users_obj->limit( column => 'name', operator => 'MATCHES', value => 'Glass' );
 	is( $users_obj->count, 1, "found one user with 'Glass' in the name" );
 	$first_rec = $users_obj->first;
 	isa_ok( $first_rec, 'Jifty::DBI::Record', 'First returns record object' );
@@ -116,7 +116,7 @@
 	# STARTSWITH
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'name', OPERATOR => 'STARTSWITH', VALUE => 'Ruslan' );
+	$users_obj->limit( column => 'name', operator => 'STARTSWITH', value => 'Ruslan' );
 	is( $users_obj->count, 1, "found one user who name starts with 'Ruslan'" );
 	$first_rec = $users_obj->first;
 	isa_ok( $first_rec, 'Jifty::DBI::Record', 'First returns record object' );
@@ -125,32 +125,32 @@
 	# ENDSWITH
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'name', OPERATOR => 'ENDSWITH', VALUE => 'Tang' );
+	$users_obj->limit( column => 'name', operator => 'ENDSWITH', value => 'Tang' );
 	is( $users_obj->count, 1, "found one user who name ends with 'Tang'" );
 	$first_rec = $users_obj->first;
 	isa_ok( $first_rec, 'Jifty::DBI::Record', 'First returns record object' );
 	is( $first_rec->login, 'autrijus', 'login is correct' );
 
 	# IS NULL
-	# XXX TODO FIXME: FIELD => undef should be handled as NULL
+	# XXX TODO FIXME: column => undef should be handled as NULL
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'phone', OPERATOR => 'IS', VALUE => 'NULL' );
+	$users_obj->limit( column => 'phone', operator => 'IS', value => 'NULL' );
 	is( $users_obj->count, 2, "found 2 users who has unknown phone number" );
 	
 	# IS NOT NULL
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
-	$users_obj->limit( FIELD => 'phone', OPERATOR => 'IS NOT', VALUE => 'NULL', QOUTEVALUE => 0 );
+	$users_obj->limit( column => 'phone', operator => 'IS NOT', value => 'NULL', QOUTEvalue => 0 );
 	is( $users_obj->count, $count_all - 2, "found users who has phone number filled" );
 	
 	# ORDER BY / GROUP BY
 	$users_obj->clean_slate;
 	is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
 	$users_obj->unlimit;
-	$users_obj->group_by_cols({FIELD => 'login'});
-	$users_obj->order_by(FIELD => 'login', ORDER => 'desc');
-	$users_obj->column(FIELD => 'login');
+	$users_obj->group_by_cols({column => 'login'});
+	$users_obj->order_by(column => 'login', order => 'desc');
+	$users_obj->column(column => 'login');
 	is( $users_obj->count, $count_all, "group by / order by finds right amount");
 	$first_rec = $users_obj->first;
 	isa_ok( $first_rec, 'Jifty::DBI::Record', 'First returns record object' );
@@ -165,7 +165,7 @@
 
 sub schema_mysql {
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id integer AUTO_INCREMENT,
         login varchar(18) NOT NULL,
         name varchar(36),
@@ -177,7 +177,7 @@
 
 sub schema_pg {
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id serial PRIMARY KEY,
         login varchar(18) NOT NULL,
         name varchar(36),
@@ -190,7 +190,7 @@
 sub schema_sqlite {
 
 <<EOF;
-CREATE TABLE users (
+CREATE table users (
 	id integer primary key,
 	login varchar(18) NOT NULL,
 	name varchar(36),

Modified: Jifty-DBI/trunk/t/02records_object.t
==============================================================================
--- Jifty-DBI/trunk/t/02records_object.t	(original)
+++ Jifty-DBI/trunk/t/02records_object.t	Sat Oct 29 16:02:28 2005
@@ -56,12 +56,12 @@
 sub schema_sqlite {
 [
 q{
-CREATE TABLE employees (
+CREATE table employees (
 	id integer primary key,
 	name varchar(36)
 )
 }, q{
-CREATE TABLE phones (
+CREATE table phones (
 	id integer primary key,
 	employee integer NOT NULL,
 	phone varchar(18)
@@ -71,12 +71,12 @@
 
 sub schema_mysql {
 [ q{
-CREATE TEMPORARY TABLE employees (
+CREATE TEMPORARY table employees (
 	id integer AUTO_INCREMENT primary key,
 	name varchar(36)
 )
 }, q{
-CREATE TEMPORARY TABLE phones (
+CREATE TEMPORARY table phones (
 	id integer AUTO_INCREMENT primary key,
 	employee integer NOT NULL,
 	phone varchar(18)
@@ -86,12 +86,12 @@
 
 sub schema_pg {
 [ q{
-CREATE TEMPORARY TABLE employees (
+CREATE TEMPORARY table employees (
 	id serial PRIMARY KEY,
 	name varchar
 )
 }, q{
-CREATE TEMPORARY TABLE phones (
+CREATE TEMPORARY table phones (
 	id serial PRIMARY KEY,
 	employee integer references employees(id),
 	phone varchar

Modified: Jifty-DBI/trunk/t/06filter_datetime.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_datetime.t	(original)
+++ Jifty-DBI/trunk/t/06filter_datetime.t	Sat Oct 29 16:02:28 2005
@@ -62,7 +62,7 @@
 sub schema_sqlite {
 
 <<EOF;
-CREATE TABLE users (
+CREATE table users (
         id integer primary key,
 	created datetime
 )
@@ -73,7 +73,7 @@
 sub schema_mysql {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id integer auto_increment primary key,
 	created datetime
 )
@@ -84,7 +84,7 @@
 sub schema_pg {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id serial primary key,
 	created timestamp
 )

Modified: Jifty-DBI/trunk/t/06filter_truncate.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_truncate.t	(original)
+++ Jifty-DBI/trunk/t/06filter_truncate.t	Sat Oct 29 16:02:28 2005
@@ -75,7 +75,7 @@
 sub schema_sqlite {
 
 <<EOF;
-CREATE TABLE users (
+CREATE table users (
         id integer primary key,
 	login char(5),
 	name varchar(10),
@@ -88,7 +88,7 @@
 sub schema_mysql {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id integer auto_increment primary key,
 	login char(5),
 	name varchar(10),
@@ -101,7 +101,7 @@
 sub schema_mysql_4_1 {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id integer auto_increment primary key,
 	login binary(5),
 	name varbinary(10),
@@ -116,7 +116,7 @@
 sub schema_pg {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id serial primary key,
 	login varchar(5),
 	name varchar(10),

Modified: Jifty-DBI/trunk/t/06filter_utf8.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_utf8.t	(original)
+++ Jifty-DBI/trunk/t/06filter_utf8.t	Sat Oct 29 16:02:28 2005
@@ -91,7 +91,7 @@
 sub schema_sqlite {
 
 <<EOF;
-CREATE TABLE users (
+CREATE table users (
         id integer primary key,
 	name varchar(5),
 	signature varchar(100)
@@ -103,7 +103,7 @@
 sub schema_mysql {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id integer auto_increment primary key,
 	name varchar(5),
 	signature varchar(100)
@@ -115,7 +115,7 @@
 sub schema_pg {
 
 <<EOF;
-CREATE TEMPORARY TABLE users (
+CREATE TEMPORARY table users (
         id serial primary key,
 	name varchar(5),
 	signature varchar(100)

Modified: Jifty-DBI/trunk/t/10schema.t
==============================================================================
--- Jifty-DBI/trunk/t/10schema.t	(original)
+++ Jifty-DBI/trunk/t/10schema.t	Sat Oct 29 16:02:28 2005
@@ -61,7 +61,7 @@
     ok($ret != 0, "added model from real class");
 
     is_ignoring_space($SG->create_table_sql_text, <<END_SCHEMA, "got the right schema");
-    CREATE TABLE addresses ( 
+    CREATE table addresses ( 
       id serial NOT NULL , 
       employee_id integer ,
       name varchar DEFAULT 'Frank' ,
@@ -79,14 +79,14 @@
     ok($ret != 0, "added model from an instantiated object");
 
     is_ignoring_space($SG->create_table_sql_text, <<END_SCHEMA, "got the right schema");
-    CREATE TABLE addresses ( 
+    CREATE table addresses ( 
       id serial NOT NULL , 
       employee_id integer  ,
       name varchar DEFAULT 'Frank' ,
       phone varchar ,
       PRIMARY KEY (id)
     ) ;
-    CREATE TABLE employees (
+    CREATE table employees (
       id serial NOT NULL ,
       dexterity integer ,
       name varchar ,

Modified: Jifty-DBI/trunk/t/11schema_records.t
==============================================================================
--- Jifty-DBI/trunk/t/11schema_records.t	(original)
+++ Jifty-DBI/trunk/t/11schema_records.t	Sat Oct 29 16:02:28 2005
@@ -193,12 +193,12 @@
 sub schema_sqlite {
 [
 q{
-CREATE TABLE employees (
+CREATE table employees (
 	id integer primary key,
 	name varchar(36)
 )
 }, q{
-CREATE TABLE phones (
+CREATE table phones (
 	id integer primary key,
 	employee integer NOT NULL,
 	phone varchar(18)
@@ -208,12 +208,12 @@
 
 sub schema_mysql {
 [ q{
-CREATE TEMPORARY TABLE employees (
+CREATE TEMPORARY table employees (
 	id integer AUTO_INCREMENT primary key,
 	name varchar(36)
 )
 }, q{
-CREATE TEMPORARY TABLE phones (
+CREATE TEMPORARY table phones (
 	id integer AUTO_INCREMENT primary key,
 	employee integer NOT NULL,
 	phone varchar(18)
@@ -223,12 +223,12 @@
 
 sub schema_pg {
 [ q{
-CREATE TEMPORARY TABLE employees (
+CREATE TEMPORARY table employees (
 	id serial PRIMARY KEY,
 	name varchar
 )
 }, q{
-CREATE TEMPORARY TABLE phones (
+CREATE TEMPORARY table phones (
 	id serial PRIMARY KEY,
 	employee integer references employees(id),
 	phone varchar

Modified: Jifty-DBI/trunk/t/utils.pl
==============================================================================
--- Jifty-DBI/trunk/t/utils.pl	(original)
+++ Jifty-DBI/trunk/t/utils.pl	Sat Oct 29 16:02:28 2005
@@ -31,7 +31,7 @@
 
 our @available_drivers = grep { eval "require DBD::". $_ } @supported_drivers;
 
-=head1 FUNCTIONS
+=head1 functionS
 
 =head2 get_handle
 


More information about the Rt-commit mailing list