[#843] Changed how SQL is executed:

- Now only UPDATE, INSERT, DELETE & REPLACE statements are executed
  using executeUpdate. Rest is executed using execute.
- This fixes database patching on 1.13.2 (SQLite 3.25.0 or newer)
This commit is contained in:
Rsl1122 2018-12-14 17:00:37 +02:00
parent 2e44b67f7a
commit a4395c9076

View File

@ -34,13 +34,22 @@ public abstract class ExecStatement extends AbstractSQLStatement {
startBenchmark(); startBenchmark();
try { try {
prepare(statement); prepare(statement);
return statement.executeUpdate() > 0; return callExecute(statement);
} finally { } finally {
statement.close(); statement.close();
stopBenchmark(); stopBenchmark();
} }
} }
private boolean callExecute(PreparedStatement statement) throws SQLException {
if (sql.startsWith("UPDATE") || sql.startsWith("INSERT") || sql.startsWith("DELETE") || sql.startsWith("REPLACE")) {
return statement.executeUpdate() > 0;
} else {
statement.execute();
return false;
}
}
public void executeBatch(PreparedStatement statement) throws SQLException { public void executeBatch(PreparedStatement statement) throws SQLException {
startBatchBenchmark(); startBatchBenchmark();
try { try {