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

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/colmeta.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: 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
OLDNEW
(Empty)
1 #
2 # 2006 February 9
3 #
4 # The author disclaims copyright to this source code. In place of
5 # a legal notice, here is a blessing:
6 #
7 # May you do good and not evil.
8 # May you find forgiveness for yourself and forgive others.
9 # May you share freely, never taking more than you give.
10 #
11 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this script is the sqlite3_table_column_metadata() API.
14 #
15 # $Id: colmeta.test,v 1.4 2008/01/23 12:52:41 drh Exp $
16
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19
20 # Set up a schema in the main and temp test databases.
21 do_test colmeta-0 {
22 execsql {
23 CREATE TABLE abc(a, b, c);
24 CREATE TABLE abc2(a PRIMARY KEY COLLATE NOCASE, b VARCHAR(32), c);
25 CREATE TABLE abc3(a NOT NULL, b INTEGER PRIMARY KEY, c);
26 CREATE TABLE abc5(w,x,y,z,PRIMARY KEY(x,z)) WITHOUT ROWID;
27 CREATE TABLE abc6(rowid TEXT COLLATE rtrim, oid REAL, _rowid_ BLOB);
28 }
29 ifcapable autoinc {
30 execsql {
31 CREATE TABLE abc4(a, b INTEGER PRIMARY KEY AUTOINCREMENT, c);
32 }
33 }
34 ifcapable view {
35 execsql {
36 CREATE VIEW v1 AS SELECT * FROM abc2;
37 }
38 }
39 } {}
40
41
42 # Return values are of the form:
43 #
44 # {<decl-type> <collation> <not null> <primary key> <auto increment>}
45 #
46 set tests {
47 1 {main abc a} {0 {{} BINARY 0 0 0}}
48 2 {{} abc a} {0 {{} BINARY 0 0 0}}
49 3 {{} abc2 b} {0 {VARCHAR(32) BINARY 0 0 0}}
50 4 {main abc2 b} {0 {VARCHAR(32) BINARY 0 0 0}}
51 5 {{} abc2 a} {0 {{} NOCASE 0 1 0}}
52 6 {{} abc3 a} {0 {{} BINARY 1 0 0}}
53 7 {{} abc3 b} {0 {INTEGER BINARY 0 1 0}}
54 13 {main abc rowid} {0 {INTEGER BINARY 0 1 0}}
55 14 {main abc3 rowid} {0 {INTEGER BINARY 0 1 0}}
56 16 {main abc d} {1 {no such table column: abc.d}}
57 20 {main abc5 w} {0 {{} BINARY 0 0 0}}
58 21 {main abc5 x} {0 {{} BINARY 1 1 0}}
59 22 {main abc5 y} {0 {{} BINARY 0 0 0}}
60 23 {main abc5 z} {0 {{} BINARY 1 1 0}}
61 24 {main abc5 rowid} {1 {no such table column: abc5.rowid}}
62 30 {main abc6 rowid} {0 {TEXT rtrim 0 0 0}}
63 31 {main abc6 oid} {0 {REAL BINARY 0 0 0}}
64 32 {main abc6 _rowid_} {0 {BLOB BINARY 0 0 0}}
65 }
66 ifcapable autoinc {
67 set tests [concat $tests {
68 100 {{} abc4 b} {0 {INTEGER BINARY 0 1 1}}
69 101 {main abc4 rowid} {0 {INTEGER BINARY 0 1 1}}
70 }]
71 }
72 ifcapable view {
73 set tests [concat $tests {
74 200 {{} v1 a} {1 {no such table column: v1.a}}
75 201 {main v1 b} {1 {no such table column: v1.b}}
76 202 {main v1 badname} {1 {no such table column: v1.badname}}
77 203 {main v1 rowid} {1 {no such table column: v1.rowid}}
78 }]
79 }
80
81 foreach {tn params results} $tests {
82 set ::DB [sqlite3_connection_pointer db]
83
84 set tstbody [concat sqlite3_table_column_metadata $::DB $params]
85 do_test colmeta-$tn.1 {
86 list [catch $tstbody msg] [set msg]
87 } $results
88
89 db close
90 sqlite3 db test.db
91
92 set ::DB [sqlite3_connection_pointer db]
93 set tstbody [concat sqlite3_table_column_metadata $::DB $params]
94 do_test colmeta-$tn.2 {
95 list [catch $tstbody msg] [set msg]
96 } $results
97 }
98
99 # Calling sqlite3_table_column_metadata with a NULL column name merely
100 # checks for the existance of the table.
101 #
102 do_test colmeta-300 {
103 catch {sqlite3_table_column_metadata $::DB main xyzzy} res
104 } {1}
105 do_test colmeta-301 {
106 catch {sqlite3_table_column_metadata $::DB main abc} res
107 } {0}
108
109
110 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/test/collateB.test ('k') | third_party/sqlite/sqlite-src-3170000/test/colname.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698