[Jifty-commit] r5183 - in Jifty-DBI/trunk: lib/Jifty/DBI
Jifty commits
jifty-commit at lists.jifty.org
Fri Feb 29 20:03:12 EST 2008
Author: sartak
Date: Fri Feb 29 20:03:01 2008
New Revision: 5183
Modified:
Jifty-DBI/trunk/ (props changed)
Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
Log:
r52274 at onn: sartak | 2008-02-29 19:52:42 -0500
Move the alias and column handling in ->limit up sooner so we have a column object as soon as possible
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 Fri Feb 29 20:03:01 2008
@@ -1191,6 +1191,59 @@
return if $self->derived;
+ #If we're performing a left join, we really want the alias to be the
+ #left join criterion.
+
+ if ( ( defined $args{'leftjoin'} )
+ && ( not defined $args{'alias'} ) )
+ {
+ $args{'alias'} = $args{'leftjoin'};
+ }
+
+ # {{{ if there's no alias set, we need to set it
+
+ unless ( defined $args{'alias'} ) {
+
+ #if the table we're looking at is the same as the main 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';
+ }
+
+ else {
+ $args{'alias'} = $self->new_alias( $args{'table'} );
+ }
+ }
+
+ # }}}
+
+ # Set this to the name of the column and the alias, unless we've been
+ # handed a subclause name
+
+ my $qualified_column
+ = $args{'alias'}
+ ? $args{'alias'} . "." . $args{'column'}
+ : $args{'column'};
+ my $clause_id = $args{'subclause'} || $qualified_column;
+
+ # XXX: when is column_obj undefined?
+ my $class
+ = $self->{joins}{ $args{alias} }
+ && $self->{joins}{ $args{alias} }{class}
+ ? $self->{joins}{ $args{alias} }{class}
+ ->new( $self->_new_collection_args )
+ : $self;
+ my $column_obj = $class->new_item()->column( $args{column} );
+
+ $self->record_class->new(handle => $self->_handle)->_apply_input_filters(
+ column => $column_obj,
+ value_ref => \$args{'value'},
+ ) if $column_obj && $column_obj->decode_select;
+
# make passing in an object DTRT
my $value_ref = ref( $args{value} );
if ($value_ref) {
@@ -1243,45 +1296,6 @@
$args{'escape'} = 'ESCAPE ' . $self->_quote_value( $args{escape} );
}
- #If we're performing a left join, we really want the alias to be the
- #left join criterion.
-
- if ( ( defined $args{'leftjoin'} )
- && ( not defined $args{'alias'} ) )
- {
- $args{'alias'} = $args{'leftjoin'};
- }
-
- # {{{ if there's no alias set, we need to set it
-
- unless ( defined $args{'alias'} ) {
-
- #if the table we're looking at is the same as the main 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';
- }
-
- else {
- $args{'alias'} = $self->new_alias( $args{'table'} );
- }
- }
-
- # }}}
-
- # Set this to the name of the column and the alias, unless we've been
- # handed a subclause name
-
- my $qualified_column
- = $args{'alias'}
- ? $args{'alias'} . "." . $args{'column'}
- : $args{'column'};
- my $clause_id = $args{'subclause'} || $qualified_column;
-
# If we're trying to get a leftjoin restriction, lets set
# $restriction to point there. otherwise, lets construct normally
@@ -1296,14 +1310,6 @@
# If it's a new value or we're overwriting this sort of restriction,
- # XXX: when is column_obj undefined?
- my $class
- = $self->{joins}{ $args{alias} }
- && $self->{joins}{ $args{alias} }{class}
- ? $self->{joins}{ $args{alias} }{class}
- ->new( $self->_new_collection_args )
- : $self;
- my $column_obj = $class->new_item()->column( $args{column} );
my $case_sensitive = $column_obj ? $column_obj->case_sensitive : 0;
$case_sensitive = $args{'case_sensitive'}
if defined $args{'case_sensitive'};
@@ -1329,11 +1335,6 @@
$args{'operator'} = 'IN';
}
- $self->record_class->new(handle => $self->_handle)->_apply_input_filters(
- column => $column_obj,
- value_ref => \$args{'value'},
- ) if $column_obj && $column_obj->decode_select;
-
my $clause = {
column => $qualified_column,
operator => $args{'operator'},
More information about the Jifty-commit
mailing list