diff options
author | drh <drh@noemail.net> | 2018-11-06 15:57:59 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-11-06 15:57:59 +0000 |
commit | aef15e74c87b28f2a913fec58272b049916a01a8 (patch) | |
tree | f5f1fe72301497e68234ba801a55bd88661ad8a5 /src | |
parent | fc25721c9e044a23b2a4ab904c68bbbe338d8165 (diff) | |
download | sqlite-aef15e74c87b28f2a913fec58272b049916a01a8.tar.gz sqlite-aef15e74c87b28f2a913fec58272b049916a01a8.zip |
Turn on defensive mode for running test scripts. Does not yet work.
FossilOrigin-Name: 1c1d24edbb732f2a2002a741c7a7afdd010b67e1b5e6d90ff36c6428897e7612
Diffstat (limited to 'src')
-rw-r--r-- | src/delete.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/delete.c b/src/delete.c index 932520382..9380a0915 100644 --- a/src/delete.c +++ b/src/delete.c @@ -50,6 +50,7 @@ Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ ** writable return 0; */ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ + sqlite3 *db = pParse->db; /* A table is not writable under the following circumstances: ** ** 1) It is a virtual table and no implementation of the xUpdate method @@ -57,19 +58,20 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ ** 2) It is a system table (i.e. sqlite_master), this call is not ** part of a nested parse and writable_schema pragma has not ** been specified. - ** 3) The table is a shadow table and the current sqlite3_prepare() - ** is for a top-level SQL statement, not a nested SQL statement - ** issued by a virtual table implementation. + ** 3) The table is a shadow table, the database connection is in + ** defensive mode, and the current sqlite3_prepare() + ** is for a top-level SQL statement. ** ** In either case leave an error message in pParse and return non-zero. */ if( ( IsVirtual(pTab) - && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ) + && sqlite3GetVTable(db, pTab)->pMod->pModule->xUpdate==0 ) || ( (pTab->tabFlags & TF_Readonly)!=0 - && sqlite3WritableSchema(pParse->db)==0 + && sqlite3WritableSchema(db)==0 && pParse->nested==0) || ( (pTab->tabFlags & TF_Shadow)!=0 - && pParse->db->nVdbeExec==0) + && (db->flags & SQLITE_Defensive)!=0 + && db->nVdbeExec==0) ){ sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); return 1; |