/ Check-in [ece960c4]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Experimental "PRAGMA query_only=BOOLEAN" statement that is able to turn write capabilities on and off.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | query_only
Files: files | file ages | folders
SHA1: ece960c496717a3a6c25526ef77dd76b08d607bc
User & Date: drh 2013-07-10 13:33:49
Context
2013-07-11
15:22
Add the experimental "query_only" pragma. check-in: 6557c407 user: drh tags: trunk
2013-07-10
13:33
Experimental "PRAGMA query_only=BOOLEAN" statement that is able to turn write capabilities on and off. Closed-Leaf check-in: ece960c4 user: drh tags: query_only
03:05
Run progress callback checks less frequently in the main VDBE evaluation loop. This makes up for the extra CPU cycles used to increment the cycle counter for SQLITE_STMTSTATUS_VM_STEP. check-in: 3e8b0201 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

   173    173       { "short_column_names",       SQLITE_ShortColNames },
   174    174       { "count_changes",            SQLITE_CountRows     },
   175    175       { "empty_result_callbacks",   SQLITE_NullCallback  },
   176    176       { "legacy_file_format",       SQLITE_LegacyFileFmt },
   177    177       { "fullfsync",                SQLITE_FullFSync     },
   178    178       { "checkpoint_fullfsync",     SQLITE_CkptFullFSync },
   179    179       { "reverse_unordered_selects", SQLITE_ReverseOrder  },
          180  +    { "query_only",               SQLITE_QueryOnly     },
   180    181   #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
   181    182       { "automatic_index",          SQLITE_AutoIndex     },
   182    183   #endif
   183    184   #ifdef SQLITE_DEBUG
   184    185       { "sql_trace",                SQLITE_SqlTrace      },
   185    186       { "vdbe_listing",             SQLITE_VdbeListing   },
   186    187       { "vdbe_trace",               SQLITE_VdbeTrace     },

Changes to src/sqliteInt.h.

  1005   1005   #define SQLITE_ReverseOrder   0x00010000  /* Reverse unordered SELECTs */
  1006   1006   #define SQLITE_RecTriggers    0x00020000  /* Enable recursive triggers */
  1007   1007   #define SQLITE_ForeignKeys    0x00040000  /* Enforce foreign key constraints  */
  1008   1008   #define SQLITE_AutoIndex      0x00080000  /* Enable automatic indexes */
  1009   1009   #define SQLITE_PreferBuiltin  0x00100000  /* Preference to built-in funcs */
  1010   1010   #define SQLITE_LoadExtension  0x00200000  /* Enable load_extension */
  1011   1011   #define SQLITE_EnableTrigger  0x00400000  /* True to enable triggers */
         1012  +#define SQLITE_QueryOnly      0x00800000  /* Disable database changes */
  1012   1013   
  1013   1014   /*
  1014   1015   ** Bits of the sqlite3.dbOptFlags field that are used by the
  1015   1016   ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
  1016   1017   ** selectively disable various optimizations.
  1017   1018   */
  1018   1019   #define SQLITE_QueryFlattener 0x0001   /* Query flattening */

Changes to src/vdbe.c.

  2942   2942   case OP_Transaction: {
  2943   2943     Btree *pBt;
  2944   2944   
  2945   2945     assert( p->bIsReader );
  2946   2946     assert( p->readOnly==0 || pOp->p2==0 );
  2947   2947     assert( pOp->p1>=0 && pOp->p1<db->nDb );
  2948   2948     assert( (p->btreeMask & (((yDbMask)1)<<pOp->p1))!=0 );
         2949  +  if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){
         2950  +    rc = SQLITE_READONLY;
         2951  +    goto abort_due_to_error;
         2952  +  }
  2949   2953     pBt = db->aDb[pOp->p1].pBt;
  2950   2954   
  2951   2955     if( pBt ){
  2952   2956       rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
  2953   2957       if( rc==SQLITE_BUSY ){
  2954   2958         p->pc = pc;
  2955   2959         p->rc = rc = SQLITE_BUSY;