1 # 2008 August 12 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # This file implements regression tests for SQLite library. 12 # Specifically, it tests the behavior of the sqlite3VdbeRecordCompare() 13 # routine in cases where the rowid is 0 or 1 in file format 4 14 # (meaning that the rowid has type code 8 or 9 with zero bytes of 15 # data). Ticket #3292. 16 # 17 # $Id: tkt3292.test,v 1.1 2008/08/13 14:07:41 drh Exp $ 18 19 set testdir [file dirname $argv0] 20 source $testdir/tester.tcl 21 22 do_test tkt3292-1.1 { 23 execsql { 24 PRAGMA legacy_file_format=OFF; 25 CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT); 26 INSERT INTO t1 VALUES(0, 1); 27 INSERT INTO t1 VALUES(1, 1); 28 INSERT INTO t1 VALUES(2, 1); 29 CREATE INDEX i1 ON t1(b); 30 SELECT * FROM t1 WHERE b>=1; 31 } 32 } {0 1 1 1 2 1} 33 do_test tkt3292-1.2 { 34 execsql { 35 INSERT INTO t1 VALUES(3, 0); 36 INSERT INTO t1 VALUES(4, 2); 37 SELECT * FROM t1 WHERE b>=1; 38 } 39 } {0 1 1 1 2 1 4 2} 40 41 42 do_test tkt3292-2.1 { 43 execsql { 44 CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c, d); 45 INSERT INTO t2 VALUES(0, 1, 'hello', x'012345'); 46 INSERT INTO t2 VALUES(1, 1, 'hello', x'012345'); 47 INSERT INTO t2 VALUES(2, 1, 'hello', x'012345'); 48 CREATE INDEX i2 ON t2(b,c,d); 49 SELECT a FROM t2 WHERE b=1 AND c='hello' AND d>=x'012345'; 50 } 51 } {0 1 2} 52 do_test tkt3292-2.2 { 53 execsql { 54 INSERT INTO t2 VALUES(3, 1, 'hello', x'012344'); 55 INSERT INTO t2 VALUES(4, 1, 'hello', x'012346'); 56 SELECT a FROM t2 WHERE b=1 AND c='hello' AND d>=x'012345'; 57 } 58 } {0 1 2 4} 59 60 61 finish_test 62