cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From evg...@apache.org
Subject svn commit: r998059 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
Date Fri, 17 Sep 2010 10:34:03 GMT
Author: evgeny
Date: Fri Sep 17 10:34:02 2010
New Revision: 998059

URL: http://svn.apache.org/viewvc?rev=998059&view=rev
Log:
CAY-1470 Oracle: Problem with bind CHAR in select
add testcase to this problem

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java?rev=998059&r1=998058&r2=998059&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateTest.java
Fri Sep 17 10:34:02 2010
@@ -48,6 +48,32 @@ public class SQLTemplateTest extends Cay
         context = createDataContext();
     }
 
+    public void testBindCHARInWHERE() {
+        // add 2 Artists
+        DataMap testDataMap = context.getEntityResolver().getDataMap("testmap");
+        SQLTemplate q1 = new SQLTemplate(
+                testDataMap,
+                "INSERT INTO ARTIST VALUES (1, 'Surikov', null)",
+                true);
+        SQLTemplate q2 = new SQLTemplate(
+                testDataMap,
+                "INSERT INTO ARTIST VALUES (2, 'Shishkin', null)",
+                true);
+        QueryChain chain = new QueryChain();
+        chain.addQuery(q1);
+        chain.addQuery(q2);
+        context.performNonSelectingQuery(chain);
+        // now select one Artist by Name, It's matter that ARTIST_NAME is CHAR not VARCHAR
+        SQLTemplate s1 = new SQLTemplate(
+                testDataMap,
+                "SELECT * FROM ARTIST WHERE ARTIST_NAME = #bind($ARTIST_NAME)",
+                true);
+        //whitespace after name is for reason
+        s1.setParameters(Collections.singletonMap("ARTIST_NAME", "Surikov "));
+        List<DataRow> result = context.performQuery(s1);
+        assertEquals(1, result.size());
+    }
+
     public void testSQLTemplateForDataMap() {
         DataMap testDataMap = context.getEntityResolver().getDataMap("testmap");
         SQLTemplate q1 = new SQLTemplate(testDataMap, "SELECT * FROM ARTIST", true);



Mime
View raw message