Browse Source

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
master
Stefan Bodewig 22 years ago
parent
commit
e4041a1245
3 changed files with 29 additions and 1 deletions
  1. +2
    -0
      WHATSNEW
  2. +10
    -0
      docs/manual/CoreTasks/sql.html
  3. +17
    -1
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 2
- 0
WHATSNEW View File

@@ -223,6 +223,8 @@ Other changes:


* <javacc> and <jjtree> will now autodetect JavaCC 3.x and can use it. * <javacc> and <jjtree> will now autodetect JavaCC 3.x and can use it.


* <sql> has a new attribute to control escape processing.

Changes from Ant 1.5.2 to Ant 1.5.3 Changes from Ant 1.5.2 to Ant 1.5.3
=================================== ===================================




+ 10
- 0
docs/manual/CoreTasks/sql.html View File

@@ -139,6 +139,16 @@ and <b>abort</b> execution and transaction and fail task.</p>
<td width="10%" valign="top">No (defaul=false)</td> <td width="10%" valign="top">No (defaul=false)</td>
</tr> </tr>


<tr>
<td width="12%" valign="top">escapeprocessing</td>
<td width="78%" valign="top">Control whether the Java statement
object will perform escape substitution.<br>
See <a
href="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#setEscapeProcessing(boolean)">Statement's
API docs</a> for details. <em>since Ant 1.6</em>.
<td width="10%" valign="top">No (defaul=true)</td>
</tr>

</table> </table>


<h3>Parameters specified as nested elements</h3> <h3>Parameters specified as nested elements</h3>


+ 17
- 1
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -209,6 +209,13 @@ public class SQLExec extends JDBCTask {
*/ */
private boolean keepformat = false; 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. * Set the name of the SQL file to be run.
* Required unless statements are enclosed in the build file * Required unless statements are enclosed in the build file
@@ -327,6 +334,15 @@ public class SQLExec extends JDBCTask {
this.keepformat = keepformat; 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 * Load the sql file and then execute it
*/ */
@@ -375,7 +391,7 @@ public class SQLExec extends JDBCTask {
} }
try { try {
statement = conn.createStatement(); statement = conn.createStatement();
statement.setEscapeProcessing(escapeProcessing);
PrintStream out = System.out; PrintStream out = System.out;
try { try {


Loading…
Cancel
Save