Home | History | Annotate | Download | only in test
      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 
     17 set testdir [file dirname $argv0]
     18 source $testdir/tester.tcl
     19 
     20 ifcapable !vtab {
     21   finish_test
     22   return
     23 }
     24 
     25 register_tclvar_module [sqlite3_connection_pointer db]
     26 
     27 unset -nocomplain vtabE
     28 set vtabE(vtabE1) 11
     29 set vtabE(vtabE2) 22
     30 unset -nocomplain vtabE1
     31 set vtabE1(w) x
     32 set vtabE1(y) z
     33 unset -nocomplain vtabE2
     34 set vtabE2(a) b
     35 set vtabE2(c) d
     36 
     37 do_test vtabE-1 {
     38   db eval {
     39     CREATE VIRTUAL TABLE t1 USING tclvar;
     40     CREATE VIRTUAL TABLE t2 USING tclvar;
     41     CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
     42     SELECT t1.*, t2.*, abs(t3.b + abs(t2.value + abs(t1.value)))
     43       FROM t1 LEFT JOIN t2 ON t2.name = t1.arrayname
     44            LEFT JOIN t3 ON t3.a=t2.value
     45      WHERE t1.name = 'vtabE'
     46      ORDER BY t1.value, t2.value;
     47   }
     48 } {vtabE vtabE1 11 vtabE1 w x {} vtabE vtabE1 11 vtabE1 y z {} vtabE vtabE2 22 vtabE2 a b {} vtabE vtabE2 22 vtabE2 c d {}}
     49