From e4041a1245481f3a703022822c88ec3a7c1ea54f Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Wed, 9 Apr 2003 13:15:31 +0000
Subject: [PATCH] Provide user control over Statement's escape processing.
PR: 18822
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274417 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 2 ++
docs/manual/CoreTasks/sql.html | 10 ++++++++++
.../org/apache/tools/ant/taskdefs/SQLExec.java | 18 +++++++++++++++++-
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/WHATSNEW b/WHATSNEW
index 5f8828cc0..88aa531cd 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -223,6 +223,8 @@ Other changes:
* and will now autodetect JavaCC 3.x and can use it.
+* has a new attribute to control escape processing.
+
Changes from Ant 1.5.2 to Ant 1.5.3
===================================
diff --git a/docs/manual/CoreTasks/sql.html b/docs/manual/CoreTasks/sql.html
index 6d7cdc56a..52b3726c5 100644
--- a/docs/manual/CoreTasks/sql.html
+++ b/docs/manual/CoreTasks/sql.html
@@ -139,6 +139,16 @@ and abort execution and transaction and fail task.
No (defaul=false) |
+
+ escapeprocessing |
+ Control whether the Java statement
+ object will perform escape substitution.
+ See Statement's
+ API docs for details. since Ant 1.6.
+ | No (defaul=true) |
+
+
Parameters specified as nested elements
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 0bbc284b2..c2d07c23a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -209,6 +209,13 @@ public class SQLExec extends JDBCTask {
*/
private boolean keepformat = false;
+ /**
+ * Argument to Statement.setEscapeProcessing
+ *
+ * @since Ant 1.6
+ */
+ private boolean escapeProcessing = true;
+
/**
* Set the name of the SQL file to be run.
* Required unless statements are enclosed in the build file
@@ -327,6 +334,15 @@ public class SQLExec extends JDBCTask {
this.keepformat = keepformat;
}
+ /**
+ * Set escape processing for statements.
+ *
+ * @since Ant 1.6
+ */
+ public void setEscapeProcessing(boolean enable) {
+ escapeProcessing = enable;
+ }
+
/**
* Load the sql file and then execute it
*/
@@ -375,7 +391,7 @@ public class SQLExec extends JDBCTask {
}
try {
statement = conn.createStatement();
-
+ statement.setEscapeProcessing(escapeProcessing);
PrintStream out = System.out;
try {