Note also that you do not need to do an sqlite3_reset after sqlite3_step returns SQLITE_DONE as reset is called automatically the next time you call sqlite3_step. You only need to call sqlite3_reset if you want to reset the statement before all the rows have been retrieved (this is documented somewhere, and I believe there is a compile time #define to turn off the auto-reset). Yes, it is documented in the sqlite3_step documentation
"For all versions of SQLite up to and including 3.6.23.1, a call to sqlite3_reset() was required after sqlite3_step() returned anything other than SQLITE_ROW before any subsequent invocation of sqlite3_step(). Failure to reset the prepared statement using sqlite3_reset() would result in an SQLITE_MISUSE return from sqlite3_step(). But after version 3.6.23.1 (2010-03-26, sqlite3_step() began calling sqlite3_reset() automatically in this circumstance rather than returning SQLITE_MISUSE. This is not considered a compatibility break because any application that ever receives an SQLITE_MISUSE error is broken by definition. The SQLITE_OMIT_AUTORESET compile-time option can be used to restore the legacy behavior." Neither the automatic nor the manual sqlite3_reset reset any bindings -- if you want to do this I believe you must call the sqlite3_clear_bindings() --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Monday, 4 June, 2018 11:06 >To: SQLite mailing list >Subject: Re: [sqlite] Reset the cursor > > >>Currently running w/MSVC 2010 under Win 8.1. > >>I also presume you are testing under the latest SQLite source? > >Yes, I believe so ... >SQLite 3.24.0 2018-06-02 19:14:58 >1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4alt2 > >Using GCC (MinGW-w64 8.1.0) on Windows 10 Pro for Workstations >version 1803 build 17134.81 (current) > >MSVC (the one I have, I think VS 2008) also works fine ... though the >.dll is still compiled with GCC MinGW-w64 8.1.0 (with -O3 and then >some). > >Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 >for 80x86 >Copyright (C) Microsoft Corporation. All rights reserved. > >test.c >Microsoft (R) Incremental Linker Version 9.00.21022.08 >Copyright (C) Microsoft Corporation. All rights reserved. > >/out:test.exe >test.obj >sqlite3.lib > > >2018-06-04 10:59:24 MinGW [D:\work] >>test.exe > >Loop 1, no reset >1 2 3 4 5 6 7 8 9 10 ! >sqlite3_reset returns 0 > >Loop 2, after reset >1 2 3 4 5 6 7 8 9 10 ! >sqlite3_reset returns 0 > >--- >The fact that there's a Highway to Hell but only a Stairway to Heaven >says a lot about anticipated traffic volume. > > > > >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users