summaryrefslogtreecommitdiffstats
path: root/test/vtabE.test
blob: cbb6a1e30a622cdb81700a97f1cdbdffaca9b16f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 2009 November 23
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# The focus of this file making sure the register cache logic works
# correctly with virtual tables.  Ticket [16fbf14cb2].
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !vtab {
  finish_test
  return
}

register_tclvar_module [sqlite3_connection_pointer db]

unset -nocomplain vtabE
set vtabE(vtabE1) 11
set vtabE(vtabE2) 22
unset -nocomplain vtabE1
set vtabE1(w) x
set vtabE1(y) z
unset -nocomplain vtabE2
set vtabE2(a) b
set vtabE2(c) d

do_test vtabE-1 {
  db eval {
    CREATE VIRTUAL TABLE t1 USING tclvar;
    CREATE VIRTUAL TABLE t2 USING tclvar;
    CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
    SELECT t1.name, t1.arrayname, t1.value,
           t2.name, t2.arrayname, t2.value,
           abs(t3.b + abs(t2.value + abs(t1.value)))
      FROM t1 LEFT JOIN t2 ON t2.name = t1.arrayname
           LEFT JOIN t3 ON t3.a=t2.value
     WHERE t1.name = 'vtabE'
     ORDER BY t1.value, t2.value;
  }
} {vtabE vtabE1 11 vtabE1 w x {} vtabE vtabE1 11 vtabE1 y z {} vtabE vtabE2 22 vtabE2 a b {} vtabE vtabE2 22 vtabE2 c d {}}

finish_test