]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change sqlite3_step() so that it automatically calls sqlite3_reset() instead
authordrh <drh@noemail.net>
Sat, 17 Apr 2010 12:53:19 +0000 (12:53 +0000)
committerdrh <drh@noemail.net>
Sat, 17 Apr 2010 12:53:19 +0000 (12:53 +0000)
of returning SQLITE_MISUSE when invoked on a prepared statement that
previously returned any value other than SQLITE_ROW.

FossilOrigin-Name: 3e646e3f4cd0ca288e444561e951cecfdaee2ab5

manifest
manifest.uuid
src/sqlite.h.in
src/vdbeapi.c
test/capi2.test
test/fkey2.test

index d36430f66fdcdcbe665a7aef5f584b1359abb19a..9fe9013723b671cea41dd1888c7697b66d08b7f6 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Disable\squery\sflattening\swhen\sthe\souter\squery\sis\sa\scompound\sSELECT\sand\nthe\sinner\squery\shas\sa\sLIMIT\sclause.\s\sTicket\s[02a8e81d44].
-D 2010-04-15T23:24:29
+C Change\ssqlite3_step()\sso\sthat\sit\sautomatically\scalls\ssqlite3_reset()\sinstead\nof\sreturning\sSQLITE_MISUSE\swhen\sinvoked\son\sa\sprepared\sstatement\sthat\npreviously\sreturned\sany\svalue\sother\sthan\sSQLITE_ROW.
+D 2010-04-17T12:53:20
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -169,7 +169,7 @@ F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c b7c9a40bc1567bceff52ad4b73108734ee4bf268
 F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
-F src/sqlite.h.in 0aeb53778e1591032fdf12ba7aa059250beb480a
+F src/sqlite.h.in dc98616304e3e776008655671d81e3ad3028ada7
 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
 F src/sqliteInt.h bd7ff54663bdd5b57e0eb8b49aca5a3a3c60119a
 F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
@@ -218,7 +218,7 @@ F src/vacuum.c b1d542c8919d4d11119f78069e1906a1ad07e0ee
 F src/vdbe.c 2abd931ea2aec3eacc6426677f40cc5a1071d34e
 F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
 F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
-F src/vdbeapi.c 74c25680046a116b24b95393914d3669c23305dc
+F src/vdbeapi.c 11bcc381e81e797fcf3e81fa6a14ec16a04801cc
 F src/vdbeaux.c 3028b2d50df39697e21263685349b5ff1333a29b
 F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
@@ -276,7 +276,7 @@ F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983
 F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
-F test/capi2.test 172c717ed101e78e0798dd21b9896a22366f35b4
+F test/capi2.test 00032d7504b9c14f1b36331670c5e7b0f73e3c5d
 F test/capi3.test 168e2cd66c58c510955b0f299750e4de73b8d952
 F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
 F test/capi3c.test 493385107dcedfaf4f2b1c3738c8c1fa00362006
@@ -348,7 +348,7 @@ F test/expr.test 9f521ae22f00e074959f72ce2e55d46b9ed23f68
 F test/filectrl.test 8923a6dc7630f31c8a9dd3d3d740aa0922df7bf8
 F test/filefmt.test 84e3d0fe9f12d0d2ac852465c6f8450aea0d6f43
 F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
-F test/fkey2.test e71f5baf9bb42cdba4700d73cba6f4d82fd6b925
+F test/fkey2.test 82652daf32ec5a40634a10bc8db571b84d39c7fe
 F test/fkey3.test 42f88d6048d8dc079e2a8cf7baad1cc1483a7620
 F test/fkey_malloc.test a5ede29bd2f6e56dea78c3d43fb86dd696c068c8
 F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
@@ -801,14 +801,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P f538d759beda67e042b66181b65bd432488f7650
-R 34d0a17088c0fdff5f60f2ea4cf2882d
+P f96782b389b5b97b488dc5814f7082e0393f64cd
+R b3683c8d5f87dead098717870c446ce4
 U drh
-Z b46bcb95ee573d80fced144df93d24f1
+Z 68bc4fd82825f4b7f1278d3f78ee95b8
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFLx6AxoxKgR168RlERAq3yAJ9VLNfRM+IKVowVDGm7aiEH4HuZmQCaA/ai
-zk4R64zbGoGnQ/UpEadFxjM=
-=0vth
+iD8DBQFLya9GoxKgR168RlERAvQaAJwLUmtTGSRsZdMt+rOX4V9Acu7enQCdFgG+
+yMxp/Ep2vaOwFANf9gUAX1Q=
+=yLEB
 -----END PGP SIGNATURE-----
index 7b9f5249dec27d9de5ae9b1382d94a035b96be6b..9d8bb1e648c658c7c93040aae2a8b18cc015380d 100644 (file)
@@ -1 +1 @@
-f96782b389b5b97b488dc5814f7082e0393f64cd
\ No newline at end of file
+3e646e3f4cd0ca288e444561e951cecfdaee2ab5
\ No newline at end of file
index 78f3773e9918e436d3cadc0a11781296b81d6643..c1363031eab58a5a0ff9346842a3d2306b410fbb 100644 (file)
@@ -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
index 125f325d183d4184a95c8d36bb74086fcef5f13b..29a2a429bc207c679433454e2171aedc6ecc189d 100644 (file)
@@ -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. */
index 8bcb25a834851f3d415c830fc593528300e0ec42..b4aa970c8e0c0b27513b6790a8718db8deb1a2a7 100644 (file)
@@ -71,15 +71,19 @@ do_test capi2-1.6 {
 do_test capi2-1.7 {
   list [sqlite3_column_count $VM] [get_row_values $VM] [get_column_names $VM]
 } {2 {} {name rowid text INTEGER}}
-do_test capi2-1.8-misuse {
+
+# This used to be SQLITE_MISUSE.  But now we automatically reset prepared
+# statements.
+do_test capi2-1.8 {
   sqlite3_step $VM
-} {SQLITE_MISUSE}
+} {SQLITE_ROW}
 
 # Update: In v2, once SQLITE_MISUSE is returned the statement handle cannot
 # be interrogated for more information. However in v3, since the column
 # count, names and types are determined at compile time, these are still
 # accessible after an SQLITE_MISUSE error.
 do_test capi2-1.9 {
+  sqlite3_reset $VM
   list [sqlite3_column_count $VM] [get_row_values $VM] [get_column_names $VM]
 } {2 {} {name rowid text INTEGER}}
 do_test capi2-1.10 {
index 10a624ef0a445d4b5526108dc8be1936a585e0b4..2134431b026daa80f0302ad4c19a5ce5054a3713 100644 (file)
@@ -1410,7 +1410,7 @@ do_test fkey2-17.1.2 {
 } {SQLITE_CONSTRAINT}
 do_test fkey2-17.1.3 {
   sqlite3_step $STMT
-} {SQLITE_MISUSE}
+} {SQLITE_CONSTRAINT}
 do_test fkey2-17.1.4 {
   sqlite3_finalize $STMT
 } {SQLITE_CONSTRAINT}