]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Bug fix and better testing of the extended result codes. (CVS 3423)
authordrh <drh@noemail.net>
Fri, 15 Sep 2006 12:29:16 +0000 (12:29 +0000)
committerdrh <drh@noemail.net>
Fri, 15 Sep 2006 12:29:16 +0000 (12:29 +0000)
FossilOrigin-Name: 78ae74db1cbf605cd421e7ea321e879d3638968e

manifest
manifest.uuid
src/pager.c
test/tester.tcl

index 4078050015a065d0cb82cd9f471262a5d0fec924..2ef26efd5015acda5d3c1f626895d4a4b725bcb7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\ssupport\sfor\sextended\sresult\scodes\s-\sadditional\sresult\sinformation\ncarried\sin\sthe\shigher\sbits\sof\sthe\sinteger\sreturn\scodes.\s\sThis\smust\sbe\nenabled\susing\sthe\ssqlite3_extended_result_code()\sAPI.\s\sOnly\sa\sfew\sextra\nresult\scodes\sare\scurrently\sdefined.\s(CVS\s3422)
-D 2006-09-15T07:28:50
+C Bug\sfix\sand\sbetter\stesting\sof\sthe\sextended\sresult\scodes.\s(CVS\s3423)
+D 2006-09-15T12:29:16
 F Makefile.in cabd42d34340f49260bc2a7668c38eba8d4cfd99
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -76,7 +76,7 @@ F src/os_unix.c 3ed7fd1639c052d1df167321917a39ba738c46c9
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c a66763099e093785bee7e8cff3baef01868b2e73
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 65bb33144cad89f9a52054ec884e0fd5f4b0849b
+F src/pager.c 0f966f7fa225c377da2021fbbfdd50a48d877000
 F src/pager.h 0cff9de5e9019cb695a04d18df8caaaff933a272
 F src/parse.y 3279443a2b8173230dd27b9821373b681bb1f3c8
 F src/pragma.c dcb79b8170231f3aed99d4004b4d0a0fc14c4b4d
@@ -275,7 +275,7 @@ F test/table.test feea6a3eb08cf166f570255eea5447e42ef82498
 F test/tableapi.test a1982276274d292110d549206bc365b2da43e2ee
 F test/tclsqlite.test 51334389283c74bcbe28645a73159b17e239e9f3
 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
-F test/tester.tcl d5c5389036769acf24636965cabab90fe42020f4
+F test/tester.tcl 3015906685013d5db84ceb783c3d900c28158b8f
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb
 F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
@@ -399,7 +399,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 01651a32c6e67c4ac2cd23f1da7f3cc3adad1b33
-R 245c2c9e4179a89b58543a7e5cb6292b
+P ba579ddc4361fc6e8ea66f9385770d70dfe94751
+R a475b58e8b06434ca002d3eeb56da619
 U drh
-Z dc51ea3ae28793482c78f8fbf55dff83
+Z ae82e82a4719ae81f80e03d37cfdc549
index eccf5f6cd7b255deb0ef3f8e735bd75f6a344cdd..2666bb332d9b49e21ad833af7f8ad361e8f6bd4d 100644 (file)
@@ -1 +1 @@
-ba579ddc4361fc6e8ea66f9385770d70dfe94751
\ No newline at end of file
+78ae74db1cbf605cd421e7ea321e879d3638968e
\ No newline at end of file
index e8923e06fc4ea6feacb6c9178337ee14708576da..e3376008e574f210de1816d343894b561a32c0cd 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.272 2006/09/15 07:28:50 drh Exp $
+** @(#) $Id: pager.c,v 1.273 2006/09/15 12:29:16 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -231,7 +231,6 @@ struct Pager {
   u8 fullSync;                /* Do extra syncs of the journal for robustness */
   u8 full_fsync;              /* Use F_FULLFSYNC when available */
   u8 state;                   /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
-  u8 errCode;                 /* One of several kinds of errors */
   u8 tempFile;                /* zFilename is a temporary file */
   u8 readOnly;                /* True for a read-only database */
   u8 needSync;                /* True if an fsync() is needed on the journal */
@@ -239,6 +238,7 @@ struct Pager {
   u8 alwaysRollback;          /* Disable dont_rollback() for all pages */
   u8 memDb;                   /* True to inhibit all file I/O */
   u8 setMaster;               /* True if a m-j name has been written to jrnl */
+  int errCode;                /* One of several kinds of errors */
   int dbSize;                 /* Number of pages in the file */
   int origDbSize;             /* dbSize before the current change */
   int stmtSize;               /* Size of database (in pages) at stmt_begin() */
@@ -1815,12 +1815,13 @@ void sqlite3pager_read_fileheader(Pager *pPager, int N, unsigned char *pDest){
 */
 int sqlite3pager_pagecount(Pager *pPager){
   i64 n;
+  int rc;
   assert( pPager!=0 );
   if( pPager->dbSize>=0 ){
     n = pPager->dbSize;
   } else {
-    if( sqlite3OsFileSize(pPager->fd, &n)!=SQLITE_OK ){
-      pager_error(pPager, SQLITE_IOERR);
+    if( (rc = sqlite3OsFileSize(pPager->fd, &n))!=SQLITE_OK ){
+      pager_error(pPager, rc);
       return 0;
     }
     if( n>0 && n<pPager->pageSize ){
index df1f00e14cfb562a59d3e62cdb0e2e1242096177..6f68006afc2203e0c10c3aed169b038a9d1ef938 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements some common TCL routines used for regression
 # testing the SQLite library
 #
-# $Id: tester.tcl,v 1.67 2006/09/15 07:28:51 drh Exp $
+# $Id: tester.tcl,v 1.68 2006/09/15 12:29:16 drh Exp $
 
 # Make sure tclsqlite3 was compiled correctly.  Abort now with an
 # error message if not.
@@ -384,6 +384,18 @@ proc do_ioerr_test {testname args} {
     do_test $testname.$n.3 {
       set r [catch $::ioerrorbody msg]
       # puts rc=[sqlite3_errcode $::DB]
+      set rc [sqlite3_errcode $::DB]
+      if {$::ioerropts(-erc)} {
+        # In extended result mode, all IOERRs are qualified 
+        if {[regexp {^SQLITE_IOERR} $rc] && ![regexp {IOERR\+\d} $rc]} {
+          return $rc
+        }
+      } else {
+        # Not in extended result mode, no errors are qualified
+        if {[regexp {\+\d} $rc]} {
+          return $rc
+        }
+      }
       set ::go [expr {$::sqlite_io_error_pending<=0}]
       set s [expr $::sqlite_io_error_hit==0]
       set ::sqlite_io_error_hit 0