Merge pull request #55 from antville/54-add-support-for-prepared-sql-statements-to-databaseobject

Add DatabaseObject.executePreparedRetrieval() method
This commit is contained in:
Tobi Schäfer 2023-03-05 13:10:25 +01:00 committed by GitHub
commit db2ebbed9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -216,6 +216,23 @@ public class DatabaseObject {
} }
} }
public RowSet executePreparedRetrieval(PreparedStatement statement) {
ResultSet resultSet = null;
try {
resultSet = statement.executeQuery();
return new RowSet(statement.toString(), this, statement, resultSet);
} catch (SQLException e) {
lastError = e;
try {
if (statement != null) statement.close();
} catch (Exception ignored) {
}
statement = null;
return null;
}
}
public int executeCommand(String sql) { public int executeCommand(String sql) {
int count = 0; int count = 0;