]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Changes to increase test coverage. (CVS 3819)
authordrh <drh@noemail.net>
Fri, 6 Apr 2007 01:04:39 +0000 (01:04 +0000)
committerdrh <drh@noemail.net>
Fri, 6 Apr 2007 01:04:39 +0000 (01:04 +0000)
FossilOrigin-Name: fd4da6b13499af2397d52cb0f25f8ff6f2192431

manifest
manifest.uuid
src/select.c
src/where.c
test/shared_err.test

index 65b5ef8cea8a05666f18812992c356dc4fb93e40..4c485aa2c53fa13433b8c1459635b51d3945794e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\ssure\sthe\ssqlite3BtreePrevious()\sroutine\sterminates\sproperly\sif\sthe\ntable\sis\sdeleted\sout\sfrom\sunder\sit.\s\sTicket\s#2286.\s\sThis\sbug\swas\sdiscovered\nwhile\strying\sto\sincrease\stest\scoverage\sfrom\s98.5%\sto\s99%\s-\sonce\sagain\nshowing\sthe\svalue\sof\sfull\scoverage\stesting.\s(CVS\s3818)
-D 2007-04-06T01:03:33
+C Changes\sto\sincrease\stest\scoverage.\s(CVS\s3819)
+D 2007-04-06T01:04:40
 F Makefile.in a9bd493360a2b17e5214b69d8c32dd6cdaceaf55
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -93,7 +93,7 @@ F src/pragma.c 3b992b5b2640d6ae25cef05aa6a42cd1d6c43234
 F src/prepare.c 37207b2b2ccb41d379b01dd62231686bcc48ef1f
 F src/printf.c 0c6f40648770831341ac45ab32423a80b4c87f05
 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
-F src/select.c 41b1997441ee314e681e981346d328665263bc44
+F src/select.c 6d6e7c992fb0f170e60e6c1f53fe87f52e73aeba
 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
 F src/shell.c 3ae4654560e91220a95738a73d135d91d937cda1
 F src/sqlite.h.in e429f66f9245c7f8675db24b230c950b8672ad1c
@@ -131,7 +131,7 @@ F src/vdbeaux.c 0bae26de1ba1683de80c89ba1d4081b4c809d05b
 F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
 F src/vdbemem.c 981a113405bd9b80aeb71fe246a2f01708e8a8f7
 F src/vtab.c 7fbda947e28cbe7adb3ba752a76ca9ef29936750
-F src/where.c 25e0dbb96c6980d11cc756c2b4abdfda80cd67a5
+F src/where.c fce0dad6b230eb7ea844e8b8667c074d07e3fdd5
 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test 6a03095322e93427a3677ce5daaa20f45640d1f0
@@ -306,7 +306,7 @@ F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
 F test/shared.test 315934fecff5ecb884449eaa5bae9876961f2f22
 F test/shared2.test 8b48f8d33494413ef4cf250110d89403e2bf6b23
 F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749
-F test/shared_err.test 841f7341eb07ed97c713bf89960a4e9199717193
+F test/shared_err.test cc528f6e78665787e93d9ce3a782a2ce5179d821
 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
 F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a
 F test/speed2.test 9b93b93681f82f320caa4b2c9f15c0de4f3a3d33
@@ -451,7 +451,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P f2caff870c81c08ec85aae72986c231ee986b251
-R 318b6ff1df8c9d65e7de849f673a3ac5
+P bebf8d2f886ed9fe1b96e4cb11ab3de2f2f7d2c8
+R 25d3c5591ddd0c4ab2f7e78f9cd27746
 U drh
-Z 3ae24a6bd11cbf91ba2afccd5e139cc3
+Z 0b6a3c115517eee9d157a43932195b4f
index 7aba490e7e4dd1d2cd8dd50d39233fdb4bc06e69..421f5379bb9a43f9e53f8c43cd5ce7733a6b0cf8 100644 (file)
@@ -1 +1 @@
-bebf8d2f886ed9fe1b96e4cb11ab3de2f2f7d2c8
\ No newline at end of file
+fd4da6b13499af2397d52cb0f25f8ff6f2192431
\ No newline at end of file
index 077c2bb0c236dff53e1690ae80ff0af46ec99103..7c89ef009e75489f32f8aeeae3985034591cc2fc 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.332 2007/04/01 23:49:52 drh Exp $
+** $Id: select.c,v 1.333 2007/04/06 01:04:40 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -3297,7 +3297,7 @@ select_end:
   return rc;
 }
 
-#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
+#if defined(SQLITE_DEBUG)
 /*
 *******************************************************************************
 ** The following code is used for testing and debugging only.  The code
index b5a9581767b60c9293866beea59f953dcc766b98..3327e81c36756a9a280d3e9ac27a44e2dfa38806 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.245 2007/03/31 01:34:45 drh Exp $
+** $Id: where.c,v 1.246 2007/04/06 01:04:40 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1138,8 +1138,7 @@ static double estLog(double N){
 ** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines
 ** are no-ops.
 */
