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.

FossilOrigin-Name: 45797feefe90cb7da53256b0c42fdaa1221d0a27
This commit is contained in:
drh 2017-03-03 21:51:40 +00:00
parent f3f883fcd7
commit 2996796dcf
4 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Remove\san\sredundant\sfunction\scall\sfrom\sthe\sdate/time\sfunction\simplementation.
D 2017-03-03T21:36:26.906
C If\sa\sreprepare\sis\sneeded\safter\sbinding\sto\sa\svariable\swith\sa\snumber\slarger\nthan\s32,\sset\sonly\sthe\shigh-order\sbit\sof\sthe\sVdbe.expmask\srather\sthan\ssetting\nall\sbits.\s\sThis\scould\spotentially\sresult\sin\sfewer\sfalse-positive\sreprepares.
D 2017-03-03T21:51:40.099
F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc a89ea37ab5928026001569f056973b9059492fe2
@ -467,8 +467,8 @@ F src/vacuum.c 1fe4555cd8c9b263afb85b5b4ee3a4a4181ad569
F src/vdbe.c 83f387d9e6842b1dc99f6e85bb577c5bbc4e397d
F src/vdbe.h 59998ffd71d7caa8886bc78dafaf8caeccd4c13c
F src/vdbeInt.h 4e4b15b2e1330e1636e4e01974eab2b0b985092f
F src/vdbeapi.c 70aabe108c411e529a59d8800445513965334062
F src/vdbeaux.c b632f9151a296c5eb22a2cc955c487ebc2347cb6
F src/vdbeapi.c 5b08d82592bcff4470601fe78aaabebd50837860
F src/vdbeaux.c 57361f2e761d92a254638bdbfc03fc68ae6aebc6
F src/vdbeblob.c 359891617358deefc85bef7bcf787fa6b77facb9
F src/vdbemem.c 3b5a9a5b375458d3e12a50ae1aaa41eeec2175fd
F src/vdbesort.c eda25cb2d1727efca6f7862fea32b8aa33c0face
@ -1561,7 +1561,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 8831f4393dda42b3434e7767968caea84bbca2af
R d8b3a18d4fd999381a3209784f6b834e
P 4a04c48a311b19ba5e566877dc5baff543c41aba
R 637ce5713001d3d9ffad62c9c4caff88
U drh
Z 55613e922149954b91d38c0de9685f66
Z 435b5c3ba7edfd2dba5c4b61417da7dd

View File

@ -1 +1 @@
4a04c48a311b19ba5e566877dc5baff543c41aba
45797feefe90cb7da53256b0c42fdaa1221d0a27

View File

@ -1260,7 +1260,7 @@ static int vdbeUnbind(Vdbe *p, int i){
** following any change to the bindings of that parameter.
*/
assert( p->isPrepareV2 || p->expmask==0 );
if( p->expmask & ((u32)1 << (i&0x001F)) && (i<32 || p->expmask==0xffffffff) ){
if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){
p->expired = 1;
}
return SQLITE_OK;

View File

@ -4552,8 +4552,8 @@ sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){
*/
void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
assert( iVar>0 );
if( iVar>32 ){
v->expmask = 0xffffffff;
if( iVar>=32 ){
v->expmask |= 0x80000000;
}else{
v->expmask |= ((u32)1 << (iVar-1));
}