OLD | NEW |
1 # 2005 February 19 | 1 # 2005 February 19 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #************************************************************************* | 10 #************************************************************************* |
(...skipping 10 matching lines...) Expand all Loading... |
21 source $testdir/tester.tcl | 21 source $testdir/tester.tcl |
22 | 22 |
23 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. | 23 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. |
24 ifcapable !altertable { | 24 ifcapable !altertable { |
25 finish_test | 25 finish_test |
26 return | 26 return |
27 } | 27 } |
28 | 28 |
29 # Determine if there is a codec available on this test. | 29 # Determine if there is a codec available on this test. |
30 # | 30 # |
31 if {[catch {sqlite3 -has_codec} r] || $r} { | 31 if {[catch {sqlite3 -has-codec} r] || $r} { |
32 set has_codec 1 | 32 set has_codec 1 |
33 } else { | 33 } else { |
34 set has_codec 0 | 34 set has_codec 0 |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 # Test Organisation: | 38 # Test Organisation: |
39 # ------------------ | 39 # ------------------ |
40 # | 40 # |
41 # alter3-1.*: Test that ALTER TABLE correctly modifies the CREATE TABLE sql. | 41 # alter3-1.*: Test that ALTER TABLE correctly modifies the CREATE TABLE sql. |
42 # alter3-2.*: Test error messages. | 42 # alter3-2.*: Test error messages. |
43 # alter3-3.*: Test adding columns with default value NULL. | 43 # alter3-3.*: Test adding columns with default value NULL. |
44 # alter3-4.*: Test adding columns with default values other than NULL. | 44 # alter3-4.*: Test adding columns with default values other than NULL. |
45 # alter3-5.*: Test adding columns to tables in ATTACHed databases. | 45 # alter3-5.*: Test adding columns to tables in ATTACHed databases. |
46 # alter3-6.*: Test that temp triggers are not accidentally dropped. | 46 # alter3-6.*: Test that temp triggers are not accidentally dropped. |
47 # alter3-7.*: Test that VACUUM resets the file-format. | 47 # alter3-7.*: Test that VACUUM resets the file-format. |
48 # | 48 # |
49 | 49 |
50 # This procedure returns the value of the file-format in file 'test.db'. | 50 # This procedure returns the value of the file-format in file 'test.db'. |
51 # | 51 # |
52 proc get_file_format {{fname test.db}} { | 52 proc get_file_format {{fname test.db}} { |
53 return [hexio_get_int [hexio_read $fname 44 4]] | 53 return [hexio_get_int [hexio_read $fname 44 4]] |
54 } | 54 } |
55 | 55 |
56 do_test alter3-1.1 { | 56 do_test alter3-1.1 { |
57 execsql { | 57 execsql { |
| 58 PRAGMA legacy_file_format=ON; |
58 CREATE TABLE abc(a, b, c); | 59 CREATE TABLE abc(a, b, c); |
59 SELECT sql FROM sqlite_master; | 60 SELECT sql FROM sqlite_master; |
60 } | 61 } |
61 } {{CREATE TABLE abc(a, b, c)}} | 62 } {{CREATE TABLE abc(a, b, c)}} |
62 do_test alter3-1.2 { | 63 do_test alter3-1.2 { |
63 execsql {ALTER TABLE abc ADD d INTEGER;} | 64 execsql {ALTER TABLE abc ADD d INTEGER;} |
64 execsql { | 65 execsql { |
65 SELECT sql FROM sqlite_master; | 66 SELECT sql FROM sqlite_master; |
66 } | 67 } |
67 } {{CREATE TABLE abc(a, b, c, d INTEGER)}} | 68 } {{CREATE TABLE abc(a, b, c, d INTEGER)}} |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 PRAGMA schema_version; | 192 PRAGMA schema_version; |
192 } | 193 } |
193 } {11} | 194 } {11} |
194 } | 195 } |
195 | 196 |
196 do_test alter3-4.1 { | 197 do_test alter3-4.1 { |
197 db close | 198 db close |
198 file delete -force test.db | 199 file delete -force test.db |
199 set ::DB [sqlite3 db test.db] | 200 set ::DB [sqlite3 db test.db] |
200 execsql { | 201 execsql { |
| 202 PRAGMA legacy_file_format=ON; |
201 CREATE TABLE t1(a, b); | 203 CREATE TABLE t1(a, b); |
202 INSERT INTO t1 VALUES(1, 100); | 204 INSERT INTO t1 VALUES(1, 100); |
203 INSERT INTO t1 VALUES(2, 300); | 205 INSERT INTO t1 VALUES(2, 300); |
204 SELECT * FROM t1; | 206 SELECT * FROM t1; |
205 } | 207 } |
206 } {1 100 2 300} | 208 } {1 100 2 300} |
207 do_test alter3-4.1 { | 209 do_test alter3-4.1 { |
208 execsql { | 210 execsql { |
209 PRAGMA schema_version = 20; | 211 PRAGMA schema_version = 20; |
210 } | 212 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 set ::sql "CREATE TABLE t4([join $cols {, }])" | 388 set ::sql "CREATE TABLE t4([join $cols {, }])" |
387 list | 389 list |
388 } {} | 390 } {} |
389 do_test alter3-8.2 { | 391 do_test alter3-8.2 { |
390 execsql { | 392 execsql { |
391 SELECT sql FROM sqlite_master WHERE name = 't4'; | 393 SELECT sql FROM sqlite_master WHERE name = 't4'; |
392 } | 394 } |
393 } [list $::sql] | 395 } [list $::sql] |
394 | 396 |
395 finish_test | 397 finish_test |
OLD | NEW |