Hi,

We've come across a situation where we think there is a bug in the sqlite3_reset() function. The documentation states:

"Any SQL statement variables that had values bound to them using the sqlite3_bind_*() API retain their values"

The behaviour we are seeing appears to contradict this statement. I've attached a very simple example of searching for a few rows in a database. To run the example, create a database (test.db) with the following schema:

CREATE table test ( id INTEGER PRIMARY KEY, value INTEGER NOT NULL );
INSERT INTO test VALUES ( 1, 4 );
INSERT INTO test VALUES ( 2, 5 );
INSERT INTO test VALUES ( 3, 6 );

In the example code, notice that the call to sqlite3_reset() comes after the call to sqlite3_bind_int64(). When running the example, it will return the first row all three times. It seems that the call to sqlite3_reset() actually resets the binded variable to the value it had at the last call to sqlite3_step().

Is this a bug? Or is it intended behaviour? If it's intended, I recommend updating the documentation to be clear about this behaviour.

Thanks for any insight anyone can provide.

Joe

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to