|
@@ -68,9 +68,10 @@ import java.sql.*; |
|
|
/** |
|
|
/** |
|
|
* Reads in a text file containing SQL statements seperated with semicolons |
|
|
* Reads in a text file containing SQL statements seperated with semicolons |
|
|
* and executes it in a given db. |
|
|
* and executes it in a given db. |
|
|
* Both -- and // maybe used as comments. |
|
|
|
|
|
|
|
|
* Comments may be created with REM -- or //. |
|
|
* |
|
|
* |
|
|
* @author <a href="mailto:jeff@custommonkey.org">Jeff Martin</a> |
|
|
* @author <a href="mailto:jeff@custommonkey.org">Jeff Martin</a> |
|
|
|
|
|
* @author <A href="gholam@xtra.co.nz">Michael McCallum</A> |
|
|
*/ |
|
|
*/ |
|
|
public class SQLExec extends Task { |
|
|
public class SQLExec extends Task { |
|
|
|
|
|
|
|
@@ -425,8 +426,12 @@ public class SQLExec extends Task { |
|
|
|
|
|
|
|
|
try{ |
|
|
try{ |
|
|
while ((line=in.readLine()) != null){ |
|
|
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 += " " + line; |
|
|
sql = sql.trim(); |
|
|
sql = sql.trim(); |
|
@@ -535,7 +540,7 @@ public class SQLExec extends Task { |
|
|
do { |
|
|
do { |
|
|
rs = statement.getResultSet(); |
|
|
rs = statement.getResultSet(); |
|
|
if (rs != null) { |
|
|
if (rs != null) { |
|
|
log("Processing new result set.", Project.MSG_VERBOSE); |
|
|
|
|
|
|
|
|
log("Processing new result set.", Project.MSG_VERBOSE); |
|
|
ResultSetMetaData md = rs.getMetaData(); |
|
|
ResultSetMetaData md = rs.getMetaData(); |
|
|
int columnCount = md.getColumnCount(); |
|
|
int columnCount = md.getColumnCount(); |
|
|
StringBuffer line = new StringBuffer(); |
|
|
StringBuffer line = new StringBuffer(); |
|
|