aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pragma.c1
-rw-r--r--src/sqliteInt.h1
-rw-r--r--src/vdbe.c4
3 files changed, 6 insertions, 0 deletions
diff --git a/src/pragma.c b/src/pragma.c
index 5803f6c4a..f38e679a4 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -177,6 +177,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
{ "fullfsync", SQLITE_FullFSync },
{ "checkpoint_fullfsync", SQLITE_CkptFullFSync },
{ "reverse_unordered_selects", SQLITE_ReverseOrder },
+ { "query_only", SQLITE_QueryOnly },
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
{ "automatic_index", SQLITE_AutoIndex },
#endif
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 5e3b4d0a0..48a1f96ea 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1009,6 +1009,7 @@ struct sqlite3 {
#define SQLITE_PreferBuiltin 0x00100000 /* Preference to built-in funcs */
#define SQLITE_LoadExtension 0x00200000 /* Enable load_extension */
#define SQLITE_EnableTrigger 0x00400000 /* True to enable triggers */
+#define SQLITE_QueryOnly 0x00800000 /* Disable database changes */
/*
** Bits of the sqlite3.dbOptFlags field that are used by the
diff --git a/src/vdbe.c b/src/vdbe.c
index 9a56518c5..1fa21df6d 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -2946,6 +2946,10 @@ case OP_Transaction: {
assert( p->readOnly==0 || pOp->p2==0 );
assert( pOp->p1>=0 && pOp->p1<db->nDb );
assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );
+ if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){
+ rc = SQLITE_READONLY;
+ goto abort_due_to_error;
+ }
pBt = db->aDb[pOp->p1].pBt;
if( pBt ){