/ Check-in [fa10c6df]
Login

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

Overview
Comment:Adjust test cases to cope with the extra column returned by the database_list pragma. (CVS 1004)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fa10c6df5a80127508fb198c21ef93acfc93ebe2
User & Date: drh 2003-06-04 15:53:02
Context
2003-06-04
16:24
Fix a bug in UPDATE OR REPLACE that was introduced by check-in (999). Also clean up some compiler warnings for VC++. (CVS 1005) check-in: af6f2bdf user: drh tags: trunk
15:53
Adjust test cases to cope with the extra column returned by the database_list pragma. (CVS 1004) check-in: fa10c6df user: drh tags: trunk
15:48
Change the "database_list" pragma to return a third column containing the filename of the underlying database file. Always use an in-memory TEMP database with an in-memory main database. (CVS 1003) check-in: f39100f5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/attach.test.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
90
91
92
93
94
95
96
97
98
99

100




101
102
103
104
105
106
107
...
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
...
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach.test,v 1.8 2003/06/04 12:31:53 drh Exp $
#

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

for {set i 2} {$i<=15} {incr i} {
  file delete -force test$i.db
................................................................................
    ATTACH 'test.db' AS db5;
    ATTACH 'test.db' AS db6;
    ATTACH 'test.db' AS db7;
    ATTACH 'test.db' AS db8;
    ATTACH 'test.db' AS db9;
  }
} {}
do_test attach-1.11b {
  execsql {
    PRAGMA database_list;

  }




} {0 main 1 temp 2 db2 3 db3 4 db4 5 db5 6 db6 7 db7 8 db8 9 db9}
do_test attach-1.12 {
  catchsql {
    ATTACH 'test.db' as db2;
  }
} {1 {database db2 is already in use}}
do_test attach-1.13 {
................................................................................
  catchsql {
    ATTACH 'test.db' as db12;
  }
} {1 {too many attached databases - max 10}}
do_test attach-1.20 {
  execsql {
    DETACH db5;
    PRAGMA database_list;
  }

} {0 main 1 temp 2 db2 3 db3 4 db4 5 db11 6 db6 7 db7 8 db8 9 db9 10 db10}
do_test attach-1.21 {
  catchsql {
    ATTACH 'test.db' as db12;
  }
} {0 {}}
do_test attach-1.22 {
................................................................................
    DETACH db6;
    DETACH db4;
    DETACH db3;
    DETACH db2;
  }
} {0 {}}
do_test attach-1.29 {
  execsql {
    PRAGMA database_list
  }
} {0 main 1 temp}

do_test attach-2.1 {
  execsql {
    CREATE TABLE tx(x1,x2,y1,y2);
    CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
      INSERT INTO tx(x1,x2,y1,y2) VALUES(OLD.x,NEW.x,OLD.y,NEW.y);
................................................................................
} {}
do_test attach-2.7 {
  execsql {
    SELECT type, name, tbl_name FROM db2.sqlite_master;
  }
} {table t2 t2 table tx tx trigger r1 t2}
do_test attach-2.8 {
  execsql {
    PRAGMA database_list
  }
} {0 main 1 temp 2 db2}
do_test attach-2.9 {
  execsql {
    CREATE INDEX i2 ON t2(x);
    SELECT * FROM t2 WHERE x>5;
  } db2
} {21 x 22 y}
................................................................................
} {table t2 t2 table tx tx trigger r1 t2 index i2 t2}
do_test attach-2.11 {
  catchsql { 
    SELECT * FROM t2 WHERE x>5;
  }
} {1 {database schema has changed}}
do_test attach-2.12 {
  execsql {
    PRAGMA database_list
  }
} {0 main 1 temp 2 db2}
do_test attach-2.13 {
  catchsql {
    SELECT * FROM t2 WHERE x>5;
  }
} {0 {21 x 22 y}}
do_test attach-2.14 {







|







 







|
|
|
>

>
>
>
>







 







<

>







 







|
<
<







 







|
<
<







 







|
<
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
...
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
...
196
197
198
199
200
201
202
203


204
205
206
207
208
209
210
...
242
243
244
245
246
247
248
249


250
251
252
253
254
255
256
...
261
262
263
264
265
266
267
268


269
270
271
272
273
274
275
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach.test,v 1.9 2003/06/04 15:53:02 drh Exp $
#

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

for {set i 2} {$i<=15} {incr i} {
  file delete -force test$i.db
................................................................................
    ATTACH 'test.db' AS db5;
    ATTACH 'test.db' AS db6;
    ATTACH 'test.db' AS db7;
    ATTACH 'test.db' AS db8;
    ATTACH 'test.db' AS db9;
  }
} {}
proc db_list {db} {
  set list {}
  foreach {idx name file} [execsql {PRAGMA database_list} $db] {
    lappend list $idx $name
  }
  return $list
}
do_test attach-1.11b {
  db_list db
} {0 main 1 temp 2 db2 3 db3 4 db4 5 db5 6 db6 7 db7 8 db8 9 db9}
do_test attach-1.12 {
  catchsql {
    ATTACH 'test.db' as db2;
  }
} {1 {database db2 is already in use}}
do_test attach-1.13 {
................................................................................
  catchsql {
    ATTACH 'test.db' as db12;
  }
} {1 {too many attached databases - max 10}}
do_test attach-1.20 {
  execsql {
    DETACH db5;

  }
  db_list db
} {0 main 1 temp 2 db2 3 db3 4 db4 5 db11 6 db6 7 db7 8 db8 9 db9 10 db10}
do_test attach-1.21 {
  catchsql {
    ATTACH 'test.db' as db12;
  }
} {0 {}}
do_test attach-1.22 {
................................................................................
    DETACH db6;
    DETACH db4;
    DETACH db3;
    DETACH db2;
  }
} {0 {}}
do_test attach-1.29 {
  db_list db


} {0 main 1 temp}

do_test attach-2.1 {
  execsql {
    CREATE TABLE tx(x1,x2,y1,y2);
    CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
      INSERT INTO tx(x1,x2,y1,y2) VALUES(OLD.x,NEW.x,OLD.y,NEW.y);
................................................................................
} {}
do_test attach-2.7 {
  execsql {
    SELECT type, name, tbl_name FROM db2.sqlite_master;
  }
} {table t2 t2 table tx tx trigger r1 t2}
do_test attach-2.8 {
  db_list db


} {0 main 1 temp 2 db2}
do_test attach-2.9 {
  execsql {
    CREATE INDEX i2 ON t2(x);
    SELECT * FROM t2 WHERE x>5;
  } db2
} {21 x 22 y}
................................................................................
} {table t2 t2 table tx tx trigger r1 t2 index i2 t2}
do_test attach-2.11 {
  catchsql { 
    SELECT * FROM t2 WHERE x>5;
  }
} {1 {database schema has changed}}
do_test attach-2.12 {
  db_list db


} {0 main 1 temp 2 db2}
do_test attach-2.13 {
  catchsql {
    SELECT * FROM t2 WHERE x>5;
  }
} {0 {21 x 22 y}}
do_test attach-2.14 {