mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Simplifications to the SQLITE_KEEPNULL flag on VDBE comparison operators.
FossilOrigin-Name: 96269f0179a7d8fa44ee278cef362962368c59ef
This commit is contained in:
13
manifest
13
manifest
@@ -1,5 +1,5 @@
|
||||
C Do\svector\scomparison\ssize\schecking\searly\s-\sat\sname\sresolution\stime\s-\sto\nforestall\sfuture\sproblems.
|
||||
D 2016-09-05T12:12:56.221
|
||||
C Simplifications\sto\sthe\sSQLITE_KEEPNULL\sflag\son\sVDBE\scomparison\soperators.
|
||||
D 2016-09-05T15:02:41.820
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
|
||||
@@ -451,7 +451,7 @@ F src/update.c 8179e699dbd45b92934fd02d3d8e3732e8da8802
|
||||
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
|
||||
F src/util.c 810ec3f22e2d1b62e66c30fe3621ebdedd23584d
|
||||
F src/vacuum.c 913970b9d86dd6c2b8063ef1af421880f1464ec3
|
||||
F src/vdbe.c d8fb59a3ef10636df2447f55c1e82be7b8ad1604
|
||||
F src/vdbe.c 3148d5d47816c5ad2ed3c62beb3086cbbcaab107
|
||||
F src/vdbe.h 67bc551f7faf04c33493892e4b378aada823ed10
|
||||
F src/vdbeInt.h c59381049af5c7751a83456c39b80d1a6fde1f9d
|
||||
F src/vdbeapi.c a32d61b7dd05e6890d8fd44d2805f55e2f5ba9f3
|
||||
@@ -1522,8 +1522,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 42670935aba152ba774c2a8bdcbe72b943309d68 56562a0346170cf7b72445976864b058437a8ac3
|
||||
R 9ea9c6d7e55a2e73634a9a6491229b09
|
||||
T +closed 56562a0346170cf7b72445976864b058437a8ac3
|
||||
P ae127bcc0a5827786853f47b229021435d6098d7
|
||||
R b6639bee17b9273a45c7e5e2da3019f4
|
||||
U drh
|
||||
Z c545a18fc0ce61b83efad3cc467f4a6a
|
||||
Z a8418630f7d7128d87f9b291fb48ec92
|
||||
|
@@ -1 +1 @@
|
||||
ae127bcc0a5827786853f47b229021435d6098d7
|
||||
96269f0179a7d8fa44ee278cef362962368c59ef
|
19
src/vdbe.c
19
src/vdbe.c
@@ -1912,7 +1912,8 @@ case OP_Cast: { /* in1 */
|
||||
** the SQLITE_NULLEQ flag were omitted from P5.
|
||||
**
|
||||
** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the
|
||||
** content of r[P2] is only set to 1 (true) if it was not previously NULL.
|
||||
** content of r[P2] is only changed if the new value is NULL or 0 (false).
|
||||
** In other words, a prior r[P2] value will not be overwritten by 1 (true).
|
||||
*/
|
||||
/* Opcode: Ne P1 P2 P3 P4 P5
|
||||
** Synopsis: IF r[P3]!=r[P1]
|
||||
@@ -1922,7 +1923,8 @@ case OP_Cast: { /* in1 */
|
||||
** additional information.
|
||||
**
|
||||
** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the
|
||||
** content of r[P2] is only set to 0 (false) if it was not previously NULL.
|
||||
** content of r[P2] is only changed if the new value is NULL or 1 (true).
|
||||
** In other words, a prior r[P2] value will not be overwritten by 0 (false).
|
||||
*/
|
||||
/* Opcode: Lt P1 P2 P3 P4 P5
|
||||
** Synopsis: IF r[P3]<r[P1]
|
||||
@@ -2086,11 +2088,20 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
||||
pOut = &aMem[pOp->p2];
|
||||
iCompare = res;
|
||||
res2 = res2!=0; /* For this path res2 must be exactly 0 or 1 */
|
||||
if( (pOp->p5 & SQLITE_KEEPNULL)!=0 && (pOut->flags & MEM_Null)!=0 ){
|
||||
if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){
|
||||
/* The KEEPNULL flag prevents OP_Eq from overwriting a NULL with 1
|
||||
** and prevents OP_Ne from overwriting NULL with 0. */
|
||||
** and prevents OP_Ne from overwriting NULL with 0. This flag
|
||||
** is only used in contexts where either:
|
||||
** (1) op==OP_Eq && (r[P2]==NULL || r[P2]==0)
|
||||
** (2) op==OP_Ne && (r[P2]==NULL || r[P2]==1)
|
||||
** Therefore it is not necessary to check the content of r[P2] for
|
||||
** NULL. */
|
||||
assert( pOp->opcode==OP_Ne || pOp->opcode==OP_Eq );
|
||||
assert( res2==0 || res2==1 );
|
||||
testcase( res2==0 && pOp->opcode==OP_Eq );
|
||||
testcase( res2==1 && pOp->opcode==OP_Eq );
|
||||
testcase( res2==0 && pOp->opcode==OP_Ne );
|
||||
testcase( res2==1 && pOp->opcode==OP_Ne );
|
||||
if( (pOp->opcode==OP_Eq)==res2 ) break;
|
||||
}
|
||||
memAboutToChange(p, pOut);
|
||||
|
Reference in New Issue
Block a user