]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the pager so that correct rollbacks occur when synchronous is turned off.
authordrh <drh@noemail.net>
Sat, 15 Feb 2003 23:09:17 +0000 (23:09 +0000)
committerdrh <drh@noemail.net>
Sat, 15 Feb 2003 23:09:17 +0000 (23:09 +0000)
This check-in also included unrelated documentation updates. (CVS 866)

FossilOrigin-Name: 3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc

manifest
manifest.uuid
src/pager.c
test/pragma.test
test/trans.test
test/trigger2.test
test/update.test
www/index.tcl
www/quickstart.tcl

index 9e7e213d52f93fbbc0ac45a0c5e7b475cb753546..1d95a7208c91982518356d80e7e328500ea1cac2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sthe\sdocumentation\sfor\sthe\snew\sjournal\sformat\sto\sbe\sintroduced\sin\nversion\s2.8.0.\s(CVS\s1729)
-D 2003-02-13T02:54:04
+C Fix\sthe\spager\sso\sthat\scorrect\srollbacks\soccur\swhen\ssynchronous\sis\sturned\soff.\r\nThis\scheck-in\salso\sincluded\sunrelated\sdocumentation\supdates.\s(CVS\s866)
+D 2003-02-15T23:09:17
 F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -33,7 +33,7 @@ F src/main.c f88dfe09ed79588899cb4013836dd940f73a17fa
 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
 F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
 F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
-F src/pager.c a64f69216ebef0e6ce90e65700674b7c64f6b16e
+F src/pager.c bffccf853a20032d89b592572309ea8a15a7f3ed
 F src/pager.h e5b8e301a732007766dc04880c764d7ee1aa34dd
 F src/parse.y cdaed5009423d851708848bd279147c268e6022e
 F src/printf.c f8fd911a8738f9b2eb07aca2870473d34707055d
@@ -90,7 +90,7 @@ F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
 F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
 F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c
-F test/pragma.test 0ca0773e2559ec9715f72d90695554dc3368e8f2
+F test/pragma.test d45d130f532bfe86ebd5ba74862d88b36ded8998
 F test/printf.test a29b8afa24edb4411adfe473b12ac32c84098fce
 F test/quick.test b372c8dad4fa1554747e90683fc72e59c0c98502
 F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
@@ -108,13 +108,13 @@ F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
 F test/tclsqlite.test f650195b8124aca24bee175393a1ed2e5a544a38
 F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0
 F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc
-F test/trans.test 0d3584f8d50646ff22776ac0a28521a410a673d6
+F test/trans.test 75e7a171b5d2d94ee56766459113e2ad0e5f809d
 F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247
-F test/trigger2.test 592daa956dc62b19930fe673405e389a80c5764e
+F test/trigger2.test ab4c743bb96cee96ab5a17c5edfd57a9134329d6
 F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72
 F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818
 F test/unique.test 22a46df72a3e0a3fd1a2d39e96fb59f18448dd5f
-F test/update.test e7b224f4ed652b3d6defdd6174ebc2ccd894307a
+F test/update.test 198360dfa14e65354dbcc66d5b98d8070780e42b
 F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
 F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
 F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d
@@ -144,18 +144,18 @@ F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
 F www/faq.tcl 06276ff6c3e369374bb83034cc9d4a7d3a2a34a1
 F www/fileformat.tcl d9b586416c0d099b82e02e469d532c9372f98f3f
 F www/formatchng.tcl cbaf0f410096c71f86a7537cf9249fa04b9a659c
-F www/index.tcl b5265ca54a5124ec40bffb7c7943e072e074d61a
+F www/index.tcl b155eba45136d19e7aa6ba979d4093180c335cf7
 F www/lang.tcl 9bd9380dceba83d11fe268e0142c05ee06c757db
 F www/mingw.tcl f1c7c0a7f53387dd9bb4f8c7e8571b7561510ebc
 F www/nulls.tcl 29497dac2bc5b437aa7e2e94577dad4d8933ed26
 F www/omitted.tcl 118062f40a203fcb88b8d68ef1d7c0073ac191ec
 F www/opcode.tcl 33c5f2061a05c5d227c72b84c080b3bf74c74f8b
