/ Check-in [8c07b609]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add tests for creating temp schema objects with SQLITE_OPEN_REUSE_SCHEMA connections.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256: 8c07b609fccc43795498b942c733896defd8887e4ddd9e0ef48c124dfcf9fd7f
User & Date: dan 2019-02-12 20:58:34
Wiki:reuse-schema
Context
2019-02-13
08:40
Fix a problem with OPEN_REUSE_SCHEMA connections reloading the temp schema. check-in: 7c2ec2d4 user: dan tags: reuse-schema
2019-02-12
20:58
Add tests for creating temp schema objects with SQLITE_OPEN_REUSE_SCHEMA connections. check-in: 8c07b609 user: dan tags: reuse-schema
19:20
Share schemas between databases attached to the same database handle. check-in: ea611d7c user: dan tags: reuse-schema
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/reuse3.test.

            1  +# 2019 February 12
            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  +#
           12  +#
           13  +
           14  +
           15  +set testdir [file dirname $argv0]
           16  +source $testdir/tester.tcl
           17  +set testprefix reuse3
           18  +
           19  +do_execsql_test 1.0 {
           20  +  CREATE TABLE t1(x INTEGER PRIMARY KEY, y UNIQUE, z);
           21  +  CREATE INDEX i1 ON t1(z);
           22  +  CREATE TABLE t2(a);
           23  +} {}
           24  +
           25  +db close
           26  +sqlite3 db test.db -reuse-schema 1
           27  +
           28  +do_execsql_test 1.1 {
           29  +  CREATE TEMP VIEW v1 AS SELECT * FROM t1;
           30  +  SELECT * FROM v1;
           31  +}
           32  +
           33  +do_execsql_test 1.2 {
           34  +  CREATE TEMP TRIGGER tr1 AFTER INSERT ON t1 BEGIN
           35  +    INSERT INTO t2 VALUES(new.x);
           36  +  END;
           37  +}
           38  +
           39  +do_execsql_test 1.3 {
           40  +  INSERT INTO t1 VALUES(1, 2, 3);
           41  +}
           42  +
           43  +do_execsql_test 1.4 {
           44  +  SELECT * FROM t2
           45  +} {1}
           46  +
           47  +do_execsql_test 1.5 {
           48  +  SELECT * FROM v1
           49  +} {1 2 3}
           50  +
           51  +do_execsql_test 1.6 {
           52  +  BEGIN;
           53  +    DROP TRIGGER tr1;
           54  +  ROLLBACK;
           55  +  INSERT INTO t1 VALUES(4, 5, 6);
           56  +  SELECT * FROM t2
           57  +} {1 4}
           58  +
           59  +do_execsql_test 1.7 {
           60  +  SELECT * FROM v1
           61  +} {1 2 3 4 5 6}
           62  +
           63  +finish_test
           64  +
           65  +