[Bps-public-commit] dbix-searchbuilder branch, master, updated. 9c26a57b8c88f1a26fe2cca50d4b9c853c00b08d

Ruslan Zakirov ruz at bestpractical.com
Thu Mar 25 11:45:38 EDT 2010


The branch, master has been updated
       via  9c26a57b8c88f1a26fe2cca50d4b9c853c00b08d (commit)
      from  f70ca489072bf4d2a576cf8931cbbe29f304ae6f (commit)

Summary of changes:
 Changes                    |    4 ++++
 SearchBuilder/Handle.pm    |    4 +++-
 SearchBuilder/Handle/Pg.pm |    2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 9c26a57b8c88f1a26fe2cca50d4b9c853c00b08d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 25 18:44:29 2010 +0300

    unify set of case insensitive patch and fix generic case

diff --git a/Changes b/Changes
index 093c85f..6499241 100755
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Perl extension DBIx::SearchBuilder.
 
+1.56
+
+* unify case insensitive characters
+
 1.56_01 Thu Mar 25 03:00:19 UTC 2010
 
 * INCOMPATIBLE CHANGE: NextPage and PrevPage were adding rows from
diff --git a/SearchBuilder/Handle.pm b/SearchBuilder/Handle.pm
index 0cc1d39..4585a20 100755
--- a/SearchBuilder/Handle.pm
+++ b/SearchBuilder/Handle.pm
@@ -672,6 +672,8 @@ Returns a FIELD OPERATOR VALUE triple.
 
 =cut
 
+our $RE_CASE_INSENSITIVE_CHARS = qr/[-'"\d: ]/;
+
 sub _MakeClauseCaseInsensitive {
     my $self = shift;
     my $field = shift;
@@ -679,7 +681,7 @@ sub _MakeClauseCaseInsensitive {
     my $value = shift;
 
     # don't downcase integer values and things that looks like dates
-    if ($value !~ /^['"]?[-\d: ]+['"]$/) {
+    if ($value !~ /^$RE_CASE_INSENSITIVE_CHARS+$/o) {
         $field = "lower($field)";
         $value = lc($value);
     }
diff --git a/SearchBuilder/Handle/Pg.pm b/SearchBuilder/Handle/Pg.pm
index 5dec864..94edea5 100755
--- a/SearchBuilder/Handle/Pg.pm
+++ b/SearchBuilder/Handle/Pg.pm
@@ -189,7 +189,7 @@ sub _MakeClauseCaseInsensitive {
     my $value    = shift;
 
     # we don't need to downcase numeric values and dates
-    if ($value =~ /^['"]?[-\d: ]+['"]?$/) {
+    if ($value =~ /^$DBIx::SearchBuilder::RE_CASE_INSENSITIVE_CHARS+$/o) {
         	return ( $field, $operator, $value);
     }
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list