diff options
author | drh <drh@noemail.net> | 2010-04-17 12:53:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-04-17 12:53:19 +0000 |
commit | 3674bfd1b6cc4524402e169dea419b508d38e306 (patch) | |
tree | 74d6709e5629082be889d30b3132d9f3cfc1f638 /src | |
parent | f391327824be0074aac69b1b17a4a01400526c5a (diff) | |
download | sqlite-3674bfd1b6cc4524402e169dea419b508d38e306.tar.gz sqlite-3674bfd1b6cc4524402e169dea419b508d38e306.zip |
Change sqlite3_step() so that it automatically calls sqlite3_reset() instead
of returning SQLITE_MISUSE when invoked on a prepared statement that
previously returned any value other than SQLITE_ROW.
FossilOrigin-Name: 3e646e3f4cd0ca288e444561e951cecfdaee2ab5
Diffstat (limited to 'src')
-rw-r--r-- | src/sqlite.h.in | 8 | ||||
-rw-r--r-- | src/vdbeapi.c | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 78f3773e9..c1363031e 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2885,6 +2885,14 @@ const void *sqlite3_column_decltype16(sqlite3_stmt*,int); ** be the case that the same database connection is being used by two or ** more threads at the same moment in time. ** +** For all versions of SQLite up to and including 3.6.23.1, it was required +** after sqlite3_step() returned anything other than [SQLITE_ROW] that +** [sqlite3_reset()] be called before any subsequent invocation of +** sqlite3_step(). Failure to invoke [sqlite3_reset()] in this way would +** result in an [SQLITE_MISUSE] return from sqlite3_step(). But after +** version 3.6.23.1, sqlite3_step() began calling [sqlite3_reset()] +** automatically in this circumstance rather than returning [SQLITE_MISUSE]. +** ** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step() ** API always returns a generic error code, [SQLITE_ERROR], following any ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 125f325d1..29a2a429b 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -321,9 +321,12 @@ static int sqlite3Step(Vdbe *p){ assert(p); if( p->magic!=VDBE_MAGIC_RUN ){ - sqlite3_log(SQLITE_MISUSE, - "attempt to step a halted statement: [%s]", p->zSql); - return SQLITE_MISUSE_BKPT; + /* We used to require that sqlite3_reset() be called before retrying + ** sqlite3_step() after any error. But after 3.6.23, we changed this + ** so that sqlite3_reset() would be called automatically instead of + ** throwing the error. + */ + sqlite3_reset((sqlite3_stmt*)p); } /* Check that malloc() has not failed. If it has, return early. */ |