You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Edgar Gonzalez <eg...@valhallaproject.com> on 2002/01/10 18:29:36 UTC

[PATCH] Fixes to BasePeer.createQueryString and BasePeer.createPreparedStatement related to Criteria.isIgnoreCase()

DESCRIPTION:

The following patch is related to the treatement of Criteria.isIgnoreCase() by BasePeer.createQueryString()
and BasePeer.createPreparedStatement().

In the current code (before patch) the Criteria.isIgnoreCase() value ALWAYS overwrite the previous values of
the Criterions.isIgnoreCase(). So if you have a Criteria which isIgnoreCase()==false and you add a Criterion
which isIgnoreCase()==true, when the BasePeer.createQueryString() or BasePeer.createPreparedStatement()
will be executed, the Criterion.isIgnoreCase() will be false.

With this patch the Criteria.isIgnoreCase() value overwrite the previous value of the Criterions.isIgnoreCase()
ONLY when Criteria.isIgnoreCase()==true.

 
Edgar Gonzalez



Index: BasePeer.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/om/peer/BasePeer.java,v
retrieving revision 1.4
diff -u -r1.4 BasePeer.java
--- BasePeer.java 12 Oct 2001 22:35:11 -0000 1.4
+++ BasePeer.java 10 Jan 2002 15:21:34 -0000
@@ -994,7 +994,7 @@
                     table = tableName;
                 }
 
-                boolean ignorCase = (criteria.isIgnoreCase() &&
+                boolean ignorCase = ( (criteria.isIgnoreCase() || someCriteria[i].isIgnoreCase()) &&
                     (dbMap.getTable(table).getColumn(
                     someCriteria[i].getColumn()).getType() instanceof String));
 
@@ -2053,7 +2053,7 @@
                     table = tableName;
                 }
 
-                boolean ignorCase = (criteria.isIgnoreCase() &&
+                boolean ignorCase = ( (criteria.isIgnoreCase() || someCriteria[i].isIgnoreCase() ) &&
                     (dbMap.getTable(table).getColumn(
                     someCriteria[i].getColumn()).getType() instanceof String));