sqlite-jdbc icon indicating copy to clipboard operation
sqlite-jdbc copied to clipboard

NullPointerException by getUpdateCount()

Open dbschema-pro opened this issue 1 year ago • 0 comments

I execute different statements using boolean ret = statement.execute(query); I cannot know ahead which is the query. Next I call: if ( !ret ) cnt = statement.getUpdateCount()

This shouldn't trigger any exception. The documentation says: Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. This method should be called only once per result.

java.lang.NullPointerException: Cannot invoke "org.sqlite.core.SafeStmtPtr.isClosed()" because "this.pointer" is null at org.sqlite.jdbc3.JDBC3Statement.getLargeUpdateCount(JDBC3Statement.java:199) at org.sqlite.jdbc3.JDBC3Statement.getUpdateCount(JDBC3Statement.java:188) at com.wisecoders.dbs.dbms.connect.model.envoy.GeneralToResultStatement.execute(GeneralToResultStatement.java:72) at com.wisecoders.dbs.dbms.connect.model.envoy.Envoy.execute(Envoy.java:392) at com.wisecoders.dbs.data.fx.FxAbstractSqlEditor$1.call(FxAbstractSqlEditor.java:125) at com.wisecoders.dbs.data.fx.FxAbstractSqlEditor$1.call(FxAbstractSqlEditor.java:117)

dbschema-pro avatar Jun 14 '24 18:06 dbschema-pro