~ubuntu-branches/ubuntu/maverick/sqlite3/maverick-updates

« back to all changes in this revision

Viewing changes to test/vtabB.test

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2008-10-01 20:16:18 UTC
  • mfrom: (3.1.20 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081001201618-yfvqqj1qs29wdtcc
Tags: 3.5.9-5
Backport fix for distinct on indexes (closes: #500792).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# 2008 April 10
 
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.  The
 
12
# focus of this file is is verifying that a virtual table in the
 
13
# TEMP database that is created and dropped within a transaction
 
14
# is handled correctly.  Ticket #2994.
 
15
#
 
16
# Also make sure a virtual table on the right-hand side of an IN operator
 
17
# is materialized rather than being used directly.  Ticket #3082.
 
18
#
 
19
 
 
20
#
 
21
# $Id: vtabB.test,v 1.2 2008/04/25 12:10:15 drh Exp $
 
22
 
 
23
set testdir [file dirname $argv0]
 
24
source $testdir/tester.tcl
 
25
 
 
26
ifcapable !vtab {
 
27
  finish_test
 
28
  return
 
29
}
 
30
 
 
31
do_test vtabB-1.1 {
 
32
  register_echo_module [sqlite3_connection_pointer db]
 
33
  execsql {
 
34
    CREATE TABLE t1(x);
 
35
    BEGIN;
 
36
    CREATE VIRTUAL TABLE temp.echo_test1 USING echo(t1);
 
37
    DROP TABLE echo_test1;
 
38
    ROLLBACK;
 
39
  }
 
40
} {}
 
41
 
 
42
do_test vtabB-2.1 {
 
43
  execsql {
 
44
    INSERT INTO t1 VALUES(2);
 
45
    INSERT INTO t1 VALUES(3);
 
46
    CREATE TABLE t2(y);
 
47
    INSERT INTO t2 VALUES(1);
 
48
    INSERT INTO t2 VALUES(2);
 
49
    CREATE VIRTUAL TABLE echo_t2 USING echo(t2);
 
50
    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2);
 
51
  }
 
52
} {2}
 
53
do_test vtab8-2.2 {
 
54
  execsql {
 
55
    SELECT rowid FROM echo_t2
 
56
  }
 
57
} {1 2}
 
58
do_test vtabB-2.3 {
 
59
  execsql {
 
60
    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2);
 
61
  }
 
62
} {2}
 
63
do_test vtabB-2.4 {
 
64
  execsql {
 
65
    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM echo_t2);
 
66
  }
 
67
} {2}
 
68
do_test vtabB-2.5 {
 
69
  execsql {
 
70
    SELECT * FROM t1 WHERE x IN (SELECT y FROM t2);
 
71
  }
 
72
} {2}
 
73
do_test vtabB-2.6 {
 
74
  execsql {
 
75
    SELECT * FROM t1 WHERE x IN (SELECT y FROM echo_t2);
 
76
  }
 
77
} {2}
 
78
 
 
79
finish_test