bodewig 01/04/03 04:32:31
Modified: . WHATSNEW
docs/manual/CoreTasks sql.html
src/main/org/apache/tools/ant/taskdefs SQLExec.java
Log:
Add "REM" to the comment identifiers fro <sql> - even if it's non-standard
Submitted by: Michael McCallum <[EMAIL PROTECTED]>
Revision Changes Path
1.97 +5 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- WHATSNEW 2001/03/29 10:21:10 1.96
+++ WHATSNEW 2001/04/03 11:32:30 1.97
@@ -29,6 +29,11 @@
* <fail> supports nested text
+* <fixcrlf> won't override files that are already in the correct
+ format.
+
+* <sql> now supports REM comments as well as // and --
+
Fixed bugs:
-----------
1.3 +1 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sql.html 2001/02/13 12:31:52 1.2
+++ sql.html 2001/04/03 11:32:30 1.3
@@ -9,7 +9,7 @@
<h3>Description</h3>
<p>Executes a series of sql statement via JDBC to a database. Statements can
either be read in from a text file using the src attribute or from between the
enclosing sql tags.</p>
-<p>Multiple statements can be set and each statement is delimited from the
next use a semi-colon. Individual lines within the statements can be commented
using either -- or // at the start of the line.</p>
+<p>Multiple statements can be set and each statement is delimited from the
next use a semi-colon. Individual lines within the statements can be commented
using either --, // or REM at the start of the line.</p>
<p>The auto-commit attribute specifies whether auto commit should be turned
on or off whilst executing the statements. If auto-commit is turned on each
statement will be executed and committed. If it is turned off the statements
will all be executed as one transaction.</p>
1.16 +9 -4
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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SQLExec.java 2001/01/21 00:41:25 1.15
+++ SQLExec.java 2001/04/03 11:32:31 1.16
@@ -68,9 +68,10 @@
/**
* Reads in a text file containing SQL statements seperated with semicolons
* and executes it in a given db.
- * Both -- and // maybe used as comments.
+ * Comments may be created with REM -- or //.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Martin</a>
+ * @author <A href="[EMAIL PROTECTED]">Michael McCallum</A>
*/
public class SQLExec extends Task {
@@ -425,8 +426,12 @@
try{
while ((line=in.readLine()) != null){
- if (line.trim().startsWith("//")) continue;
- if (line.trim().startsWith("--")) continue;
+ line = line.trim();
+ if (line.startsWith("//")) continue;
+ if (line.startsWith("--")) continue;
+ if ( line.length() > 2 ) {
+ if (line.substring(0,3).equalsIgnoreCase("REM")) continue;
+ }
sql += " " + line;
sql = sql.trim();
@@ -535,7 +540,7 @@
do {
rs = statement.getResultSet();
if (rs != null) {
- log("Processing new result set.", Project.MSG_VERBOSE);
+ log("Processing new result set.", Project.MSG_VERBOSE);
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
StringBuffer line = new StringBuffer();