conor 01/09/19 05:06:12
Modified: src/main/org/apache/tools/ant/taskdefs SQLExec.java
docs/manual/CoreTasks sql.html
Log:
Add an encoding attribute so SQL statements can be double byte
PR: 3080
Revision Changes Path
1.23 +17 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
Index: SQLExec.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -u -r1.22 -r1.23
--- SQLExec.java 2001/08/01 15:33:42 1.22
+++ SQLExec.java 2001/09/19 12:06:11 1.23
@@ -185,6 +185,11 @@
private String onError = "abort";
/**
+ * Encoding to use when reading SQL statements from a file
+ */
+ private String encoding = null;
+
+ /**
* Set the classpath for loading the driver.
*/
public void setClasspath(Path classpath) {
@@ -265,6 +270,16 @@
}
/**
+ * Set the file encoding to use on the sql files read in
+ *
+ * @param encoding the encoding to use on the files
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+
+ /**
* Set the password for the DB connection.
*/
public void setPassword(String password) {
@@ -684,7 +699,8 @@
if (tSrcFile != null) {
log("Executing file: " + tSrcFile.getAbsolutePath(),
Project.MSG_INFO);
- FileReader reader = new FileReader(tSrcFile);
+ Reader reader = (encoding == null) ? new FileReader(tSrcFile)
+ : new
InputStreamReader(new FileInputStream(tSrcFile), encoding);
runStatements(reader, out);
reader.close();
}
1.6 +5 -0 jakarta-ant/docs/manual/CoreTasks/sql.html
Index: sql.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/sql.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- sql.html 2001/08/30 13:23:13 1.5
+++ sql.html 2001/09/19 12:06:11 1.6
@@ -59,6 +59,11 @@
<td width="10%" valign="top">Yes, unless statements enclosed within
tags</td>
</tr>
<tr>
+ <td valign="top">encoding</td>
+ <td valign="top">The encoding of the files containing SQL statements</td>
+ <td align="center">No - defaults to default JVM encoding</td>
+</tr>
+<tr>
<td width="12%" valign="top">delimiter</td>
<td width="78%" valign="top">String that separates SQL statements</td>
<td width="10%" valign="top">No, default ";"</td>