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

Side by Side Diff: third_party/sqlite/src/test/intpkey.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 # 2001 September 15 1 # 2001 September 15
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } {5 5 hello world} 69 } {5 5 hello world}
70 70
71 # Attempting to insert a duplicate primary key should give a constraint 71 # Attempting to insert a duplicate primary key should give a constraint
72 # failure. 72 # failure.
73 # 73 #
74 do_test intpkey-1.6 { 74 do_test intpkey-1.6 {
75 set r [catch {execsql { 75 set r [catch {execsql {
76 INSERT INTO t1 VALUES(5,'second','entry'); 76 INSERT INTO t1 VALUES(5,'second','entry');
77 }} msg] 77 }} msg]
78 lappend r $msg 78 lappend r $msg
79 } {1 {PRIMARY KEY must be unique}} 79 } {1 {UNIQUE constraint failed: t1.a}}
80 do_test intpkey-1.7 { 80 do_test intpkey-1.7 {
81 execsql { 81 execsql {
82 SELECT rowid, * FROM t1; 82 SELECT rowid, * FROM t1;
83 } 83 }
84 } {5 5 hello world} 84 } {5 5 hello world}
85 do_test intpkey-1.8 { 85 do_test intpkey-1.8 {
86 set r [catch {execsql { 86 set r [catch {execsql {
87 INSERT INTO t1 VALUES(6,'second','entry'); 87 INSERT INTO t1 VALUES(6,'second','entry');
88 }} msg] 88 }} msg]
89 lappend r $msg 89 lappend r $msg
(...skipping 28 matching lines...) Expand all
118 118
119 # Make sure SELECT statements are able to use the primary key column 119 # Make sure SELECT statements are able to use the primary key column
120 # as an index. 120 # as an index.
121 # 121 #
122 do_test intpkey-1.12.1 { 122 do_test intpkey-1.12.1 {
123 execsql { 123 execsql {
124 SELECT * FROM t1 WHERE a==4; 124 SELECT * FROM t1 WHERE a==4;
125 } 125 }
126 } {4 one two} 126 } {4 one two}
127 do_test intpkey-1.12.2 { 127 do_test intpkey-1.12.2 {
128 set sqlite_query_plan 128 execsql {
129 } {t1 *} 129 EXPLAIN QUERY PLAN
130 SELECT * FROM t1 WHERE a==4;
131 }
132 } {/SEARCH TABLE t1 /}
130 133
131 # Try to insert a non-integer value into the primary key field. This 134 # Try to insert a non-integer value into the primary key field. This
132 # should result in a data type mismatch. 135 # should result in a data type mismatch.
133 # 136 #
134 do_test intpkey-1.13.1 { 137 do_test intpkey-1.13.1 {
135 set r [catch {execsql { 138 set r [catch {execsql {
136 INSERT INTO t1 VALUES('x','y','z'); 139 INSERT INTO t1 VALUES('x','y','z');
137 }} msg] 140 }} msg]
138 lappend r $msg 141 lappend r $msg
139 } {1 {datatype mismatch}} 142 } {1 {datatype mismatch}}
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 do_test intpkey-5.1 { 372 do_test intpkey-5.1 {
370 execsql { 373 execsql {
371 INSERT INTO t1 VALUES(0,'zero','entry'); 374 INSERT INTO t1 VALUES(0,'zero','entry');
372 } 375 }
373 count { 376 count {
374 SELECT * FROM t1 WHERE a=0; 377 SELECT * FROM t1 WHERE a=0;
375 } 378 }
376 } {0 zero entry 0} 379 } {0 zero entry 0}
377 do_test intpkey-5.2 { 380 do_test intpkey-5.2 {
378 execsql { 381 execsql {
379 SELECT rowid, a FROM t1 382 SELECT rowid, a FROM t1 ORDER BY rowid
380 } 383 }
381 } {-4 -4 0 0 5 5 6 6 11 11} 384 } {-4 -4 0 0 5 5 6 6 11 11}
382 385
383 # Test the ability of the COPY command to put data into a 386 # Test the ability of the COPY command to put data into a
384 # table that contains an integer primary key. 387 # table that contains an integer primary key.
385 # 388 #
386 # COPY command has been removed. But we retain these tests so 389 # COPY command has been removed. But we retain these tests so
387 # that the tables will contain the right data for tests that follow. 390 # that the tables will contain the right data for tests that follow.
388 # 391 #
389 do_test intpkey-6.1 { 392 do_test intpkey-6.1 {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 599 }
597 } {y zero 2 hello second hello b-20 b-22 new 3 big-1 big-2} 600 } {y zero 2 hello second hello b-20 b-22 new 3 big-1 big-2}
598 do_test intpkey-15.7 { 601 do_test intpkey-15.7 {
599 execsql { 602 execsql {
600 SELECT b FROM t1 WHERE a>12345678901; 603 SELECT b FROM t1 WHERE a>12345678901;
601 } 604 }
602 } {} 605 } {}
603 606
604 607
605 finish_test 608 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698