groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: GROOVY-8174: Groovy.Sql+Oracle parameter substitution problem (log instead of throwing exception since current drivers aren't consistent enough)
Date Thu, 15 Jun 2017 23:49:39 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X c3b6a1212 -> 8e6cccdbc


GROOVY-8174: Groovy.Sql+Oracle parameter substitution problem (log instead of throwing exception
since current drivers aren't consistent enough)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/8e6cccdb
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/8e6cccdb
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/8e6cccdb

Branch: refs/heads/GROOVY_2_5_X
Commit: 8e6cccdbcf097873aa25e2b46532beca5a4dc262
Parents: c3b6a12
Author: paulk <paulk@asert.com.au>
Authored: Fri Jun 16 02:09:35 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Fri Jun 16 09:49:25 2017 +1000

----------------------------------------------------------------------
 subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java |  5 ++---
 .../src/test/groovy/groovy/sql/SqlCompleteTest.groovy    | 11 ++++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/8e6cccdb/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
index 87b3df6..1eb6ccc 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
@@ -4150,9 +4150,8 @@ public class Sql {
                 Map paramsMap = (Map) params.get(0);
                 if (paramsMap.isEmpty()) return;
             }
-            if (metaData.getParameterCount() < params.size()) {
-                throw new IllegalArgumentException("Found " + metaData.getParameterCount()
+ " parameter placeholders but supplied with " + params.size() + " parameters");
-            } else if (metaData.getParameterCount() != params.size()) {
+            // GROOVY-8174: we'd like stricter checking here but many drivers currently in
use just aren't consistent enough, so we log
+            if (metaData.getParameterCount() != params.size()) {
                 LOG.warning("Found " + metaData.getParameterCount() + " parameter placeholders
but supplied with " + params.size() + " parameters");
             }
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/8e6cccdb/subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCompleteTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCompleteTest.groovy b/subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCompleteTest.groovy
index 7ee8705..ad399d9 100644
--- a/subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCompleteTest.groovy
+++ b/subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCompleteTest.groovy
@@ -146,11 +146,12 @@ class SqlCompleteTest extends SqlHelperTestCase {
         assert results.collectEntries{ [it.firstname, it.lastname] } == ["James": "Strachan",
"Sam": "Pullara"]
     }
 
-    void testRowsWithIncorrectNumberOfParams() {
-        shouldFail(IllegalArgumentException) {
-            sql.rows("select * from PERSON where firstname like ? and lastname like ?", ['foo',
'bar', 'baz'])
-        }
-    }
+    // GROOVY-8174: we'd like a strict test like this but current drivers aren't up to it
+//    void testRowsWithIncorrectNumberOfParams() {
+//        shouldFail(IllegalArgumentException) {
+//            sql.rows("select * from PERSON where firstname like ? and lastname like ?",
['foo', 'bar', 'baz'])
+//        }
+//    }
 
     void testRowsWithIncorrectParam() {
         shouldFail(IllegalArgumentException) {


Mime
View raw message