Bugfix for new SqLite version

This commit is contained in:
Ziver Koc 2024-09-26 00:30:28 +02:00
parent 1e813d65ca
commit 1de26a7240
2 changed files with 3 additions and 2 deletions

View file

@ -142,7 +142,7 @@ public class DBConnection implements Closeable{
ResultSet result = null; ResultSet result = null;
try { try {
result = stmt.getGeneratedKeys(); result = stmt.getGeneratedKeys();
if (result != null) { if (result != null && !result.isBeforeFirst()) {
return new SimpleSQLResult<Integer>().handleQueryResult(stmt, result); return new SimpleSQLResult<Integer>().handleQueryResult(stmt, result);
} }
} catch (SQLException e) { } catch (SQLException e) {

View file

@ -37,10 +37,11 @@ import java.sql.Statement;
*/ */
public class SimpleSQLResult<T> implements SQLResultHandler<T> { public class SimpleSQLResult<T> implements SQLResultHandler<T> {
/** /**
* Is called to handle an result from an query. * Is called to return the first data generated by a query.
* *
* @param stmt is the query * @param stmt is the query
* @param result is the ResultSet * @param result is the ResultSet
* @return first value of the given query or null if the query returned no result.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public T handleQueryResult(Statement stmt, ResultSet result) throws SQLException{ public T handleQueryResult(Statement stmt, ResultSet result) throws SQLException{