author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
# 2008 April 27 |
sl@0 | 2 |
# |
sl@0 | 3 |
# The author disclaims copyright to this source code. In place of |
sl@0 | 4 |
# a legal notice, here is a blessing: |
sl@0 | 5 |
# |
sl@0 | 6 |
# May you do good and not evil. |
sl@0 | 7 |
# May you find forgiveness for yourself and forgive others. |
sl@0 | 8 |
# May you share freely, never taking more than you give. |
sl@0 | 9 |
# |
sl@0 | 10 |
#*********************************************************************** |
sl@0 | 11 |
# |
sl@0 | 12 |
# Ticket #3080 |
sl@0 | 13 |
# |
sl@0 | 14 |
# Make sure that application-defined functions are able to recursively |
sl@0 | 15 |
# invoke SQL statements that create and drop virtual tables. |
sl@0 | 16 |
# |
sl@0 | 17 |
# $Id: tkt3080.test,v 1.1 2008/04/28 17:12:11 drh Exp $ |
sl@0 | 18 |
# |
sl@0 | 19 |
|
sl@0 | 20 |
set testdir [file dirname $argv0] |
sl@0 | 21 |
source $testdir/tester.tcl |
sl@0 | 22 |
|
sl@0 | 23 |
do_test tkt3080.1 { |
sl@0 | 24 |
db function execsql execsql |
sl@0 | 25 |
db eval { |
sl@0 | 26 |
SELECT execsql('CREATE TABLE t1(x)'); |
sl@0 | 27 |
} |
sl@0 | 28 |
execsql {SELECT name FROM sqlite_master} |
sl@0 | 29 |
} {t1} |
sl@0 | 30 |
do_test tkt3080.2 { |
sl@0 | 31 |
db eval { |
sl@0 | 32 |
INSERT INTO t1 VALUES('CREATE TABLE t2(y);'); |
sl@0 | 33 |
SELECT execsql(x) FROM t1; |
sl@0 | 34 |
} |
sl@0 | 35 |
db eval { |
sl@0 | 36 |
SELECT name FROM sqlite_master; |
sl@0 | 37 |
} |
sl@0 | 38 |
} {t1 t2} |
sl@0 | 39 |
do_test tkt3080.3 { |
sl@0 | 40 |
execsql { |
sl@0 | 41 |
INSERT INTO t1 VALUES('CREATE TABLE t3(z); DROP TABLE t3;'); |
sl@0 | 42 |
} |
sl@0 | 43 |
catchsql { |
sl@0 | 44 |
SELECT execsql(x) FROM t1 WHERE rowid=2; |
sl@0 | 45 |
} |
sl@0 | 46 |
} {1 {database table is locked}} |
sl@0 | 47 |
do_test tkt3080.4 { |
sl@0 | 48 |
db eval { |
sl@0 | 49 |
SELECT name FROM sqlite_master; |
sl@0 | 50 |
} |
sl@0 | 51 |
} {t1 t2} |
sl@0 | 52 |
|
sl@0 | 53 |
ifcapable vtab { |
sl@0 | 54 |
register_echo_module [sqlite3_connection_pointer db] |
sl@0 | 55 |
do_test tkt3080.10 { |
sl@0 | 56 |
set sql { |
sl@0 | 57 |
CREATE VIRTUAL TABLE t4 USING echo(t2); |
sl@0 | 58 |
INSERT INTO t4 VALUES(123); |
sl@0 | 59 |
DROP TABLE t4; |
sl@0 | 60 |
} |
sl@0 | 61 |
execsql { |
sl@0 | 62 |
DELETE FROM t1; |
sl@0 | 63 |
INSERT INTO t1 VALUES($sql); |
sl@0 | 64 |
} |
sl@0 | 65 |
db eval { |
sl@0 | 66 |
SELECT execsql(x) FROM t1 |
sl@0 | 67 |
} |
sl@0 | 68 |
execsql {SELECT name FROM sqlite_master} |
sl@0 | 69 |
} {t1 t2} |
sl@0 | 70 |
do_test tkt3080.11 { |
sl@0 | 71 |
execsql {SELECT * FROM t2} |
sl@0 | 72 |
} {123} |
sl@0 | 73 |
} |
sl@0 | 74 |
|
sl@0 | 75 |
|
sl@0 | 76 |
|
sl@0 | 77 |
finish_test |