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

Unified Diff: third_party/sqlite/src/test/rowid.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/rollback2.test ('k') | third_party/sqlite/src/test/run-wordcount.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/rowid.test
diff --git a/third_party/sqlite/src/test/rowid.test b/third_party/sqlite/src/test/rowid.test
index 4a9404defb526a09ad784e0d9a13897db57729b6..b00b5287fdf1673ab5d3f6b90fb5bea61eee2d0d 100644
--- a/third_party/sqlite/src/test/rowid.test
+++ b/third_party/sqlite/src/test/rowid.test
@@ -12,7 +12,9 @@
# focus of this file is testing the magic ROWID column that is
# found on all tables.
#
-# $Id: rowid.test,v 1.21 2009/06/26 15:14:55 drh Exp $
+# EVIDENCE-OF: R-36924-43758 By default, every row in SQLite has a
+# special column, usually called the "rowid", that uniquely identifies
+# that row within the table.
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -657,7 +659,7 @@ do_test rowid-11.4 {
# Test the automatic generation of rowids when the table already contains
# a rowid with the maximum value.
#
-# Once the the maximum rowid is taken, rowids are normally chosen at
+# Once the maximum rowid is taken, rowids are normally chosen at
# random. By by reseting the random number generator, we can cause
# the rowid guessing loop to collide with prior rowids, and test the
# loop out to its limit of 100 iterations. After 100 collisions, the
@@ -677,9 +679,9 @@ do_test rowid-12.2 {
save_prng_state
execsql {
INSERT INTO t7 VALUES(NULL,'b');
- SELECT x, y FROM t7;
+ SELECT x, y FROM t7 ORDER BY x;
}
-} {1 b 9223372036854775807 a}
+} {/\d+ b 9223372036854775807 a/}
execsql {INSERT INTO t7 VALUES(2,'y');}
for {set i 1} {$i<100} {incr i} {
do_test rowid-12.3.$i {
@@ -699,5 +701,19 @@ do_test rowid-12.4 {
}
} {1 {database or disk is full}}
+# INSERTs that happen inside of nested function calls are recorded
+# by last_insert_rowid.
+#
+proc rowid_addrow_func {n} {
+ db eval {INSERT INTO t13(rowid,x) VALUES($n,$n*$n)}
+ return [db last_insert_rowid]
+}
+db function addrow rowid_addrow_func
+do_execsql_test rowid-13.1 {
+ CREATE TABLE t13(x);
+ INSERT INTO t13(rowid,x) VALUES(1234,5);
+ SELECT rowid, x, addrow(rowid+1000), '|' FROM t13 LIMIT 3;
+ SELECT last_insert_rowid();
+} {1234 5 2234 | 2234 4990756 3234 | 3234 10458756 4234 | 4234}
finish_test
« no previous file with comments | « third_party/sqlite/src/test/rollback2.test ('k') | third_party/sqlite/src/test/run-wordcount.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698