-C NULLs\scompare\sequal\sto\seach\sother\swhen\scomputing\sGROUP\sBY\scategories.\s(CVS\s2728)
-D 2005-09-20T13:12:00
+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:55:18
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/prepare.c fc098db25d2a121affb08686cf04833fd50452d4
F src/printf.c bd421c1ad5e01013c89af63c60eab02852ccd15e
F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
-F src/select.c 52b72b7fe11ce4ddc136074a1b48ea69453f60fd
+F src/select.c 4a5271874f43d641d273eb6b88f77ab1c289f3c1
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
F src/sqliteInt.h 53daa72541b4336c5e89773cf39717ed695bd523
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 55caaffbb2716f9928ab452d20f3e9cbbeab872d
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
-F src/vdbe.c 2a5c9474c9538e18347ab63988bad4e3de074403
+F src/vdbe.c ae89c05fa7663c470aefafcb5aa40b6797c8eb37
F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2
F src/vdbeInt.h 7bedbb9553a10e86b53f75d99e197f3f00a732bf
F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P bb84d27eda64479d65b13fbbcaeef6a00da4d103
-R ec917b8e5b94d2118eb0bbfbe6d750c0
+P d9b0c9705379a8b3a28a83bb29fc1cd688fe184e
+R 9a4465a95bd3c4612d23f7531e305890
U drh
-Z 353c0c657af079f4a5983ad6b31ab9ff
+Z da619a304c4dc568252b01796a7d376e
-d9b0c9705379a8b3a28a83bb29fc1cd688fe184e
\ No newline at end of file
+f22d0f64a0b9100e16746fb800efa508d286e40e
\ No newline at end of file
** This file contains C code routines that are called by the parser
** 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"
if( j==0 ){
sqlite3VdbeAddOp(v, OP_Eq, 0x200, addrProcessRow);
}else{
- sqlite3VdbeAddOp(v, OP_Ne, 0x300, addrGroupByChange);
+ sqlite3VdbeAddOp(v, OP_Ne, 0x200, addrGroupByChange);
}
sqlite3VdbeChangeP3(v, -1, (void*)pKeyInfo->aColl[j], P3_COLLSEQ);
}
** in this file for details. If in doubt, do not deviate from existing
** 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 "os.h"
**
** 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
-** is NULL. If the 0x200 bit of P1 is set and both operands are NULL, then
-** return true or take the jump - treat NULL values as just another number.
+** is NULL.
+**
+** 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 -
** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
** the stack.
*/
if( flags&MEM_Null ){
- if( (pOp->p1 & 0x200)!=0 && (pTos->flags & pNos->flags & MEM_Null)!=0 ){
- /* If the 0x200 bit of P1 is set and *both* operands are NULL, then
- ** pretend that both operands are integer 0. This will cause the the
- ** various comparison operators to threat NULL just like any other value.
+ if( (pOp->p1 & 0x200)!=0 ){
+ /* The 0x200 bit of P1 means, roughly "do not treat NULL as the
+ ** magic SQL value it normally is - treat it as if it were another
+ ** 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;
- pTos->i = pNos->i = 0;
+ sqlite3VdbeMemSetInt64(pTos, (pTos->flags & MEM_Null)==0);
+ sqlite3VdbeMemSetInt64(pNos, (pNos->flags & MEM_Null)==0);
}else{
- /* If the 0x200 bit of P1 is clear or only one of the operands is NULL,
- ** then the result is always NULL. The jump is taken if the 0x100 bit
+ /* If the 0x200 bit of P1 is clear and either operand is NULL then
+ ** the result is always NULL. The jump is taken if the 0x100 bit
** of P1 is set.
*/
popStack(&pTos, 2);