SQLExec currently hard-codes ";" as the delimiter of SQL statements, which
means that I can't define Oracle stored-procedures (I have to resort to
exec'ing SQLPlus).
Here's a suggested patch that allows an alternative delimiter (e.g. "/") to
be used:
Index: src/main/org/apache/tools/ant/taskdefs/SQLExec.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.16
diff -u -b -r1.16 SQLExec.java
--- src/main/org/apache/tools/ant/taskdefs/SQLExec.java 2001/04/03 11:32:31 1.16
+++ src/main/org/apache/tools/ant/taskdefs/SQLExec.java 2001/05/08 00:51:11
@@ -132,6 +132,11 @@
private Vector transactions = new Vector();
/**
+ * SQL Statement delimiter
+ */
+ private String delimiter = ";";
+
+ /**
* Print SQL results.
*/
private boolean print = false;
@@ -248,6 +253,13 @@
}
/**
+ * Set the statement delimiter.
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
* Set the print flag.
*/
public void setPrint(boolean print) {
@@ -441,7 +453,7 @@
// so we cannot just remove it, instead we must end it
if (line.indexOf("--") >= 0) sql += "\n";
- if (sql.endsWith(";")){
+ if (sql.endsWith(delimiter)){
log("SQL: " + sql, Project.MSG_VERBOSE);
execSQL(sql.substring(0, sql.length()-1), out);
sql = "";
--
cheers,
Mike