Jan-Henrik Haukeland wrote:
There is a minor quirk though with SQLite when using PreparedStatement_executeQuery(), if the Connection is used for further statements before it is returned to the pool, you must call Connection_clear() as stated in the latest change log.
- API: Connection_clear() is exposed as a public method. Normally it is not necessary to call this method, but in some situations, if you use PreparedStatement_executeQuery it is necessary to call this function to close a prepared statement explicit. Basically, if you see this SQLite error, "SQL statements in progress", call this function to close any previous opened statements before proceeding.
I've been thinking about this. This implies that you can't use multiple statements within a single transaction (at least with sqlite). Is that correct? Because that would make code like below invalid, right?
PreparedStatement_T s1, s2; ResultSet_T r;
s1 = Connection_PrepareStatement("select data from table where id=?"); s2 = Connection_PrepareStatement("update table set data=? where id=?");
while (iterator) { PreparedStatement_setInt(s1, 1, 1000); r = PreparedStatement_executeQuery(s1); ... if (condition) { PreparedStatement_setInt(s2,1,1000); PreparedStatement_setString(s2,2,"new data"); PreparedStatement_execute(s2); ... } }