tkt3292.test 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. set testdir [file dirname $argv0]
  19. source $testdir/tester.tcl
  20. do_test tkt3292-1.1 {
  21. execsql {
  22. PRAGMA legacy_file_format=OFF;
  23. CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT);
  24. INSERT INTO t1 VALUES(0, 1);
  25. INSERT INTO t1 VALUES(1, 1);
  26. INSERT INTO t1 VALUES(2, 1);
  27. CREATE INDEX i1 ON t1(b);
  28. SELECT * FROM t1 WHERE b>=1;
  29. }
  30. } {0 1 1 1 2 1}
  31. do_test tkt3292-1.2 {
  32. execsql {
  33. INSERT INTO t1 VALUES(3, 0);
  34. INSERT INTO t1 VALUES(4, 2);
  35. SELECT * FROM t1 WHERE b>=1;
  36. }
  37. } {0 1 1 1 2 1 4 2}
  38. do_test tkt3292-2.1 {
  39. execsql {
  40. CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c, d);
  41. INSERT INTO t2 VALUES(0, 1, 'hello', x'012345');
  42. INSERT INTO t2 VALUES(1, 1, 'hello', x'012345');
  43. INSERT INTO t2 VALUES(2, 1, 'hello', x'012345');
  44. CREATE INDEX i2 ON t2(b,c,d);
  45. SELECT a FROM t2 WHERE b=1 AND c='hello' AND d>=x'012345';
  46. }
  47. } {0 1 2}
  48. do_test tkt3292-2.2 {
  49. execsql {
  50. INSERT INTO t2 VALUES(3, 1, 'hello', x'012344');
  51. INSERT INTO t2 VALUES(4, 1, 'hello', x'012346');
  52. SELECT a FROM t2 WHERE b=1 AND c='hello' AND d>=x'012345';
  53. }
  54. } {0 1 2 4}
  55. finish_test