Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | :-) (CVS 13) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
191a7f484e0a10839e7e1c8eb6658536 |
User & Date: | drh 2000-05-30 03:28:36.000 |
Context
2000-05-30
| ||
13:44 | :-) (CVS 14) (check-in: 1bb8ee8d9f user: drh tags: trunk) | |
03:28 | :-) (CVS 13) (check-in: 191a7f484e user: drh tags: trunk) | |
03:12 | :-) (CVS 12) (check-in: 20f2811fc1 user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. Also found here are subroutines ** to generate VDBE code to evaluate expressions. ** | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. Also found here are subroutines ** to generate VDBE code to evaluate expressions. ** ** $Id: where.c,v 1.2 2000/05/30 03:28:36 drh Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
363 364 365 366 367 368 369 | switch( pExpr->op ){ case TK_PLUS: op = OP_Add; break; case TK_MINUS: op = OP_Subtract; break; case TK_STAR: op = OP_Multiply; break; case TK_SLASH: op = OP_Divide; break; case TK_AND: op = OP_And; break; case TK_OR: op = OP_Or; break; | | | | | | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | switch( pExpr->op ){ case TK_PLUS: op = OP_Add; break; case TK_MINUS: op = OP_Subtract; break; case TK_STAR: op = OP_Multiply; break; case TK_SLASH: op = OP_Divide; break; case TK_AND: op = OP_And; break; case TK_OR: op = OP_Or; break; case TK_LT: op = OP_Ge; break; case TK_LE: op = OP_Gt; break; case TK_GT: op = OP_Le; break; case TK_GE: op = OP_Lt; break; case TK_NE: op = OP_Eq; break; case TK_EQ: op = OP_Ne; break; case TK_ISNULL: op = OP_IsNull; break; case TK_NOTNULL: op = OP_NotNull; break; case TK_NOT: op = OP_Not; break; case TK_UMINUS: op = OP_Negative; break; default: break; } switch( pExpr->op ){ |
︙ | ︙ |
Added test/expr.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # Copyright (c) 1999, 2000 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing expressions. # # $Id: expr.test,v 1.1 2000/05/30 03:28:36 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table to work with. # execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)} execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')} proc test_expr {name settings expr result} { do_test $name [format { execsql {UPDATE test1 SET %s} execsql {SELECT %s FROM test1} } $settings $expr] $result } test_expr expr-1.1 {i1=10, i2=20} {i1+i2} 30 test_expr expr-1.2 {i1=10, i2=20} {i1-i2} -10 test_expr expr-1.3 {i1=10, i2=20} {i1*i2} 200 test_expr expr-1.4 {i1=10, i2=20} {i1/i2} 0.5 test_expr expr-1.5 {i1=10, i2=20} {i2/i1} 2 test_expr expr-1.6 {i1=10, i2=20} {i2<i1} 0 test_expr expr-1.7 {i1=10, i2=20} {i2<=i1} 0 test_expr expr-1.8 {i1=10, i2=20} {i2>i1} 1 test_expr expr-1.9 {i1=10, i2=20} {i2>=i1} 1 test_expr expr-1.10 {i1=10, i2=20} {i2!=i1} 1 test_expr expr-1.11 {i1=10, i2=20} {i2=i1} 0 test_expr expr-1.12 {i1=10, i2=20} {i2<>i1} 1 test_expr expr-1.13 {i1=10, i2=20} {i2==i1} 0 test_expr expr-1.14 {i1=20, i2=20} {i2<i1} 0 test_expr expr-1.15 {i1=20, i2=20} {i2<=i1} 1 test_expr expr-1.16 {i1=20, i2=20} {i2>i1} 0 test_expr expr-1.17 {i1=20, i2=20} {i2>=i1} 1 test_expr expr-1.18 {i1=20, i2=20} {i2!=i1} 0 test_expr expr-1.19 {i1=20, i2=20} {i2=i1} 1 test_expr expr-1.20 {i1=20, i2=20} {i2<>i1} 0 test_expr expr-1.21 {i1=20, i2=20} {i2==i1} 1 test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7} test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9} finish_test |