Author: doogie
Date: Tue Nov 17 08:31:30 2009
New Revision: 881193
URL:
http://svn.apache.org/viewvc?rev=881193&view=revLog:
Implement parameterized value conversion.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java
ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java?rev=881193&r1=881192&r2=881193&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java Tue Nov 17 08:31:30 2009
@@ -37,6 +37,7 @@
import org.ofbiz.sql.Joiner;
import org.ofbiz.sql.NumberValue;
import org.ofbiz.sql.ParameterizedConditionException;
+import org.ofbiz.sql.ParameterValue;
import org.ofbiz.sql.StringValue;
import org.ofbiz.sql.Value;
@@ -80,6 +81,11 @@
values.add(buildValue(sqlValue, params));
}
return values;
+ } else if (value instanceof ParameterValue) {
+ if (params == null) {
+ throw new ParameterizedConditionException();
+ }
+ return params.get(((ParameterValue) value).getName());
}
throw new UnsupportedOperationException(value.toString());
}
Modified: ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy?rev=881193&r1=881192&r2=881193&view=diff==============================================================================
--- ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy (original)
+++ ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy Tue Nov 17 08:31:30 2009
@@ -25,7 +25,7 @@
Party a LEFT JOIN Person b USING partyId LEFT JOIN PartyGroup c USING partyId
RELATION TYPE one Party USING partyId
WHERE
- partyId = 'admin'
+ partyId = ?partyId
;
"""
def sqlSelect = SQLUtil.parseSelect(sql)
@@ -33,7 +33,7 @@
TransactionUtil.doNewTransaction("Test", [call: {
def eli
try {
- eli = sqlSelect.getEntityListIterator(delegator, null)
+ eli = sqlSelect.getEntityListIterator(delegator, [partyId: 'admin'])
def gv;
while ((gv = eli.next()) != null) {
response.writer.println("gv=$gv<br />")