[Bps-public-commit] dbix-searchbuilder branch, functions-in-limit, created. 1.59-16-g6016cff
Ruslan Zakirov
ruz at bestpractical.com
Sun May 22 15:27:38 EDT 2011
The branch, functions-in-limit has been created
at 6016cffc94dd4f7a168cb6b74834f160d1ed680f (commit)
- Log -----------------------------------------------------------------
commit d38f763e6f5f6a61775f845c3ca26f25b2412497
Merge: 2c24943 5245c42
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri May 20 21:12:09 2011 +0400
Merge remote-tracking branch 'origin/delete-quote-vs-utf-flag-workaround' into functions-in-limit
commit 0d619d939aa535f182fafef275848e95facebeba
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri May 20 21:16:11 2011 +0400
FIELD is not related to OPERATOR and QUOTEVALUE
if operator is provided then do process "LIKE" like operators
QUOTEVALUE has nothing to do with presence of FIELD argument
diff --git a/lib/DBIx/SearchBuilder.pm b/lib/DBIx/SearchBuilder.pm
index b894315..493bd46 100755
--- a/lib/DBIx/SearchBuilder.pm
+++ b/lib/DBIx/SearchBuilder.pm
@@ -823,8 +823,7 @@ sub Limit {
#since we're changing the search criteria, we need to redo the search
$self->RedoSearch();
- if ( $args{'FIELD'} ) {
-
+ if ( $args{'OPERATOR'} ) {
#If it's a like, we supply the %s around the search term
if ( $args{'OPERATOR'} =~ /LIKE/i ) {
$args{'VALUE'} = "%" . $args{'VALUE'} . "%";
@@ -836,7 +835,9 @@ sub Limit {
$args{'VALUE'} = "%" . $args{'VALUE'};
}
$args{'OPERATOR'} =~ s/(?:MATCHES|ENDSWITH|STARTSWITH)/LIKE/i;
+ }
+ {
#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.
commit ec0a66b2ee21c4cab34b4de89f494088f38baa90
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri May 20 21:25:09 2011 +0400
if operator is 'IS [NOT]' then value is NULL
just force NULL, otherwise it's always a SQL error.
diff --git a/lib/DBIx/SearchBuilder.pm b/lib/DBIx/SearchBuilder.pm
index 493bd46..4731488 100755
--- a/lib/DBIx/SearchBuilder.pm
+++ b/lib/DBIx/SearchBuilder.pm
@@ -835,6 +835,11 @@ sub Limit {
$args{'VALUE'} = "%" . $args{'VALUE'};
}
$args{'OPERATOR'} =~ s/(?:MATCHES|ENDSWITH|STARTSWITH)/LIKE/i;
+
+ if ( $args{'OPERATOR'} !~ /IS/i ) {
+ $args{'VALUE'} = 'NULL';
+ $args{'QUOTEVALUE'} = 0;
+ }
}
{
commit 6016cffc94dd4f7a168cb6b74834f160d1ed680f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat May 21 00:17:08 2011 +0400
if we asked to quote then quote
we processed IS[ NOT] operator earlier and took
care of QUOTEVALUE argument
diff --git a/lib/DBIx/SearchBuilder.pm b/lib/DBIx/SearchBuilder.pm
index 4731488..b1bf459 100755
--- a/lib/DBIx/SearchBuilder.pm
+++ b/lib/DBIx/SearchBuilder.pm
@@ -842,13 +842,11 @@ sub Limit {
}
}
- {
+ if ( $args{'QUOTEVALUE'} ) {
#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 ) {
- $args{'VALUE'} = $self->_Handle->dbh->quote( $args{'VALUE'} );
- }
+ $args{'VALUE'} = $self->_Handle->dbh->quote( $args{'VALUE'} );
}
my $Alias = $self->_GenericRestriction(%args);
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list