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

Avoid committing a transaction from within the xSync() method of a virtual table. Fix for #3497. (CVS 5902)

FossilOrigin-Name: eabb8b7591eab164c637d78ca4df00fcb5bd3c5b
This commit is contained in:
danielk1977
2008-11-13 18:00:14 +00:00
parent ac8d7b35fa
commit 093e0f6ffe
5 changed files with 19 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
C Minor\schanges\sto\sget\smemsys5\scompiling\sand\sits\stests\spassing.\sTicket\s#3495.\s(CVS\s5901) C Avoid\scommitting\sa\stransaction\sfrom\swithin\sthe\sxSync()\smethod\sof\sa\svirtual\stable.\sFix\sfor\s#3497.\s(CVS\s5902)
D 2008-11-13T16:21:50 D 2008-11-13T18:00:15
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 6cbc7db84c23804c368bc7ffe51367412212d7b2 F Makefile.in 6cbc7db84c23804c368bc7ffe51367412212d7b2
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -153,7 +153,7 @@ F src/select.c b03c6fe474ded7bd110ca7b551bf0236133c12da
F src/shell.c 01835f435d2e42be95480f7d7cce48e9b255652e F src/shell.c 01835f435d2e42be95480f7d7cce48e9b255652e
F src/sqlite.h.in 85e159e1d634c84ddbf87481293d5b1d26e2d27b F src/sqlite.h.in 85e159e1d634c84ddbf87481293d5b1d26e2d27b
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 024f3e7722860905c50b59669127e1ac5e520b99 F src/sqliteInt.h 338ab7f86950b00225c94efbc9be133e1bafcb2c
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
@@ -195,11 +195,11 @@ F src/vdbe.c b6b989bbd0e306581695f8914c4246905a5c0d14
F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6 F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6
F src/vdbeInt.h c9400778d6f801c2cb8ebe6151c909e19dd2d793 F src/vdbeInt.h c9400778d6f801c2cb8ebe6151c909e19dd2d793
F src/vdbeapi.c ea22e171704906632cd971668359b8c0c5053001 F src/vdbeapi.c ea22e171704906632cd971668359b8c0c5053001
F src/vdbeaux.c 75258853624ec5fba72039f87397b3d88c586fa1 F src/vdbeaux.c 8915d2367a3f338858b3dd29878a69ecd6904147
F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935 F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
F src/vdbefifo.c 20fda2a7c4c0bcee1b90eb7e545fefcdbf2e1de7 F src/vdbefifo.c 20fda2a7c4c0bcee1b90eb7e545fefcdbf2e1de7
F src/vdbemem.c 223e03281855515e9474dbf66f157452093a77c2 F src/vdbemem.c 223e03281855515e9474dbf66f157452093a77c2
F src/vtab.c 527c180e9c5fca417c9167d02af4b5039f892b4b F src/vtab.c fea22536197c69c2ee268305033b78409087c02f
F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
F src/where.c 171c9b2583944f66484c8552daa85373ce9e949f F src/where.c 171c9b2583944f66484c8552daa85373ce9e949f
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
@@ -657,7 +657,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 00442e0f57b52808d087154c84ece531bf1cfb62 P 96453ca16e90bc0c0cbfb75b3e39899f56d6ea66
R 55c7eb74cfa0f462485977c0a42894ee R 7a24cf12a0679834e94bdaea4129f027
U danielk1977 U danielk1977
Z e462aafc1f4434010beb9b02c9989486 Z 01120215381a9846d9b013baf9ce1048

View File

@@ -1 +1 @@
96453ca16e90bc0c0cbfb75b3e39899f56d6ea66 eabb8b7591eab164c637d78ca4df00fcb5bd3c5b

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.791 2008/11/13 14:28:30 danielk1977 Exp $ ** @(#) $Id: sqliteInt.h,v 1.792 2008/11/13 18:00:15 danielk1977 Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@@ -2447,11 +2447,13 @@ int sqlite3AutoLoadExtensions(sqlite3*);
# define sqlite3VtabSync(X,Y) SQLITE_OK # define sqlite3VtabSync(X,Y) SQLITE_OK
# define sqlite3VtabRollback(X) # define sqlite3VtabRollback(X)
# define sqlite3VtabCommit(X) # define sqlite3VtabCommit(X)
# define sqlite3VtabInSync(db) 0
#else #else
void sqlite3VtabClear(Table*); void sqlite3VtabClear(Table*);
int sqlite3VtabSync(sqlite3 *db, char **); int sqlite3VtabSync(sqlite3 *db, char **);
int sqlite3VtabRollback(sqlite3 *db); int sqlite3VtabRollback(sqlite3 *db);
int sqlite3VtabCommit(sqlite3 *db); int sqlite3VtabCommit(sqlite3 *db);
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
#endif #endif
void sqlite3VtabMakeWritable(Parse*,Table*); void sqlite3VtabMakeWritable(Parse*,Table*);
void sqlite3VtabLock(sqlite3_vtab*); void sqlite3VtabLock(sqlite3_vtab*);

View File

@@ -14,7 +14,7 @@
** to version 2.8.7, all this code was combined into the vdbe.c source file. ** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out. ** But that file was getting too big so this subroutines were split out.
** **
** $Id: vdbeaux.c,v 1.418 2008/11/05 17:41:19 drh Exp $ ** $Id: vdbeaux.c,v 1.419 2008/11/13 18:00:15 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -1585,7 +1585,10 @@ int sqlite3VdbeHalt(Vdbe *p){
** Note: This block also runs if one of the special errors handled ** Note: This block also runs if one of the special errors handled
** above has occurred. ** above has occurred.
*/ */
if( db->autoCommit && db->writeVdbeCnt==(p->readOnly==0) ){ if( !sqlite3VtabInSync(db)
&& db->autoCommit
&& db->writeVdbeCnt==(p->readOnly==0)
){
if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
/* The auto-commit flag is true, and the vdbe program was /* The auto-commit flag is true, and the vdbe program was
** successful or hit an 'OR FAIL' constraint. This means a commit ** successful or hit an 'OR FAIL' constraint. This means a commit

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to help implement virtual tables. ** This file contains code used to help implement virtual tables.
** **
** $Id: vtab.c,v 1.76 2008/08/20 16:35:10 drh Exp $ ** $Id: vtab.c,v 1.77 2008/11/13 18:00:15 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_VIRTUALTABLE #ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -710,7 +710,7 @@ int sqlite3VtabBegin(sqlite3 *db, sqlite3_vtab *pVtab){
** virtual module xSync() callback. It is illegal to write to ** virtual module xSync() callback. It is illegal to write to
** virtual module tables in this case, so return SQLITE_LOCKED. ** virtual module tables in this case, so return SQLITE_LOCKED.
*/ */
if( 0==db->aVTrans && db->nVTrans>0 ){ if( sqlite3VtabInSync(db) ){
return SQLITE_LOCKED; return SQLITE_LOCKED;
} }
if( !pVtab ){ if( !pVtab ){