Browse Source

outputencoding for sql, patch by Miroslav Zaťko. PR 39541

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1555947 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 11 years ago
parent
commit
7dbdd60818
5 changed files with 35 additions and 0 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +6
    -0
      manual/Tasks/sql.html
  5. +21
    -0
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 1
- 0
CONTRIBUTORS View File

@@ -254,6 +254,7 @@ Michael Saunders
Miha Miha
Mike Davis Mike Davis
Mike Roberts Mike Roberts
Miroslav Zaťko
mnowostawski mnowostawski
Mounir El Hajj Mounir El Hajj
Nathan Beyer Nathan Beyer


+ 3
- 0
WHATSNEW View File

@@ -88,6 +88,9 @@ Other changes:
* <javadoc> now has an option to fail if javadoc issues warnings. * <javadoc> now has an option to fail if javadoc issues warnings.
Bugzilla Report 55015 Bugzilla Report 55015


* <sql> has a new outputencoding attribute.
Bugzilla Report 39541

Changes from Ant 1.9.2 TO Ant 1.9.3 Changes from Ant 1.9.2 TO Ant 1.9.3
=================================== ===================================




+ 4
- 0
contributors.xml View File

@@ -1037,6 +1037,10 @@
<first>Mike</first> <first>Mike</first>
<last>Roberts</last> <last>Roberts</last>
</name> </name>
<name>
<first>Miroslav</first>
<last>Zaťko</last>
</name>
<name> <name>
<last>mnowostawski</last> <last>mnowostawski</last>
</name> </name>


+ 6
- 0
manual/Tasks/sql.html View File

@@ -90,6 +90,12 @@ and <b>abort</b> execution and transaction and fail task.</p>
<td valign="top">The encoding of the files containing SQL statements</td> <td valign="top">The encoding of the files containing SQL statements</td>
<td align="center">No - defaults to default JVM encoding</td> <td align="center">No - defaults to default JVM encoding</td>
</tr> </tr>
<tr>
<td valign="top">outputencoding</td>
<td valign="top">The encoding of the files holding
results. <em>since 1.9.4</em</td>
<td align="center">No - defaults to default JVM encoding</td>
</tr>
<tr> <tr>
<td width="12%" valign="top">delimiter</td> <td width="12%" valign="top">delimiter</td>
<td width="78%" valign="top">String that separates SQL statements</td> <td width="78%" valign="top">String that separates SQL statements</td>


+ 21
- 0
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -162,6 +162,11 @@ public class SQLExec extends JDBCTask {
*/ */
private Resource output = null; private Resource output = null;


/**
* Output encoding.
*/
private String outputEncoding = null;

/** /**
* Action to perform if an error is found * Action to perform if an error is found
*/ */
@@ -428,6 +433,17 @@ public class SQLExec extends JDBCTask {
this.output = output; this.output = output;
} }


/**
* The encoding to use when writing the result to a resource.
* <p>Default's to the platform's default encoding</p>
* @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 * whether output should be appended to or overwrite
* an existing file. Defaults to false. * 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)); out = new PrintStream(new BufferedOutputStream(os));
}
} }


// Process all transactions // Process all transactions


Loading…
Cancel
Save