]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The BTree layer now returns SQLITE_READONLY on an attempt to open a write
authordrh <drh@noemail.net>
Wed, 10 Mar 2004 13:42:37 +0000 (13:42 +0000)
committerdrh <drh@noemail.net>
Wed, 10 Mar 2004 13:42:37 +0000 (13:42 +0000)
cursor on a read-only database.  Previously, the failure would not occur
until there was an attempt to write to the cursor. (CVS 1289)

FossilOrigin-Name: 8a8be4687bf9fd88952b303f30f93aa6fed75b60

manifest
manifest.uuid
src/btree.c

index 8e57a4bbfde8fb60a851c441cdbbb661819296f5..eea33069a3762c9e0100f32800684777a518ab6e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C The\sshell\sprogram\snow\signores\sextra\swhitespace\sat\sthe\send\sof\sdot-commands.\s(CVS\s1288)
-D 2004-03-09T13:37:45
+C The\sBTree\slayer\snow\sreturns\sSQLITE_READONLY\son\san\sattempt\sto\sopen\sa\swrite\r\ncursor\son\sa\sread-only\sdatabase.\s\sPreviously,\sthe\sfailure\swould\snot\soccur\r\nuntil\sthere\swas\san\sattempt\sto\swrite\sto\sthe\scursor.\s(CVS\s1289)
+D 2004-03-10T13:42:38
 F Makefile.in afc6c0377773421633e592347097ad036eef6aeb
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -23,7 +23,7 @@ F sqlite.def a4d2ada1c3667fd1bc18a37bf2ff9dcf138e0d51
 F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
 F src/attach.c b01db0d3211f673d8e670abf7eaad04591d40d14
 F src/auth.c 4fa3b05bd19445d1c474d6751c4a508d6ea0abe1
-F src/btree.c 0a40efb01fa3a431a16d8604f603431d8c9cebfa
+F src/btree.c 08a05b925b348c05d79b9b062b79e50d565678de
 F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
 F src/btree_rb.c 99feb3ff835106d018a483a1ce403e5cf9c718bc
 F src/build.c c8ab8b467d9a64254b0d4d42083f6313b3a980d1
@@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 4d5bbb3dc32412ee7fa5dec42d3278836a362e8c
-R 7966201eb81f0777d388a3d9d0fc9ed6
+P b6817e99bd97f427b1cfd16328d612e1a7d70d0a
+R dd6d5acc23ee81f1b56620c2e34fbfdc
 U drh
-Z 2e3536299dacf293bc7c5149672be287
+Z e8a7d40432246c6ffa11556ef33fac86
index 681d9d187a941fcda5bd1089ebae64308800b2e7..8cb40a6f925577156cce7a0b7186d91f55bc82d3 100644 (file)
@@ -1 +1 @@
-b6817e99bd97f427b1cfd16328d612e1a7d70d0a
\ No newline at end of file
+8a8be4687bf9fd88952b303f30f93aa6fed75b60
\ No newline at end of file
index 6b9c6b0215bcf61877eda0781990d730d38a401c..56450fc9f430ec178284e078a24a60f6d2391041 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.102 2004/02/14 17:35:07 drh Exp $
+** $Id: btree.c,v 1.103 2004/03/10 13:42:38 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** For a detailed discussion of BTrees, refer to
@@ -1031,10 +1031,15 @@ static int fileBtreeRollbackCkpt(Btree *pBt){
 ** root page of a b-tree.  If it is not, then the cursor acquired
 ** will not work correctly.
 */
-static int fileBtreeCursor(Btree *pBt, int iTable, int wrFlag, BtCursor **ppCur){
+static 
+int fileBtreeCursor(Btree *pBt, int iTable, int wrFlag, BtCursor **ppCur){
   int rc;
   BtCursor *pCur, *pRing;
 
+  if( pBt->readOnly && wrFlag ){
+    *ppCur = 0;
+    return SQLITE_READONLY;
+  }
   if( pBt->page1==0 ){
     rc = lockBtree(pBt);
     if( rc!=SQLITE_OK ){