Compare commits

...

1 Commits

Author SHA1 Message Date
drh 0027da3e3e A proposed change to the sqlite3_step() API such that it will only auto-reset
following an SQLITE_BUSY or SQLITE_LOCKED error.  Calls after any other result
other than SQLITE_ROW will return SQLITE_MISUSE.

FossilOrigin-Name: d1b3c54f42b1765e7565aeff517835c28528b177
2011-01-11 01:42:47 +00:00
9 changed files with 43 additions and 31 deletions
Regular → Executable
View File
+19 -15
View File
@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Update\spager\srequirements\sto\saccound\sfor\sthe\sZIPVFS\sextension.
D 2011-01-10T21:01:10.514
C A\sproposed\schange\sto\sthe\ssqlite3_step()\sAPI\ssuch\sthat\sit\swill\sonly\sauto-reset\nfollowing\san\sSQLITE_BUSY\sor\sSQLITE_LOCKED\serror.\s\sCalls\safter\sany\sother\sresult\nother\sthan\sSQLITE_ROW\swill\sreturn\sSQLITE_MISUSE.
D 2011-01-11T01:42:47.257
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -100,7 +100,7 @@ F ext/rtree/rtree_util.tcl 06aab2ed5b826545bf215fff90ecb9255a8647ea
F ext/rtree/sqlite3rtree.h 1af0899c63a688e272d69d8e746f24e76f10a3f0
F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F main.mk 05d0f3475dd331896bd607cfb45c5e21b94589ad
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
@@ -179,7 +179,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c 8a7ba246b0b4bb45df7fbc52681728a0e3deaaa7
F src/shell.c 83c6f0cc5a79a081c7b9ddfe4f557b47e0bad976
F src/sqlite.h.in f48408b86c0713bc074b16c83543868688b0e18d
F src/sqlite.h.in 9c28db87c6844da748f820381d35cfa9c60b2907
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
F src/sqliteInt.h 3ef5fc89a4c9755a08a68de107493785a284e27c
F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -234,7 +234,7 @@ F src/vacuum.c 924bd1bcee2dfb05376f79845bd3b4cec7b54b2f
F src/vdbe.c 5d310eaf1a4d8383602126fa82e01291ab7d3cf3
F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2
F src/vdbeInt.h 6e6f28e9bccc6c703dca1372fd661c57b5c15fb0
F src/vdbeapi.c 0f898cc77099f0b0b4d6a045e905c3501f9c8b27
F src/vdbeapi.c dadcdb10a3529a9b9b864a24dc544e73b064617f
F src/vdbeaux.c 33448d23b857654dd69ed2103611f5c733606f68
F src/vdbeblob.c 18955f0ee6b133cd08e1592010cb9a6b11e9984c
F src/vdbemem.c 411649a35686f54268ccabeda175322c4697f5a6
@@ -296,7 +296,7 @@ F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983
F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
F test/cache.test 754baab2f18089fc9bcba7afaeb4dc907c6c6de2
F test/capi2.test 00032d7504b9c14f1b36331670c5e7b0f73e3c5d
F test/capi2.test 35145f8ab52b598229124426366e5eac4ef768a5
F test/capi3.test 1945a2ba75e3f4c49d5beb8fc092115b6292d471
F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test bea67403a5e37a4b33230ee4723e315a2ffb31e7
@@ -384,7 +384,7 @@ F test/fallocate.test 43dc34b8c24be6baffadc3b4401ee15710ce83c6
F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e
F test/filefmt.test f77c92141960b7933bc6691631d2ad62257ef40a
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
F test/fkey2.test e028cd80aa0bd38541c99214e3ba2dfccadffe6f
F test/fkey2.test 64cf8ff5f9ab4fb52d811fe566cf6bb16d581ace
F test/fkey3.test 42f88d6048d8dc079e2a8cf7baad1cc1483a7620
F test/fkey_malloc.test a5ede29bd2f6e56dea78c3d43fb86dd696c068c8
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
@@ -592,7 +592,7 @@ F test/permutations.test c0ce0f3b741dd92a6d4c2671dbacba4b92dd81eb
F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quota.test ddafe133653093eb9a99ccd6264884ae43f9c9b8
@@ -873,7 +873,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/lemon.c dfd81a51b6e27e469ba21d01a75ddf092d429027
F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc
F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c.tcl e0db70c2c52b0e3d0867ca931229e5b90ffe7837
F tool/mksqlite3h.tcl 03b6ca938c833814923674d8a160e91fcedb4571
@@ -898,14 +898,18 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 378a1d13af4a6f4cb2bfa65944b3b0d444b9f21c
R 9ba476b75f53d677656fa985b1b64795
P d94e59b514c16c5f7ea506e0af1c6e2ffecc13be
R a86955080777493b2187018f170a178d
T *bgcolor * #d3b5a8
T *branch * step-autoreset
T *sym-step-autoreset *
T -sym-trunk *
U drh
Z b1419bbb0387a7a1916f12cb7cb5d1cc
Z 7ffe0daac41d7b9d85205b0b64319c09
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFNK3OZoxKgR168RlERAkacAKCMhl6ZxRLBUNTVdjwpBabO5xt6DACdFjqx
fy4uPWEx1WyrV/pu6K1mVzM=
=JPWF
iD8DBQFNK7WaoxKgR168RlERAmmXAJ0e/2qglzA0RyyCLNkWfIMbaUiDTgCcCPul
Qt0uOQ3HtFU5BhZZGWns7jg=
=4ojJ
-----END PGP SIGNATURE-----
+1 -1
View File
@@ -1 +1 @@
d94e59b514c16c5f7ea506e0af1c6e2ffecc13be
d1b3c54f42b1765e7565aeff517835c28528b177
+9 -4
View File
@@ -3071,13 +3071,18 @@ 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
** For all versions of SQLite prior to 3.7.0, 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].
** result in an [SQLITE_MISUSE] return from sqlite3_step(). Beginning
** with version 3.7.0, sqlite3_step() began calling [sqlite3_reset()]
** automatically in this circumstance rather than returning [SQLITE_MISUSE].
** This changed again in version 3.7.5 such that [sqlite3_reset()] is
** only invoked after an [SQLITE_BUSY] or [SQLITE_LOCKED] error return
** and in all other cases sqlite3_step() will return [SQLITE_MISUSE] if
** it is not manually reset following [SQLITE_DONE] or any error other
** than [SQLITE_BUSY] and [SQLITE_LOCKED].
**
** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
** API always returns a generic error code, [SQLITE_ERROR], following any
+12 -6
View File
@@ -344,12 +344,18 @@ static int sqlite3Step(Vdbe *p){
assert(p);
if( p->magic!=VDBE_MAGIC_RUN ){
/* 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);
if( p->rc==SQLITE_BUSY || p->rc==SQLITE_LOCKED ){
/* 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. Then for 3.7.5 we change it again so that
** sqlite3_reset() would be automatically called only after BUSY and
** LOCKED errors.
*/
sqlite3_reset((sqlite3_stmt*)p);
}else{
return SQLITE_MISUSE_BKPT;
}
}
/* Check that malloc() has not failed. If it has, return early. */
+1 -4
View File
@@ -71,12 +71,9 @@ 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}}
# This used to be SQLITE_MISUSE. But now we automatically reset prepared
# statements.
do_test capi2-1.8 {
sqlite3_step $VM
} {SQLITE_ROW}
} {SQLITE_MISUSE}
# Update: In v2, once SQLITE_MISUSE is returned the statement handle cannot
# be interrogated for more information. However in v3, since the column
+1 -1
View File
@@ -1416,7 +1416,7 @@ do_test fkey2-17.1.2 {
} {SQLITE_CONSTRAINT}
do_test fkey2-17.1.3 {
sqlite3_step $STMT
} {SQLITE_CONSTRAINT}
} {SQLITE_MISUSE}
do_test fkey2-17.1.4 {
sqlite3_finalize $STMT
} {SQLITE_CONSTRAINT}
Executable → Regular
View File
Executable → Regular
View File