vtabF.test 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # 2011 Aug 1
  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. # This file checks to make sure IS NOT NULL constraints work on
  13. # virtual tables.
  14. #
  15. set testdir [file dirname $argv0]
  16. source $testdir/tester.tcl
  17. ifcapable !vtab||!schema_pragmas { finish_test ; return }
  18. # Register the echo module
  19. register_echo_module [sqlite3_connection_pointer db]
  20. do_test vtabE-1.1 {
  21. execsql {
  22. CREATE TABLE t1(a, b);
  23. CREATE INDEX i1 ON t1(a);
  24. CREATE INDEX i2 ON t1(b);
  25. INSERT INTO t1 VALUES(10,110);
  26. INSERT INTO t1 VALUES(11,111);
  27. INSERT INTO t1 SELECT a+2, b+2 FROM t1;
  28. INSERT INTO t1 SELECT null, b+4 FROM t1;
  29. INSERT INTO t1 SELECT null, b+8 FROM t1;
  30. INSERT INTO t1 SELECT null, b+16 FROM t1;
  31. ANALYZE;
  32. CREATE VIRTUAL TABLE tv1 USING echo(t1);
  33. SELECT b FROM t1 WHERE a IS NOT NULL;
  34. }
  35. } {110 111 112 113}
  36. do_test vtabE-1.2 {
  37. execsql {SELECT b FROM tv1 WHERE a IS NOT NULL}
  38. } {110 111 112 113}
  39. finish_test