From 7dbdd6081851c5a6098e4341731473796a9c24b2 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Mon, 6 Jan 2014 17:51:49 +0000
Subject: [PATCH] =?UTF-8?q?outputencoding=20for=20sql,=20patch=20by=20Miro?=
=?UTF-8?q?slav=20Za=C5=A5ko.=20=20PR=2039541?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1555947 13f79535-47bb-0310-9956-ffa450edef68
---
CONTRIBUTORS | 1 +
WHATSNEW | 3 +++
contributors.xml | 4 ++++
manual/Tasks/sql.html | 6 ++++++
.../apache/tools/ant/taskdefs/SQLExec.java | 21 +++++++++++++++++++
5 files changed, 35 insertions(+)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7e9346fad..a78940d1d 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -254,6 +254,7 @@ Michael Saunders
Miha
Mike Davis
Mike Roberts
+Miroslav Zaťko
mnowostawski
Mounir El Hajj
Nathan Beyer
diff --git a/WHATSNEW b/WHATSNEW
index c41ace5dc..dcc72fd75 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -88,6 +88,9 @@ Other changes:
* now has an option to fail if javadoc issues warnings.
Bugzilla Report 55015
+ * has a new outputencoding attribute.
+ Bugzilla Report 39541
+
Changes from Ant 1.9.2 TO Ant 1.9.3
===================================
diff --git a/contributors.xml b/contributors.xml
index ea1dece85..f37dc7af9 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -1037,6 +1037,10 @@
Mike
Roberts
+
+ Miroslav
+ Zaťko
+
mnowostawski
diff --git a/manual/Tasks/sql.html b/manual/Tasks/sql.html
index 84dc1279d..e5f4db837 100644
--- a/manual/Tasks/sql.html
+++ b/manual/Tasks/sql.html
@@ -90,6 +90,12 @@ and abort execution and transaction and fail task.
The encoding of the files containing SQL statements |
No - defaults to default JVM encoding |
+
+ outputencoding |
+ The encoding of the files holding
+ results. since 1.9.4
+ | No - defaults to default JVM encoding |
+
delimiter |
String that separates SQL statements |
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 576ececc7..f1c75c4d2 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -162,6 +162,11 @@ public class SQLExec extends JDBCTask {
*/
private Resource output = null;
+ /**
+ * Output encoding.
+ */
+ private String outputEncoding = null;
+
/**
* Action to perform if an error is found
*/
@@ -428,6 +433,17 @@ public class SQLExec extends JDBCTask {
this.output = output;
}
+ /**
+ * The encoding to use when writing the result to a resource.
+ * Default's to the platform's default encoding
+ * @param outputEncoding the name of the encoding or null for the
+ * platform's default encoding
+ * @since Ant 1.9.4
+ */
+ public void setOutputEncoding(String outputEncoding) {
+ this.outputEncoding = outputEncoding;
+ }
+
/**
* whether output should be appended to or overwrite
* an existing file. Defaults to false.
@@ -641,7 +657,12 @@ public class SQLExec extends JDBCTask {
}
}
}
+ if (outputEncoding != null) {
+ out = new PrintStream(new BufferedOutputStream(os),
+ false, outputEncoding);
+ } else {
out = new PrintStream(new BufferedOutputStream(os));
+ }
}
// Process all transactions