-C Make\ssure\sindices\sin\sATTACH-ed\sdatabases\sare\sput\sinto\sthe\sright\shash\stable.\nTicket\s#354.\s(CVS\s1044)
-D 2003-07-01T18:13:15
+C Correctly\shandle\scomparing\san\sINTEGER\sPRIMARY\sKEY\sagainst\sa\sfloating\spoint\nnumber.\s\sTicket\s#377.\s(CVS\s1045)
+D 2003-07-06T17:22:25
F Makefile.in 9ad23ed4ca97f9670c4496432e3fbd4b3760ebde
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
F src/util.c 566c7780170dd11fb1ad5de3ba81f0dfea7cccf0
F src/vacuum.c 0820984615786c9ccdaad8032a792309b354a8eb
-F src/vdbe.c f5d5779b1f1884e0922f70f459998f8f9a934097
+F src/vdbe.c 3779009cc7658d61b11d1980d6efc8af1ab0f7a1
F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
-F src/where.c 1e645d430cb4b347159c28c6085e9801160f2099
+F src/where.c 6834140938558f6ca8ee5e6decd7b6a74d65af1f
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test eccea2937923ac0be8ad1072585fd3b4f0b85598
F test/attach2.test d69003d59f5b1260dfcf3fcc5f60f164680aa7ee
F test/printf.test 3ed02f1361402c0767492cd5cef4650e61df8308
F test/quick.test c527bdb899b12a8cd8ceecce45f72922099f4095
F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
-F test/rowid.test e4d6d619d8699a1fa5a48f3f78db39985bd47ebb
+F test/rowid.test 1936d0d866a8105ab53cf6cb40a549b6664d06ce
F test/select1.test 0d708cec567104653ec9aa49fecf3444a2e7d150
F test/select2.test aceea74fd895b9d007512f72499db589735bd8e4
F test/select3.test 445a1a3dde4e2fd32541b311f55da5e2f8079d76
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P 9a87f2f326d7fc8bb9f832d0e3fd31141e14e08f
-R 690d67d55b36d46742737ebfcab1300e
+P eb4582831d536cd26a1738f9ad197e40486d0958
+R 43de0a05995ade2e959437ae132085ed
U drh
-Z bb2529e86a37931176f7781f5edf39cb
+Z 1a72f69ccd161f8e14773ca5f56644c7
-eb4582831d536cd26a1738f9ad197e40486d0958
\ No newline at end of file
+982aa3356bcc217003cd9e6a829619219c334797
\ No newline at end of file
** 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.231 2003/06/29 20:25:08 drh Exp $
+** $Id: vdbe.c,v 1.232 2003/07/06 17:22:25 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
break;
}
+/* Opcode: IsNumeric P1 P2 *
+**
+** Check the top of the stack to see if it is a numeric value. A numeric
+** value is an integer, a real number, or a string that looks like an
+** integer or a real number. When P1==0, pop the stack and jump to P2
+** if the value is numeric. Otherwise fall through and leave the stack
+** unchanged. The sense of the test is inverted when P1==1.
+*/
+case OP_IsNumeric: {
+ int tos = p->tos;
+ int r;
+ VERIFY( if( tos<0 ) goto not_enough_stack; )
+ r = (aStack[tos].flags & (STK_Int|STK_Real))!=0
+ || (zStack[tos] && sqliteIsNumber(zStack[tos]));
+ if( pOp->p1 ){
+ r = !r;
+ }
+ if( r ){
+ POPSTACK;
+ pc = pOp->p2 - 1;
+ }
+ break;
+}
+
/* Opcode: MustBeInt P1 P2 *
**
** Force the top of the stack to be an integer. If the top of the
}else if( aStack[tos].flags & STK_Str ){
int v;
if( !toInt(zStack[tos], &v) ){
- goto mismatch;
+ double r;
+ if( !sqliteIsNumber(zStack[tos]) ){
+ goto mismatch;
+ }
+ Realify(p, tos);
+ assert( (aStack[tos].flags & STK_Real)!=0 );
+ v = aStack[tos].r;
+ r = (double)v;
+ if( r!=aStack[tos].r ){
+ goto mismatch;
+ }
}
- p->aStack[tos].i = v;
+ aStack[tos].i = v;
}else{
goto mismatch;
}
Release(p, tos);
- p->aStack[tos].flags = STK_Int;
+ aStack[tos].flags = STK_Int;
break;
mismatch:
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.
**
-** $Id: where.c,v 1.79 2003/05/17 17:35:13 drh Exp $
+** $Id: where.c,v 1.80 2003/07/06 17:22:25 drh Exp $
*/
#include "sqliteInt.h"
}else{
sqliteExprCode(pParse, aExpr[k].p->pLeft);
}
- sqliteVdbeAddOp(v, OP_MustBeInt, 1, brk);
+ sqliteVdbeAddOp(v, OP_IsNumeric, 1, brk);
if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){
sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
}
}else{
sqliteExprCode(pParse, aExpr[k].p->pLeft);
}
- sqliteVdbeAddOp(v, OP_MustBeInt, 1, sqliteVdbeCurrentAddr(v)+1);
+ /* sqliteVdbeAddOp(v, OP_MustBeInt, 0, sqliteVdbeCurrentAddr(v)+1); */
pLevel->iMem = pParse->nMem++;
sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 0);
if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){
# focus of this file is testing the magic ROWID column that is
# found on all tables.
#
-# $Id: rowid.test,v 1.11 2003/06/01 01:10:33 drh Exp $
+# $Id: rowid.test,v 1.12 2003/07/06 17:22:25 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1 1 2 133 3 134}
+# ticket #377: Comparison between integer primiary key and floating point
+# values.
+#
+do_test rowid-9.1 {
+ execsql {
+ SELECT * FROM t3 WHERE a<123.5
+ }
+} {123}
+do_test rowid-9.2 {
+ execsql {
+ SELECT * FROM t3 WHERE a<124.5
+ }
+} {123 124}
+do_test rowid-9.3 {
+ execsql {
+ SELECT * FROM t3 WHERE a>123.5
+ }
+} {124}
+do_test rowid-9.4 {
+ execsql {
+ SELECT * FROM t3 WHERE a>122.5
+ }
+} {123 124}
+do_test rowid-9.5 {
+ execsql {
+ SELECT * FROM t3 WHERE a==123.5
+ }
+} {}
+do_test rowid-9.6 {
+ execsql {
+ SELECT * FROM t3 WHERE a==123.000
+ }
+} {123}
+do_test rowid-9.7 {
+ execsql {
+ SELECT * FROM t3 WHERE a>100.5 AND a<200.5
+ }
+} {123 124}
+do_test rowid-9.8 {
+ execsql {
+ SELECT * FROM t3 WHERE a>'xyz';
+ }
+} {}
+do_test rowid-9.9 {
+ execsql {
+ SELECT * FROM t3 WHERE a<'xyz';
+ }
+} {123 124}
+do_test rowid-9.10 {
+ execsql {
+ SELECT * FROM t3 WHERE a>=122.9 AND a<=123.1
+ }
+} {123}
+
finish_test