vtabE.test 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # 2009 November 23
  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. #
  13. # The focus of this file making sure the register cache logic works
  14. # correctly with virtual tables. Ticket [16fbf14cb2].
  15. #
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. ifcapable !vtab {
  19. finish_test
  20. return
  21. }
  22. register_tclvar_module [sqlite3_connection_pointer db]
  23. unset -nocomplain vtabE
  24. set vtabE(vtabE1) 11
  25. set vtabE(vtabE2) 22
  26. unset -nocomplain vtabE1
  27. set vtabE1(w) x
  28. set vtabE1(y) z
  29. unset -nocomplain vtabE2
  30. set vtabE2(a) b
  31. set vtabE2(c) d
  32. do_test vtabE-1 {
  33. db eval {
  34. CREATE VIRTUAL TABLE t1 USING tclvar;
  35. CREATE VIRTUAL TABLE t2 USING tclvar;
  36. CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
  37. SELECT t1.*, t2.*, abs(t3.b + abs(t2.value + abs(t1.value)))
  38. FROM t1 LEFT JOIN t2 ON t2.name = t1.arrayname
  39. LEFT JOIN t3 ON t3.a=t2.value
  40. WHERE t1.name = 'vtabE'
  41. ORDER BY t1.value, t2.value;
  42. }
  43. } {vtabE vtabE1 11 vtabE1 w x {} vtabE vtabE1 11 vtabE1 y z {} vtabE vtabE2 22 vtabE2 a b {} vtabE vtabE2 22 vtabE2 c d {}}