Hi,

Added handling for REM comments.

Michael

p.s.

This is included in my next patch as well.


Index: src/main/org/apache/tools/ant/taskdefs/SQLExec.java
===================================================================
RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.15
diff -c -r1.15 SQLExec.java
*** src/main/org/apache/tools/ant/taskdefs/SQLExec.java 2001/01/21 00:41:25     
1.15
--- src/main/org/apache/tools/ant/taskdefs/SQLExec.java 2001/03/26 21:08:09
***************
*** 68,76 ****
  /**
   * Reads in a text file containing SQL statements seperated with semicolons
   * and executes it in a given db.
!  * Both -- and // maybe used as comments.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Martin</a>
   */
  public class SQLExec extends Task {
      
--- 68,77 ----
  /**
   * Reads in a text file containing SQL statements seperated with semicolons
   * and executes it in a given db.
!  * 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,432 ****
   
          try{
              while ((line=in.readLine()) != null){
!                 if (line.trim().startsWith("//")) continue;
!                 if (line.trim().startsWith("--")) continue;
  
                  sql += " " + line;
                  sql = sql.trim();
--- 426,437 ----
   
          try{
              while ((line=in.readLine()) != null){
!                 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,541 ****
          do {
              rs = statement.getResultSet();
              if (rs != null) {
!                       log("Processing new result set.", Project.MSG_VERBOSE);
                  ResultSetMetaData md = rs.getMetaData();
                  int columnCount = md.getColumnCount();
                  StringBuffer line = new StringBuffer();
--- 540,546 ----
          do {
              rs = statement.getResultSet();
              if (rs != null) {
!                 log("Processing new result set.", Project.MSG_VERBOSE);
                  ResultSetMetaData md = rs.getMetaData();
                  int columnCount = md.getColumnCount();
                  StringBuffer line = new StringBuffer();

Reply via email to