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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
OLDNEW
1 # 2005 August 18 1 # 2005 August 18
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 } {0 c {} 0 'abc' 0} 58 } {0 c {} 0 'abc' 0}
59 do_test default-2.2 { 59 do_test default-2.2 {
60 execsql { 60 execsql {
61 INSERT INTO t4 DEFAULT VALUES; 61 INSERT INTO t4 DEFAULT VALUES;
62 PRAGMA table_info(t4); 62 PRAGMA table_info(t4);
63 } 63 }
64 } {0 c {} 0 'abc' 0} 64 } {0 c {} 0 'abc' 0}
65 } 65 }
66 66
67 do_execsql_test default-3.1 {
68 CREATE TABLE t3(
69 a INTEGER PRIMARY KEY AUTOINCREMENT,
70 b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
71 c VARCHAR(123,456) DEFAULT 'hello' NOT NULL ON CONFLICT REPLACE,
72 d REAL,
73 e FLOATING POINT(5,10) DEFAULT 4.36,
74 f NATIONAL CHARACTER(15) COLLATE RTRIM,
75 g LONG INTEGER DEFAULT( 3600*12 )
76 );
77 INSERT INTO t3 VALUES(null, 5, 'row1', '5.25', 'xyz', 321, '432');
78 SELECT a, typeof(a), b, typeof(b), c, typeof(c),
79 d, typeof(d), e, typeof(e), f, typeof(f),
80 g, typeof(g) FROM t3;
81 } {1 integer 5 integer row1 text 5.25 real xyz text 321 text 432 integer}
82 do_execsql_test default-3.2 {
83 DELETE FROM t3;
84 INSERT INTO t3 DEFAULT VALUES;
85 SELECT * FROM t3;
86 } {2 12345 hello {} 4.36 {} 43200}
87 do_execsql_test default-3.3 {
88 CREATE TABLE t300(
89 a INT DEFAULT 2147483647,
90 b INT DEFAULT 2147483648,
91 c INT DEFAULT +9223372036854775807,
92 d INT DEFAULT -2147483647,
93 e INT DEFAULT -2147483648,
94 f INT DEFAULT -9223372036854775808,
95 g INT DEFAULT (-(-9223372036854775808)),
96 h INT DEFAULT (-(-9223372036854775807))
97 );
98 INSERT INTO t300 DEFAULT VALUES;
99 SELECT * FROM t300;
100 } {2147483647 2147483648 9223372036854775807 -2147483647 -2147483648 -9223372036 854775808 9.22337203685478e+18 9223372036854775807}
101
102 # Do now allow bound parameters in new DEFAULT values.
103 # Silently convert bound parameters to NULL in DEFAULT causes
104 # in the sqlite_master table, for backwards compatibility.
105 #
106 db close
107 forcedelete test.db
108 sqlite3 db test.db
109 do_execsql_test default-4.0 {
110 CREATE TABLE t1(a TEXT, b TEXT DEFAULT(99));
111 PRAGMA writable_schema=ON;
112 UPDATE sqlite_master SET sql='CREATE TABLE t1(a TEXT, b TEXT DEFAULT(:xyz))';
113 } {}
114 db close
115 sqlite3 db test.db
116 do_execsql_test default-4.1 {
117 INSERT INTO t1(a) VALUES('xyzzy');
118 SELECT a, quote(b) FROM t1;
119 } {xyzzy NULL}
120 do_catchsql_test default-4.2 {
121 CREATE TABLE t2(a TEXT, b TEXT DEFAULT(:xyz));
122 } {1 {default value of column [b] is not constant}}
123 do_catchsql_test default-4.3 {
124 CREATE TABLE t2(a TEXT, b TEXT DEFAULT(abs(:xyz)));
125 } {1 {default value of column [b] is not constant}}
126 do_catchsql_test default-4.4 {
127 CREATE TABLE t2(a TEXT, b TEXT DEFAULT(98+coalesce(5,:xyz)));
128 } {1 {default value of column [b] is not constant}}
129
67 finish_test 130 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698