Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: third_party/sqlite/src/test/alter4.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/alter3.test ('k') | third_party/sqlite/src/test/analyze9.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2009 February 2 1 # 2009 February 2
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 27 matching lines...) Expand all
38 # alter4-6.*: Test that temp triggers are not accidentally dropped. 38 # alter4-6.*: Test that temp triggers are not accidentally dropped.
39 # alter4-7.*: Test that VACUUM resets the file-format. 39 # alter4-7.*: Test that VACUUM resets the file-format.
40 # 40 #
41 41
42 do_test alter4-1.1 { 42 do_test alter4-1.1 {
43 execsql { 43 execsql {
44 CREATE TEMP TABLE abc(a, b, c); 44 CREATE TEMP TABLE abc(a, b, c);
45 SELECT sql FROM sqlite_temp_master; 45 SELECT sql FROM sqlite_temp_master;
46 } 46 }
47 } {{CREATE TABLE abc(a, b, c)}} 47 } {{CREATE TABLE abc(a, b, c)}}
48 do_test alter4-1.1b {
49 execsql {
50 SELECT sql FROM temp.sqlite_master;
51 }
52 } {{CREATE TABLE abc(a, b, c)}}
48 do_test alter4-1.2 { 53 do_test alter4-1.2 {
49 execsql {ALTER TABLE abc ADD d INTEGER;} 54 execsql {ALTER TABLE abc ADD d INTEGER;}
50 execsql { 55 execsql {
51 SELECT sql FROM sqlite_temp_master; 56 SELECT sql FROM sqlite_temp_master;
52 } 57 }
53 } {{CREATE TABLE abc(a, b, c, d INTEGER)}} 58 } {{CREATE TABLE abc(a, b, c, d INTEGER)}}
59 do_test alter4-1.2b {
60 execsql {
61 SELECT sql FROM temp.sqlite_master;
62 }
63 } {{CREATE TABLE abc(a, b, c, d INTEGER)}}
54 do_test alter4-1.3 { 64 do_test alter4-1.3 {
55 execsql {ALTER TABLE abc ADD e} 65 execsql {ALTER TABLE abc ADD e}
56 execsql { 66 execsql {
57 SELECT sql FROM sqlite_temp_master; 67 SELECT sql FROM sqlite_temp_master;
58 } 68 }
59 } {{CREATE TABLE abc(a, b, c, d INTEGER, e)}} 69 } {{CREATE TABLE abc(a, b, c, d INTEGER, e)}}
70 do_test alter4-1.3b {
71 execsql {
72 SELECT sql FROM temp.sqlite_master;
73 }
74 } {{CREATE TABLE abc(a, b, c, d INTEGER, e)}}
60 do_test alter4-1.4 { 75 do_test alter4-1.4 {
61 execsql { 76 execsql {
62 CREATE TABLE temp.t1(a, b); 77 CREATE TABLE temp.t1(a, b);
63 ALTER TABLE t1 ADD c; 78 ALTER TABLE t1 ADD c;
64 SELECT sql FROM sqlite_temp_master WHERE tbl_name = 't1'; 79 SELECT sql FROM sqlite_temp_master WHERE tbl_name = 't1';
65 } 80 }
66 } {{CREATE TABLE t1(a, b, c)}} 81 } {{CREATE TABLE t1(a, b, c)}}
82 do_test alter4-1.4b {
83 execsql {
84 SELECT sql FROM temp.sqlite_master WHERE tbl_name = 't1';
85 }
86 } {{CREATE TABLE t1(a, b, c)}}
67 do_test alter4-1.5 { 87 do_test alter4-1.5 {
68 execsql { 88 execsql {
69 ALTER TABLE t1 ADD d CHECK (a>d); 89 ALTER TABLE t1 ADD d CHECK (a>d);
70 SELECT sql FROM sqlite_temp_master WHERE tbl_name = 't1'; 90 SELECT sql FROM sqlite_temp_master WHERE tbl_name = 't1';
71 } 91 }
72 } {{CREATE TABLE t1(a, b, c, d CHECK (a>d))}} 92 } {{CREATE TABLE t1(a, b, c, d CHECK (a>d))}}
73 ifcapable foreignkey { 93 ifcapable foreignkey {
74 do_test alter4-1.6 { 94 do_test alter4-1.6 {
75 execsql { 95 execsql {
76 CREATE TEMP TABLE t2(a, b, UNIQUE(a, b)); 96 CREATE TEMP TABLE t2(a, b, UNIQUE(a, b));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 do_execsql_test alter4-9.2 { SELECT typeof(a), a, typeof(b), b FROM t5; } { 368 do_execsql_test alter4-9.2 { SELECT typeof(a), a, typeof(b), b FROM t5; } {
349 integer -9223372036854775808 369 integer -9223372036854775808
350 real 9.22337203685478e+18 370 real 9.22337203685478e+18
351 } 371 }
352 372
353 do_execsql_test alter4-9.3 { 373 do_execsql_test alter4-9.3 {
354 ALTER TABLE t5 ADD COLUMN c INTEGER DEFAULT (-(-9223372036854775808)); 374 ALTER TABLE t5 ADD COLUMN c INTEGER DEFAULT (-(-9223372036854775808));
355 SELECT typeof(c), c FROM t5; 375 SELECT typeof(c), c FROM t5;
356 } {real 9.22337203685478e+18} 376 } {real 9.22337203685478e+18}
357 377
378 # Confirm that doing an ALTER TABLE on a legacy format database
379 # does not corrupt DESC indexes.
380 #
381 # Ticket https://www.sqlite.org/src/tktview/f68bf68513a1c
382 #
383 do_test alter4-10.1 {
384 db close
385 sqlite3 db :memory:
386 db eval {
387 PRAGMA legacy_file_format=on;
388 CREATE TABLE t1(a,b,c);
389 CREATE INDEX t1a ON t1(a DESC);
390 INSERT INTO t1 VALUES(1,2,3);
391 INSERT INTO t1 VALUES(2,3,4);
392 ALTER TABLE t1 ADD COLUMN d;
393 PRAGMA integrity_check;
394 }
395 } {ok}
396
358 finish_test 397 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/alter3.test ('k') | third_party/sqlite/src/test/analyze9.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698