-F www/quickstart.tcl 368d7ef130274307accceb2e21c9fc70bbb0ba65
+F www/quickstart.tcl 4e97bef825e6a4153c43afb9f97235fc4da278ab
 F www/speed.tcl 4d463e2aea41f688ed320a937f93ff885be918c3
 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P e05a7a552f694158ee449d8682f5c137f1c2f2ac
-R 496fbf0dd37f4b8503d955d31fa52734
+P dc53d92141c931fb133149355c3a1ea64030e676
+R 571b9c5813a6dfc27b61cc9c2ebc6b12
 U drh
-Z bec57f8a48da6d4cfdb9d6259114717b
+Z b201cdfd990195584437ce2ba1bc7248
index 01770aa6424ce5e7bb157c21807680902362c1ef..3c9eee23a5184eb7c3c5a0c6df232ffaf5ee7021 100644 (file)
@@ -1 +1 @@
-dc53d92141c931fb133149355c3a1ea64030e676
\ No newline at end of file
+3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc
\ No newline at end of file
index 3d2d71121d7c7c2ab32dce3893292a7b7167d597..afe03a855cf8c0a9c810e8813a354ec4b73b251f 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.76 2003/02/13 01:58:21 drh Exp $
+** @(#) $Id: pager.c,v 1.77 2003/02/15 23:09:17 drh Exp $
 */
 #include "os.h"         /* Must be first to enable large file support */
 #include "sqliteInt.h"
@@ -1511,7 +1511,7 @@ static int pager_open_journal(Pager *pPager){
   if( journal_format==JOURNAL_FORMAT_3 ){
     rc = sqliteOsWrite(&pPager->jfd, aJournalMagic3, sizeof(aJournalMagic3));
     if( rc==SQLITE_OK ){
-      rc = write32bits(&pPager->jfd, pPager->tempFile ? 0xffffffff : 0);
+      rc = write32bits(&pPager->jfd, pPager->noSync ? 0xffffffff : 0);
     }
     if( rc==SQLITE_OK ){
       pPager->cksumInit = (u32)sqliteRandomInteger();
index 6dfe5edf3ca49e96764623e695a78276aebfdaa9..2b1153ee3c538ebedd6bc1a82f46e72ccbb57712 100644 (file)
@@ -12,7 +12,7 @@
 #
 # This file implements tests for the PRAGMA command.
 #
-# $Id: pragma.test,v 1.3 2003/01/18 20:11:07 drh Exp $
+# $Id: pragma.test,v 1.4 2003/02/15 23:09:17 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -116,21 +116,68 @@ do_test pragma-1.10 {
     PRAGMA default_synchronous;
   }
 } {123 123 0 0}
-
 do_test pragma-1.11 {
+  execsql {
+    PRAGMA synchronous=NORMAL;
+    PRAGMA cache_size;
+    PRAGMA default_cache_size;
+    PRAGMA synchronous;
+    PRAGMA default_synchronous;
+  }
+} {123 123 1 0}
+do_test pragma-1.12 {
+  execsql {
+    PRAGMA synchronous=FULL;
+    PRAGMA cache_size;
+    PRAGMA default_cache_size;
+    PRAGMA synchronous;
+    PRAGMA default_synchronous;
+  }
+} {123 123 2 0}
+do_test pragma-1.13 {
+  db close
+  set ::DB [sqlite db test.db]
+  execsql {
+    PRAGMA cache_size;
+    PRAGMA default_cache_size;
+    PRAGMA synchronous;
+    PRAGMA default_synchronous;
+  }
+} {123 123 0 0}
+do_test pragma-1.14 {
+  execsql {
+    PRAGMA default_synchronous=FULL;
+    PRAGMA cache_size;
+    PRAGMA default_cache_size;
+    PRAGMA synchronous;
+    PRAGMA default_synchronous;
+  }
+} {123 123 2 2}
+do_test pragma-1.15 {
+  db close
+  set ::DB [sqlite db test.db]
+  execsql {
+    PRAGMA cache_size;
+    PRAGMA default_cache_size;
+    PRAGMA synchronous;
+    PRAGMA default_synchronous;
+  }
+} {123 123 2 2}
+
+do_test pragma-2.1 {
   execsql {
     PRAGMA show_datatypes=on;
     PRAGMA empty_result_callbacks=off;
   }
   sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
 } {}
-do_test pragma-1.12 {
+do_test pragma-2.2 {
   execsql {
     PRAGMA empty_result_callbacks=on;
   }
   sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
 } {text text text integer text}
-do_test pragma-1.13 {
+do_test pragma-2.3 {
   execsql {
     CREATE TABLE t1(
        a INTEGER,
@@ -144,38 +191,38 @@ do_test pragma-1.13 {
   }
   sqlite_datatypes $::DB {SELECT * FROM t1}
 } {INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
-do_test pragma-1.14 {
+do_test pragma-2.4 {
   sqlite_datatypes $::DB {
      SELECT 1, 'hello', NULL
   }
 } {NUMERIC TEXT TEXT}
-do_test pragma-1.15 {
+do_test pragma-2.5 {
   sqlite_datatypes $::DB {
      SELECT 1+2 AS X, 'hello' || 5 AS Y, NULL AS Z
   }
 } {NUMERIC TEXT TEXT}
-do_test pragma-1.16 {
+do_test pragma-2.6 {
   execsql {
     CREATE VIEW v1 AS SELECT a+b, b||c, * FROM t1;
   }
   sqlite_datatypes $::DB {SELECT * FROM v1}
 } {NUMERIC TEXT INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
-do_test pragma-1.17 {
+do_test pragma-2.7 {
   sqlite_datatypes $::DB {
     SELECT d,e FROM t1 UNION SELECT a,c FROM t1
   }
 } {INTEGER WHATEVER}
-do_test pragma-1.18 {
+do_test pragma-2.8 {
   sqlite_datatypes $::DB {
     SELECT d,e FROM t1 EXCEPT SELECT c,e FROM t1
   }
 } {WHATEVER BLOB}
-do_test pragma-1.19 {
+do_test pragma-2.9 {
   sqlite_datatypes $::DB {
     SELECT d,e FROM t1 INTERSECT SELECT c,e FROM t1
   }
 } {WHATEVER BLOB}
-do_test pragma-1.20 {
+do_test pragma-2.10 {
   sqlite_datatypes $::DB {
     SELECT d,e FROM t1 INTERSECT SELECT c,e FROM v1
   }
index fe5e43d1df614e3e85ffb2455f7990dbf1f43701..d62903d8798b10eb95a509816ff750b630fd1c56 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is database locks.
 #
-# $Id: trans.test,v 1.17 2003/02/11 14:55:42 drh Exp $
+# $Id: trans.test,v 1.18 2003/02/15 23:09:17 drh Exp $
 
 
 set testdir [file dirname $argv0]
@@ -811,7 +811,11 @@ integrity_check trans-8.3
 #
 do_test trans-9.1 {
   execsql {
-    PRAGMA cache_size=10;
+    PRAGMA default_cache_size=10;
+  }
+  db close
+  sqlite db test.db
+  execsql {
     BEGIN;
     CREATE TABLE t3(x TEXT);
     INSERT INTO t3 VALUES(randstr(10,400));
@@ -858,6 +862,11 @@ for {set i 2} {$i<=$limit} {incr i} {
   set ::sig [signature]
   set cnt [lindex $::sig 0]
   set ::journal_format [expr {($i%3)+1}]
+  if {$i%2==0} {
+    execsql {PRAGMA synchronous=FULL}
+  } else {
+    execsql {PRAGMA synchronous=NORMAL}
+  }
   do_test trans-9.$i.1-$cnt {
      execsql {
        BEGIN;
index 1e9e8cf0515cdca5000e775e59ab471036ce15e0..1709bf9d1f18f33075f6db9c98faaba9831cf9cb 100644 (file)
@@ -480,6 +480,7 @@ do_test trigger2-6.1h {
     SELECT * from tbl;
   }
 } {}
+execsql {DELETE FROM tbl}
 
 
 # Handling of ON CONFLICT by UPDATE statements inside triggers
@@ -517,15 +518,18 @@ do_test trigger2-6.2e {
     SELECT * from tbl;
   }
 } {4 2 10 6 3 4}
-do_test trigger2-6.2f {
+do_test trigger2-6.2f.1 {
   execsql {
     UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
     SELECT * from tbl;
   }
 } {1 3 10}
-execsql {
-  INSERT INTO tbl VALUES (2, 3, 4);
-}
+do_test trigger2-6.2f.2 {
+  execsql {
+    INSERT INTO tbl VALUES (2, 3, 4);
+    SELECT * FROM tbl;
+  }
+} {1 3 10 2 3 4}
 do_test trigger2-6.2g {
   catchsql {
     UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
index db6bd21fb1c87cadbfbb52b78ba52e790aab65fe..4da54d08fce88d38c414928471864a3f604d8d27 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the UPDATE statement.
 #
-# $Id: update.test,v 1.11 2003/01/29 18:46:54 drh Exp $
+# $Id: update.test,v 1.12 2003/02/15 23:09:17 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -217,6 +217,7 @@ do_test update-5.6.5 {
 
 # Repeat the previous sequence of tests with a different index.
 #
+execsql {PRAGMA synchronous=FULL}
 do_test update-6.0 {
   execsql {DROP INDEX idx1}
   execsql {CREATE INDEX idx1 ON test1(f2)}
index 03dbd82fa44fc187de5f8cf72a0f602280969855..a7e3f4bb08217739ff6da86c8bb723fcfa996557 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Run this TCL script to generate HTML for the index.html file.
 #
-set rcsid {$Id: index.tcl,v 1.72 2003/01/18 22:01:07 drh Exp $}
+set rcsid {$Id: index.tcl,v 1.73 2003/02/15 23:09:17 drh Exp $}
 
 puts {<html>
 <head><title>SQLite: An Embeddable SQL Database Engine</title></head>
@@ -57,9 +57,8 @@ puts {<h2>Features</h2>
     different byte orders.</li>
 <li>Supports databases up to 2 terabytes (2^41 bytes) in size.</li>
 <li>Small memory footprint: less than 25K lines of C code.</li>
-<li><a href="speed.html">10x faster</a> than PostgreSQL and
-    <a href="speed.html">2x faster</a> than MySQL for many common 
-    operations.</li>
+<li><a href="speed.html">Two times faster</a> than PostgreSQL and
+    MySQL for many common operations.</li>
 <li>Very simple 
 <a href="c_interface.html">C/C++ interface</a> requires the use of only
 three functions and one opaque structure.</li>
index a30e4b32bb7f1856d0a0872743da5772fb917fd3..1ffa636cd3d0b1dd78a0c4c5aaf66e7bac8558b0 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Run this TCL script to generate HTML for the quickstart.html file.
 #
-set rcsid {$Id: quickstart.tcl,v 1.3 2003/01/21 23:06:58 drh Exp $}
+set rcsid {$Id: quickstart.tcl,v 1.4 2003/02/15 23:09:17 drh Exp $}
 
 puts {<html>
 <head><title>SQLite In 5 Minutes Or Less</title></head>
@@ -67,7 +67,7 @@ the first argument and the second argument is one or more SQL statements
 to execute against the database.  The function calls to pay attention
 to here are the call to <b>sqlite_open()</b> on line 22 which opens
 the database, <b>sqlite_exec()</b> on line 27 that executes SQL
-command against the database, and <b>sqlite_close()</b> on line 31
+commands against the database, and <b>sqlite_close()</b> on line 31
 that closes the database connection.</p>
 
 <blockquote><pre>