-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && \
-        (defined(SQLITE_TEST) || defined(SQLITE_DEBUG))
+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_DEBUG)
 static void TRACE_IDX_INPUTS(sqlite3_index_info *p){
   int i;
   if( !sqlite3_where_trace ) return;
index e4ba31c3ae746ae37239af56ab52cb3cf802c9b6..56055810c8050c9c41a1ce3c636517ad5db50ac8 100644 (file)
@@ -13,7 +13,7 @@
 # cache context. What happens to connection B if one connection A encounters
 # an IO-error whilst reading or writing the file-system?
 #
-# $Id: shared_err.test,v 1.10 2007/03/19 13:53:38 danielk1977 Exp $
+# $Id: shared_err.test,v 1.11 2007/04/06 01:04:40 drh Exp $
 
 proc skip {args} {}
 
@@ -302,6 +302,86 @@ do_ioerr_test shared_ioerr-3 -tclprep {
   db2 close
 }
 
+# This is a repeat of the previous test except that this time we
+# are doing a reverse-order scan of the table when the cursor is
+# "saved".
+# 
+do_ioerr_test shared_ioerr-3rev -tclprep {
+  sqlite3 db2 test.db
+  execsql {
+    PRAGMA read_uncommitted = 1;
+    PRAGMA cache_size = 10;
+    BEGIN;
+    CREATE TABLE t1(a, b, UNIQUE(a, b));
+  } db2
+  for {set i 0} {$i < 200} {incr i} {
+    set a [string range [string repeat "[format %03d $i]." 5] 0 end-1]
+
+    set b [string repeat $i 2000]
+    execsql {INSERT INTO t1 VALUES($a, $b)} db2
+  }
+  execsql {COMMIT} db2
+  set ::DB2 [sqlite3_connection_pointer db2]
+  set ::STMT [sqlite3_prepare $::DB2 \
+           "SELECT a FROM t1 ORDER BY a DESC" -1 DUMMY]
+  sqlite3_step $::STMT       ;# Cursor points at 199.199.199.199.199
+  sqlite3_step $::STMT       ;# Cursor points at 198.198.198.198.198
+
+} -tclbody {
+  execsql {
+    BEGIN;
+    INSERT INTO t1 VALUES('201.201.201.201.201', NULL);
+    UPDATE t1 SET a = '202.202.202.202.202' WHERE a LIKE '201%';
+    COMMIT;
+  }
+} -cleanup {
+  set ::steprc  [sqlite3_step $::STMT]
+  set ::column  [sqlite3_column_text $::STMT 0]
+  set ::finalrc [sqlite3_finalize $::STMT]
+
+  # There are three possible outcomes here (assuming persistent IO errors):
+  #
+  # 1. If the [sqlite3_step] did not require any IO (required pages in
+  #    the cache), then the next row ("002...") may be retrieved 
+  #    successfully.
+  #
+  # 2. If the [sqlite3_step] does require IO, then [sqlite3_step] returns
+  #    SQLITE_ERROR and [sqlite3_finalize] returns IOERR.
+  #
+  # 3. If, after the initial IO error, SQLite tried to rollback the
+  #    active transaction and a second IO error was encountered, then
+  #    statement $::STMT will have been aborted. This means [sqlite3_stmt]
+  #    returns SQLITE_ABORT, and the statement cursor does not move. i.e.
+  #    [sqlite3_column] still returns the current row ("001...") and
+  #    [sqlite3_finalize] returns SQLITE_OK.
+  #
+
+  do_test shared_ioerr-3rev.$n.cleanup.1 {
+    expr {
+      $::steprc eq "SQLITE_ROW" || 
+      $::steprc eq "SQLITE_ERROR" ||
+      $::steprc eq "SQLITE_ABORT" 
+    }
+  } {1}
+  do_test shared_ioerr-3rev.$n.cleanup.2 {
+    expr {
+      ($::steprc eq "SQLITE_ROW" && $::column eq "197.197.197.197.197") ||
+      ($::steprc eq "SQLITE_ERROR" && $::column eq "") ||
+      ($::steprc eq "SQLITE_ABORT" && $::column eq "198.198.198.198.198") 
+    }
+  } {1}
+  do_test shared_ioerr-3rev.$n.cleanup.3 {
+    expr {
+      ($::steprc eq "SQLITE_ROW" && $::finalrc eq "SQLITE_OK") ||
+      ($::steprc eq "SQLITE_ERROR" && $::finalrc eq "SQLITE_IOERR") ||
+      ($::steprc eq "SQLITE_ABORT" && $::finalrc eq "SQLITE_OK")
+    }
+  } {1}
+
+# db2 eval {select * from sqlite_master}
+  db2 close
+}
+
 # Only run these tests if memory debugging is turned on.
 #
 if {[info command sqlite_malloc_stat]==""} {