1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Update the sqlite3_stmt_busy() function so that it correctly returns true for "ROLLBACK" statements that have been stepped but not yet reset.

FossilOrigin-Name: 61cee3c0678f5abd9131a29ab946a5e71f55643e
This commit is contained in:
dan
2014-07-19 17:57:10 +00:00
parent 33af1a6faa
commit 857745c089
5 changed files with 49 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sharmless\scompiler\swarnings\sin\sthe\sshowdb\sand\sshowwal\stools\sand\sin\nthe\sunicode\stokenizer\sof\sFTS3.
D 2014-07-19T17:49:40.535
C Update\sthe\ssqlite3_stmt_busy()\sfunction\sso\sthat\sit\scorrectly\sreturns\strue\sfor\s"ROLLBACK"\sstatements\sthat\shave\sbeen\sstepped\sbut\snot\syet\sreset.
D 2014-07-19T17:57:10.785
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -286,8 +286,8 @@ F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
F src/vdbe.c 9bfe6becfc094382ae213656fbe511055ad83a54
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
F src/vdbeaux.c 8ce7dcdbb8c59e5c2194518ce3099b254ae94c15
F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
F src/vdbeaux.c 8d32b5a68670ccc6c64904924e6a0dddbc3a2fc5
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394
F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27
@@ -372,7 +372,7 @@ F test/capi2.test 011c16da245fdc0106a2785035de6b242c05e738
F test/capi3.test 71bcf2fbd36a9732f617766dfd752552c8e491b5
F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test a21869e4d50d5dbb7e566e328fc0bc7c2efa6a32
F test/capi3d.test 6d0fc0a86d73f42dd19a7d8b7761ab9bc02277d0
F test/capi3d.test c84af0c49267f9c3fbf4c1c46aa647646023811e
F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
F test/check.test 5831ddb6f2c687782eaf2e1a07b6e17f24c4f763
@@ -1182,8 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 2beefa68c0c53f663321bebf0ac06f6c936be63f c01caea5d6ad7a570628b85fb3056ac955ff03dd
R 4ac50ab96ea64a1527703075acfe4ff2
T +closed c01caea5d6ad7a570628b85fb3056ac955ff03dd
U drh
Z cd2aeeb09b327b0fcacfc59206b5ba8f
P 574cc8eb1448cff67390f2e16cc9b7c3ddd4658b
R 3e17c7c287ebc0f7c8d4dc519939fd8f
U dan
Z 2190a4b1d8dc0a3facc078eb683578eb

View File

@@ -1 +1 @@
574cc8eb1448cff67390f2e16cc9b7c3ddd4658b
61cee3c0678f5abd9131a29ab946a5e71f55643e

View File

@@ -1323,7 +1323,7 @@ int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
*/
int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
Vdbe *v = (Vdbe*)pStmt;
return v!=0 && v->pc>0 && v->magic==VDBE_MAGIC_RUN;
return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
}
/*

View File

@@ -2143,7 +2143,7 @@ static void checkActiveVdbeCnt(sqlite3 *db){
int nRead = 0;
p = db->pVdbe;
while( p ){
if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){
if( sqlite3_stmt_busy((sqlite3_stmt*)p) ){
cnt++;
if( p->readOnly==0 ) nWrite++;
if( p->bIsReader ) nRead++;

View File

@@ -144,4 +144,41 @@ do_test capi3d-3.99 {
sqlite3_stmt_busy 0
} {0}
#--------------------------------------------------------------------------
# Test the sqlite3_stmt_busy() function with ROLLBACK statements.
#
reset_db
do_execsql_test capi3d-4.1 {
CREATE TABLE t4(x,y);
BEGIN;
}
do_test capi3d-4.2.1 {
breakpoint
set ::s1 [sqlite3_prepare_v2 db "ROLLBACK" -1 notused]
sqlite3_step $::s1
} {SQLITE_DONE}
do_test capi3d-4.2.2 {
sqlite3_stmt_busy $::s1
} {1}
do_catchsql_test capi3d-4.2.3 {
VACUUM
} {1 {cannot VACUUM - SQL statements in progress}}
do_test capi3d-4.2.4 {
sqlite3_reset $::s1
} {SQLITE_OK}
do_catchsql_test capi3d-4.2.5 {
VACUUM
} {0 {}}
do_test capi3d-4.2.6 {
sqlite3_finalize $::s1
} {SQLITE_OK}
finish_test