svn commit: r954956 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: condition/EntityFunction.java jdbc/SqlJdbcUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r954956 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: condition/EntityFunction.java jdbc/SqlJdbcUtil.java

doogie-3
Author: doogie
Date: Tue Jun 15 16:40:13 2010
New Revision: 954956

URL: http://svn.apache.org/viewvc?rev=954956&view=rev
Log:
Fix pure toString handling of values that contains "'" in them; this was
hacked to work for functions back in 2007, but it was actually broke in
all cases.  Undid the hack, and made it work correctly.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java?rev=954956&r1=954955&r2=954956&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java Tue Jun 15 16:40:13 2010
@@ -181,8 +181,6 @@ public abstract class EntityFunction<T e
         this.function = function;
         if (value instanceof EntityConditionValue) {
             this.nested = (EntityConditionValue) value;
-        } else if (value instanceof String) {
-            this.value = ((String) value).replaceAll("'", "''");
         } else {
             this.value = value;
         }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=954956&r1=954955&r2=954956&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Tue Jun 15 16:40:13 2010
@@ -941,7 +941,13 @@ public class SqlJdbcUtil {
         if (field != null) {
             buffer.append('?');
         } else {
-            buffer.append('\'').append(value).append('\'');
+            buffer.append('\'');
+            if (value instanceof String) {
+                buffer.append(((String) value).replaceAll("'", "''"));
+            } else {
+                buffer.append(value);
+            }
+            buffer.append('\'');
         }
         if (field != null && params != null) params.add(new EntityConditionParam(field, value));
     }