/ Check-in [45797fee]
Login

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

Overview
Comment:If a reprepare is needed after binding to a variable with a number larger than 32, set only the high-order bit of the Vdbe.expmask rather than setting all bits. This could potentially result in fewer false-positive reprepares.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 45797feefe90cb7da53256b0c42fdaa1221d0a27
User & Date: drh 2017-03-03 21:51:40
Context
2017-03-06
17:33
Add an initial implementation of the "PRAGMA optimize" command. check-in: 137aeb2b user: drh tags: trunk
11:39
Merge updates from trunk. Closed-Leaf check-in: 5f7fc79a user: drh tags: auto-analyze
2017-03-03
21:51
If a reprepare is needed after binding to a variable with a number larger than 32, set only the high-order bit of the Vdbe.expmask rather than setting all bits. This could potentially result in fewer false-positive reprepares. check-in: 45797fee user: drh tags: trunk
21:36
Remove an redundant function call from the date/time function implementation. check-in: 4a04c48a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

  1256   1256     ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host
  1257   1257     ** parameter in the WHERE clause might influence the choice of query plan
  1258   1258     ** for a statement, then the statement will be automatically recompiled,
  1259   1259     ** as if there had been a schema change, on the first sqlite3_step() call
  1260   1260     ** following any change to the bindings of that parameter.
  1261   1261     */
  1262   1262     assert( p->isPrepareV2 || p->expmask==0 );
  1263         -  if( p->expmask & ((u32)1 << (i&0x001F)) && (i<32 || p->expmask==0xffffffff) ){
         1263  +  if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){
  1264   1264       p->expired = 1;
  1265   1265     }
  1266   1266     return SQLITE_OK;
  1267   1267   }
  1268   1268   
  1269   1269   /*
  1270   1270   ** Bind a text or BLOB value.

Changes to src/vdbeaux.c.

  4548   4548   /*
  4549   4549   ** Configure SQL variable iVar so that binding a new value to it signals
  4550   4550   ** to sqlite3_reoptimize() that re-preparing the statement may result
  4551   4551   ** in a better query plan.
  4552   4552   */
  4553   4553   void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
  4554   4554     assert( iVar>0 );
  4555         -  if( iVar>32 ){
  4556         -    v->expmask = 0xffffffff;
         4555  +  if( iVar>=32 ){
         4556  +    v->expmask |= 0x80000000;
  4557   4557     }else{
  4558   4558       v->expmask |= ((u32)1 << (iVar-1));
  4559   4559     }
  4560   4560   }
  4561   4561   
  4562   4562   #ifndef SQLITE_OMIT_VIRTUALTABLE
  4563   4563   /*