You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/07/23 01:14:52 UTC
[groovy] branch GROOVY-9637 updated: Fix the compilation error in
the class `Sql`
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY-9637
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY-9637 by this push:
new 5fd0574 Fix the compilation error in the class `Sql`
5fd0574 is described below
commit 5fd0574033b42b35854ecd584dd767818389a8ac
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Jul 23 09:14:09 2020 +0800
Fix the compilation error in the class `Sql`
---
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
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 7c8b96a..29fc5b0 100644
--- a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
+++ b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
@@ -28,7 +28,6 @@ import groovy.transform.stc.SimpleType;
import org.codehaus.groovy.runtime.InvokerHelper;
import javax.sql.DataSource;
-
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -4009,16 +4008,16 @@ public class Sql implements AutoCloseable {
* @see #expand(Object)
*/
protected String asSql(GString gstring, List<Object> values) {
- String[] strings = gstring.getStrings();
- if (strings.length <= 0) {
+ List<String> strings = gstring.getStrings();
+ if (strings.size() <= 0) {
throw new IllegalArgumentException("No SQL specified in GString: " + gstring);
}
boolean nulls = false;
StringBuilder buffer = new StringBuilder();
boolean warned = false;
Iterator<Object> iter = values.iterator();
- for (int i = 0; i < strings.length; i++) {
- String text = strings[i];
+ for (int i = 0; i < strings.size(); i++) {
+ String text = strings.get(i);
if (text != null) {
buffer.append(text);
}
@@ -4030,8 +4029,8 @@ public class Sql implements AutoCloseable {
iter.remove();
} else {
boolean validBinding = true;
- if (i < strings.length - 1) {
- String nextText = strings[i + 1];
+ if (i < strings.size() - 1) {
+ String nextText = strings.get(i + 1);
if ((text.endsWith("\"") || text.endsWith("'")) && (nextText.startsWith("'") || nextText.startsWith("\""))) {
if (!warned) {
LOG.warning("In Groovy SQL please do not use quotes around dynamic expressions " +