From 8a1e1078116548002f1f7ab76fe2e52df39cebee Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 17 Nov 2014 18:35:30 +0000 Subject: [PATCH] Add tests for WITHOUT ROWID tables with composite primary keys. FossilOrigin-Name: 712d413d29950b19d4afb18cfcf9d3afb302d0a0 --- ext/ota/ota7.test | 62 +++++++++++++++++++++++++++++++++++++++++++++-- manifest | 12 ++++----- manifest.uuid | 2 +- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/ext/ota/ota7.test b/ext/ota/ota7.test index 18bece567a..099d3da732 100644 --- a/ext/ota/ota7.test +++ b/ext/ota/ota7.test @@ -9,16 +9,24 @@ # #*********************************************************************** # -# This file contains tests for the OTA module. Specifically, it tests the -# that affinities are correctly applied to values within the OTA database. +# This file contains tests for the OTA module. # + if {![info exists testdir]} { set testdir [file join [file dirname [info script]] .. .. test] } source $testdir/tester.tcl set ::testprefix ota7 +# Test index: +# +# 1.*: That affinities are correctly applied to values within the +# OTA database. +# +# 2.*: Tests for multi-column primary keys. +# + do_test 1.0 { execsql { CREATE TABLE t1(a INT PRIMARY KEY, b) WITHOUT ROWID; @@ -46,6 +54,56 @@ do_execsql_test 1.2 { SELECT * FROM t1 } {2 def} +#------------------------------------------------------------------------- +# +foreach {tn tbl} { + 1 { CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b)) WITHOUT ROWID } +} { + reset_db + + execsql $tbl + do_execsql_test 2.$tn.1 { + CREATE INDEX t1c ON t1(c); + INSERT INTO t1 VALUES(1, 1, 'a'); + INSERT INTO t1 VALUES(1, 2, 'b'); + INSERT INTO t1 VALUES(2, 1, 'c'); + INSERT INTO t1 VALUES(2, 2, 'd'); + } + + do_test 2.$tn.2 { + forcedelete ota.db + sqlite3 ota ota.db + execsql { + CREATE TABLE data_t1(a, b, c, ota_control); + INSERT INTO data_t1 VALUES(3, 1, 'e', 0); + INSERT INTO data_t1 VALUES(3, 2, 'f', 0); + INSERT INTO data_t1 VALUES(1, 2, NULL, 1); + INSERT INTO data_t1 VALUES(2, 1, 'X', '..x'); + } ota + ota close + } {} + + do_test 2.$tn.3 { + set rc "SQLITE_OK" + while {$rc == "SQLITE_OK"} { + sqlite3ota ota test.db ota.db + ota step + set rc [ota close] + } + set rc + } {SQLITE_DONE} + + do_execsql_test 2.$tn.1 { + SELECT * FROM t1 ORDER BY a, b + } { + 1 1 a + 2 1 X + 2 2 d + 3 1 e + 3 2 f + } +} + finish_test diff --git a/manifest b/manifest index 2c61a549c1..dab1b99a41 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Changes\sso\sthat\ssqlite3_ckpt_open()\sworks\swith\szipvfs\sdatabases. -D 2014-11-17T17:57:06.217 +C Add\stests\sfor\sWITHOUT\sROWID\stables\swith\scomposite\sprimary\skeys. +D 2014-11-17T18:35:30.003 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -130,7 +130,7 @@ F ext/ota/ota3.test 215dd4a8e238567e0f890a5139b6fdf5494ef311 F ext/ota/ota4.test 60f897f329a6782ef2f24862640acf3c52e48077 F ext/ota/ota5.test ad0799daf8923ddebffe75ae8c5504ca90b7fadb F ext/ota/ota6.test 82f1f757ec9b2ad07d6de4060b8e3ba8e44dfdd3 -F ext/ota/ota7.test feba6072af04bc4bee192f7576aac60cef6a4727 +F ext/ota/ota7.test 36e740da2b67cc086ff9f2975d2929b8beaa1016 F ext/ota/otafault.test be02466863015a583cc0ceb6aca871a5e6f7a71b F ext/ota/sqlite3ota.c c7f8cdf55449b5169f79632e78f8e5049abf904c F ext/ota/sqlite3ota.h 7b20abe9247d292429d00f0a5c237ff6e0dc0196 @@ -1217,7 +1217,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 447b33b34a9836992f5a8d50cd8647a10435c144 -R a385542ae873f1383b1a1f964429fd33 +P acbed3380d8a35bf2f1ec133540cb5e9fccb9b42 +R 27bbe427f24c751c6dfa08920b459629 U dan -Z a2dd6eb93ee736daa85bc89fdfbf459a +Z 78767b94770b1205744fff578a5ff365 diff --git a/manifest.uuid b/manifest.uuid index f1dfb37c70..6ede1e0d71 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -acbed3380d8a35bf2f1ec133540cb5e9fccb9b42 \ No newline at end of file +712d413d29950b19d4afb18cfcf9d3afb302d0a0 \ No newline at end of file -- 2.47.2