Browse Source

Changed the execSQL method. Interbase's JDBC driver will throw an

SQLException in executeQuery if the query doesn't return a ResultSet.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267829 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
e87e8fc113
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 7
- 4
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -180,7 +180,7 @@ public class SQLExec extends Task {
Statement statement = null;

try{
log("connectiing to " + url, Project.MSG_VERBOSE );
log("connecting to " + url, Project.MSG_VERBOSE );
conn = DriverManager.getConnection(url, userId, password);
statement = conn.createStatement();

@@ -227,10 +227,13 @@ public class SQLExec extends Task {
}

/**
* Exec the sql statement.
*/
* Exec the sql statement.
*/
private void execSQL(Statement statement, String sql) throws SQLException{
statement.executeQuery(sql);
if (!statement.execute(sql)) {
log(statement.getUpdateCount()+" row affected",
Project.MSG_VERBOSE);
}
}

}

Loading…
Cancel
Save