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

Unified Diff: third_party/sqlite/src/test/e_insert.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/e_fts3.test ('k') | third_party/sqlite/src/test/e_reindex.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/e_insert.test
diff --git a/third_party/sqlite/src/test/e_insert.test b/third_party/sqlite/src/test/e_insert.test
index 2192f2e9fbca73db21075891625ec1bc03014a79..0ea4b76bb529a2008bea4c1205807f33ec19bd34 100644
--- a/third_party/sqlite/src/test/e_insert.test
+++ b/third_party/sqlite/src/test/e_insert.test
@@ -18,6 +18,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+ifcapable !compound {
+ finish_test
+ return
+}
+
# Organization of tests:
#
# e_insert-0.*: Test the syntax diagram.
@@ -45,7 +50,7 @@ proc do_insert_tests {args} {
uplevel do_select_tests $args
}
-# EVIDENCE-OF: R-41448-54465 -- syntax diagram insert-stmt
+# -- syntax diagram insert-stmt
#
do_insert_tests e_insert-0 {
1 "INSERT INTO a1 DEFAULT VALUES" {}
@@ -118,12 +123,26 @@ do_insert_tests e_insert-0 {
68 "INSERT OR IGNORE INTO a1 (b, a) SELECT c, b FROM a2" {}
69 "REPLACE INTO a1 (b, a) SELECT c, b FROM a2" {}
70 "REPLACE INTO main.a1 (b, a) SELECT c, b FROM a2" {}
+ 71 "INSERT INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 72 "INSERT INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 73 "INSERT OR ROLLBACK INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 74 "INSERT OR ROLLBACK INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 75 "INSERT OR ABORT INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 76 "INSERT OR ABORT INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 77 "INSERT OR REPLACE INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 78 "INSERT OR REPLACE INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 79 "INSERT OR FAIL INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 80 "INSERT OR FAIL INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 81 "INSERT OR FAIL INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 82 "INSERT OR IGNORE INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 83 "REPLACE INTO a1 (b, a) VALUES(1, 2),(3,4)" {}
+ 84 "REPLACE INTO main.a1 (b, a) VALUES(1, 2),(3,4)" {}
}
delete_all_data
-# EVIDENCE-OF: R-20288-20462 The first form (with the "VALUES" keyword)
-# creates a single new row in an existing table.
+# EVIDENCE-OF: R-21490-41092 The first form (with the "VALUES" keyword)
+# creates one or more new rows in an existing table.
#
do_insert_tests e_insert-1.1 {
0 "SELECT count(*) FROM a2" {0}
@@ -133,11 +152,14 @@ do_insert_tests e_insert-1.1 {
2a "INSERT INTO a2(a, b) VALUES(1, 2)" {}
2b "SELECT count(*) FROM a2" {2}
+
+ 3a "INSERT INTO a2(a) VALUES(3),(4)" {}
+ 3b "SELECT count(*) FROM a2" {4}
}
-# EVIDENCE-OF: R-36040-20870 If no column-list is specified then the
-# number of values must be the same as the number of columns in the
-# table.
+# EVIDENCE-OF: R-53616-44976 If no column-list is specified then the
+# number of values inserted into each row must be the same as the number
+# of columns in the table.
#
# A test in the block above verifies that if the VALUES list has the
# correct number of columns (for table a2, 3 columns) works. So these
@@ -152,9 +174,10 @@ do_insert_tests e_insert-1.2 -error {
4 "INSERT INTO a2 VALUES(1,2,3,4,5)" {a2 3 5}
}
-# EVIDENCE-OF: R-52422-65517 In this case the result of evaluting the
-# left-most expression in the VALUES list is inserted into the left-most
-# column of the new row, and so on.
+# EVIDENCE-OF: R-29730-42609 In this case the result of evaluating the
+# left-most expression from each term of the VALUES list is inserted
+# into the left-most column of each new row, and so forth for each
+# subsequent expression.
#
delete_all_data
do_insert_tests e_insert-1.3 {
@@ -168,8 +191,9 @@ do_insert_tests e_insert-1.3 {
3b "SELECT * FROM a2 WHERE oid=last_insert_rowid()" {2 x y}
}
-# EVIDENCE-OF: R-62524-00361 If a column-list is specified, then the
-# number of values must match the number of specified columns.
+# EVIDENCE-OF: R-09234-17933 If a column-list is specified, then the
+# number of values in each term of the VALUE list must match the number
+# of specified columns.
#
do_insert_tests e_insert-1.4 -error {
%d values for %d columns
@@ -347,22 +371,22 @@ do_execsql_test e_insert-4.1.0 {
INSERT INTO a4 VALUES(3, 'a');
} {}
foreach {tn sql error ac data } {
- 1.1 "INSERT INTO a4 VALUES(2,'b')" {column c is not unique} 1 {1 a 2 a 3 a}
+ 1.1 "INSERT INTO a4 VALUES(2,'b')" {UNIQUE constraint failed: a4.c} 1 {1 a 2 a 3 a}
1.2 "INSERT OR REPLACE INTO a4 VALUES(2, 'b')" {} 1 {1 a 3 a 2 b}
1.3 "INSERT OR IGNORE INTO a4 VALUES(3, 'c')" {} 1 {1 a 3 a 2 b}
1.4 "BEGIN" {} 0 {1 a 3 a 2 b}
- 1.5 "INSERT INTO a4 VALUES(1, 'd')" {column c is not unique} 0 {1 a 3 a 2 b}
+ 1.5 "INSERT INTO a4 VALUES(1, 'd')" {UNIQUE constraint failed: a4.c} 0 {1 a 3 a 2 b}
1.6 "INSERT OR ABORT INTO a4 VALUES(1, 'd')"
- {column c is not unique} 0 {1 a 3 a 2 b}
+ {UNIQUE constraint failed: a4.c} 0 {1 a 3 a 2 b}
1.7 "INSERT OR ROLLBACK INTO a4 VALUES(1, 'd')"
- {column c is not unique} 1 {1 a 3 a 2 b}
+ {UNIQUE constraint failed: a4.c} 1 {1 a 3 a 2 b}
1.8 "INSERT INTO a4 SELECT 4, 'e' UNION ALL SELECT 3, 'e'"
- {column c is not unique} 1 {1 a 3 a 2 b}
+ {UNIQUE constraint failed: a4.c} 1 {1 a 3 a 2 b}
1.9 "INSERT OR FAIL INTO a4 SELECT 4, 'e' UNION ALL SELECT 3, 'e'"
- {column c is not unique} 1 {1 a 3 a 2 b 4 e}
+ {UNIQUE constraint failed: a4.c} 1 {1 a 3 a 2 b 4 e}
2.1 "INSERT INTO a4 VALUES(2,'f')"
- {column c is not unique} 1 {1 a 3 a 2 b 4 e}
+ {UNIQUE constraint failed: a4.c} 1 {1 a 3 a 2 b 4 e}
2.2 "REPLACE INTO a4 VALUES(2, 'f')" {} 1 {1 a 3 a 4 e 2 f}
} {
do_catchsql_test e_insert-4.1.$tn.1 $sql [list [expr {$error!=""}] $error]
« no previous file with comments | « third_party/sqlite/src/test/e_fts3.test ('k') | third_party/sqlite/src/test/e_reindex.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698