danielk1977 | a41c749 | 2007-03-02 07:27:00 +0000 | [diff] [blame] | 1 | # 2006 August 29 |
| 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 inserting into virtual tables from a SELECT |
| 13 | # statement. |
| 14 | # |
danielk1977 | 8efe541 | 2007-03-02 08:12:22 +0000 | [diff] [blame] | 15 | # $Id: vtab8.test,v 1.2 2007/03/02 08:12:23 danielk1977 Exp $ |
danielk1977 | a41c749 | 2007-03-02 07:27:00 +0000 | [diff] [blame] | 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_echo_module [sqlite3_connection_pointer db] |
| 26 | |
| 27 | # See ticket #2244 |
| 28 | # |
| 29 | do_test vtab1.2244-1 { |
| 30 | execsql { |
| 31 | CREATE TABLE t2244(a, b); |
| 32 | CREATE VIRTUAL TABLE t2244e USING echo(t2244); |
| 33 | INSERT INTO t2244 VALUES('AA', 'BB'); |
| 34 | INSERT INTO t2244 VALUES('CC', 'DD'); |
| 35 | SELECT rowid, * FROM t2244e; |
| 36 | } |
| 37 | } {1 AA BB 2 CC DD} |
| 38 | do_test vtab1.2244-2 { |
| 39 | execsql { |
| 40 | SELECT * FROM t2244e WHERE rowid = 10; |
| 41 | } |
| 42 | } {} |
| 43 | do_test vtab1.2244-3 { |
| 44 | execsql { |
| 45 | UPDATE t2244e SET a = 'hello world' WHERE 0; |
| 46 | SELECT rowid, * FROM t2244e; |
| 47 | } |
| 48 | } {1 AA BB 2 CC DD} |
| 49 | |
| 50 | do_test vtab1-2250-2 { |
| 51 | execsql { |
| 52 | CREATE TABLE t2250(a, b); |
| 53 | INSERT INTO t2250 VALUES(10, 20); |
| 54 | CREATE VIRTUAL TABLE t2250e USING echo(t2250); |
| 55 | select max(rowid) from t2250; |
| 56 | select max(rowid) from t2250e; |
| 57 | } |
| 58 | } {1 1} |
| 59 | |
danielk1977 | 8efe541 | 2007-03-02 08:12:22 +0000 | [diff] [blame] | 60 | # See ticket #2260. |
danielk1977 | a41c749 | 2007-03-02 07:27:00 +0000 | [diff] [blame] | 61 | # |
| 62 | do_test vtab1.2260-1 { |
| 63 | execsql { |
| 64 | CREATE TABLE t2260a_real(a, b); |
| 65 | CREATE TABLE t2260b_real(a, b); |
| 66 | |
| 67 | CREATE INDEX i2260 ON t2260a_real(a); |
| 68 | CREATE INDEX i2260x ON t2260b_real(a); |
| 69 | |
| 70 | CREATE VIRTUAL TABLE t2260a USING echo(t2260a_real); |
| 71 | CREATE VIRTUAL TABLE t2260b USING echo(t2260b_real); |
| 72 | |
| 73 | SELECT * FROM t2260a, t2260b WHERE t2260a.a = t2260b.a AND t2260a.a > 101; |
| 74 | } |
| 75 | } {} |
| 76 | |
| 77 | unset -nocomplain echo_module_begin_fail |
| 78 | finish_test |