1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Cleanup the implementation and the documentation of the new 0x200 P1 flag

on the VDBE comparison operands. (CVS 2729)

FossilOrigin-Name: f22d0f64a0b9100e16746fb800efa508d286e40e
This commit is contained in:
drh
2005-09-20 13:55:18 +00:00
parent e313382e3e
commit 4f68623875
4 changed files with 34 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
C NULLs\scompare\sequal\sto\seach\sother\swhen\scomputing\sGROUP\sBY\scategories.\s(CVS\s2728) C Cleanup\sthe\simplementation\sand\sthe\sdocumentation\sof\sthe\snew\s0x200\sP1\sflag\non\sthe\sVDBE\scomparison\soperands.\s(CVS\s2729)
D 2005-09-20T13:12:00 D 2005-09-20T13:55:18
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1 F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -63,7 +63,7 @@ F src/pragma.c 6d773e25e8af13ef0820531ad2793417f8a8959d
F src/prepare.c fc098db25d2a121affb08686cf04833fd50452d4 F src/prepare.c fc098db25d2a121affb08686cf04833fd50452d4
F src/printf.c bd421c1ad5e01013c89af63c60eab02852ccd15e F src/printf.c bd421c1ad5e01013c89af63c60eab02852ccd15e
F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4 F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
F src/select.c 52b72b7fe11ce4ddc136074a1b48ea69453f60fd F src/select.c 4a5271874f43d641d273eb6b88f77ab1c289f3c1
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3 F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2 F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
F src/sqliteInt.h 53daa72541b4336c5e89773cf39717ed695bd523 F src/sqliteInt.h 53daa72541b4336c5e89773cf39717ed695bd523
@@ -80,7 +80,7 @@ F src/update.c c2716c2115533ffae3d08bf8853aaba4f970f37e
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 55caaffbb2716f9928ab452d20f3e9cbbeab872d F src/util.c 55caaffbb2716f9928ab452d20f3e9cbbeab872d
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
F src/vdbe.c 2a5c9474c9538e18347ab63988bad4e3de074403 F src/vdbe.c ae89c05fa7663c470aefafcb5aa40b6797c8eb37
F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2 F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2
F src/vdbeInt.h 7bedbb9553a10e86b53f75d99e197f3f00a732bf F src/vdbeInt.h 7bedbb9553a10e86b53f75d99e197f3f00a732bf
F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
@@ -311,7 +311,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P bb84d27eda64479d65b13fbbcaeef6a00da4d103 P d9b0c9705379a8b3a28a83bb29fc1cd688fe184e
R ec917b8e5b94d2118eb0bbfbe6d750c0 R 9a4465a95bd3c4612d23f7531e305890
U drh U drh
Z 353c0c657af079f4a5983ad6b31ab9ff Z da619a304c4dc568252b01796a7d376e

View File

@@ -1 +1 @@
d9b0c9705379a8b3a28a83bb29fc1cd688fe184e f22d0f64a0b9100e16746fb800efa508d286e40e

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.273 2005/09/20 13:12:00 drh Exp $ ** $Id: select.c,v 1.274 2005/09/20 13:55:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -3020,7 +3020,7 @@ int sqlite3Select(
if( j==0 ){ if( j==0 ){
sqlite3VdbeAddOp(v, OP_Eq, 0x200, addrProcessRow); sqlite3VdbeAddOp(v, OP_Eq, 0x200, addrProcessRow);
}else{ }else{
sqlite3VdbeAddOp(v, OP_Ne, 0x300, addrGroupByChange); sqlite3VdbeAddOp(v, OP_Ne, 0x200, addrGroupByChange);
} }
sqlite3VdbeChangeP3(v, -1, (void*)pKeyInfo->aColl[j], P3_COLLSEQ); sqlite3VdbeChangeP3(v, -1, (void*)pKeyInfo->aColl[j], P3_COLLSEQ);
} }

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.489 2005/09/20 13:12:00 drh Exp $ ** $Id: vdbe.c,v 1.490 2005/09/20 13:55:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -1412,8 +1412,14 @@ case OP_ToBlob: { /* no-push */
** **
** If the 0x100 bit of P1 is true and either operand is NULL then take the ** If the 0x100 bit of P1 is true and either operand is NULL then take the
** jump. If the 0x100 bit of P1 is clear then fall thru if either operand ** jump. If the 0x100 bit of P1 is clear then fall thru if either operand
** is NULL. If the 0x200 bit of P1 is set and both operands are NULL, then ** is NULL.
** return true or take the jump - treat NULL values as just another number. **
** If the 0x200 bit of P1 is set and either operand is NULL then
** both operands are converted to integers prior to comparison.
** NULL operands are converted to zero and non-NULL operands are
** converted to 1. Thus, for example, with 0x200 set, NULL==NULL is true
** whereas it would normally be NULL. Similarly, NULL==123 is false when
** 0x200 is set but is NULL when the 0x200 bit of P1 is clear.
** **
** The least significant byte of P1 (mask 0xff) must be an affinity character - ** The least significant byte of P1 (mask 0xff) must be an affinity character -
** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values ** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
@@ -1482,16 +1488,23 @@ case OP_Ge: { /* same as TK_GE, no-push */
** the stack. ** the stack.
*/ */
if( flags&MEM_Null ){ if( flags&MEM_Null ){
if( (pOp->p1 & 0x200)!=0 && (pTos->flags & pNos->flags & MEM_Null)!=0 ){ if( (pOp->p1 & 0x200)!=0 ){
/* If the 0x200 bit of P1 is set and *both* operands are NULL, then /* The 0x200 bit of P1 means, roughly "do not treat NULL as the
** pretend that both operands are integer 0. This will cause the the ** magic SQL value it normally is - treat it as if it were another
** various comparison operators to threat NULL just like any other value. ** integer".
**
** With 0x200 set, if either operand is NULL then both operands
** are converted to integers prior to being passed down into the
** normal comparison logic below. NULL operands are converted to
** zero and non-NULL operands are converted to 1. Thus, for example,
** with 0x200 set, NULL==NULL is true whereas it would normally
** be NULL. Similarly, NULL!=123 is true.
*/ */
pTos->flags = pNos->flags = MEM_Int; sqlite3VdbeMemSetInt64(pTos, (pTos->flags & MEM_Null)==0);
pTos->i = pNos->i = 0; sqlite3VdbeMemSetInt64(pNos, (pNos->flags & MEM_Null)==0);
}else{ }else{
/* If the 0x200 bit of P1 is clear or only one of the operands is NULL, /* If the 0x200 bit of P1 is clear and either operand is NULL then
** then the result is always NULL. The jump is taken if the 0x100 bit ** the result is always NULL. The jump is taken if the 0x100 bit
** of P1 is set. ** of P1 is set.
*/ */
popStack(&pTos, 2); popStack(&pTos, 2);