diff --git a/src/zutil/db/DBConnection.java b/src/zutil/db/DBConnection.java index 836f709..5660c63 100755 --- a/src/zutil/db/DBConnection.java +++ b/src/zutil/db/DBConnection.java @@ -142,7 +142,7 @@ public class DBConnection implements Closeable{ ResultSet result = null; try { result = stmt.getGeneratedKeys(); - if (result != null) { + if (result != null && !result.isBeforeFirst()) { return new SimpleSQLResult().handleQueryResult(stmt, result); } } catch (SQLException e) { diff --git a/src/zutil/db/handler/SimpleSQLResult.java b/src/zutil/db/handler/SimpleSQLResult.java index a74ea31..6f6852c 100755 --- a/src/zutil/db/handler/SimpleSQLResult.java +++ b/src/zutil/db/handler/SimpleSQLResult.java @@ -37,10 +37,11 @@ import java.sql.Statement; */ public class SimpleSQLResult implements SQLResultHandler { /** - * 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 result is the ResultSet + * @return first value of the given query or null if the query returned no result. */ @SuppressWarnings("unchecked") public T handleQueryResult(Statement stmt, ResultSet result) throws SQLException{