aboutsummaryrefslogtreecommitdiff
path: root/src/pragma.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2009-07-02 07:47:33 +0000
committerdanielk1977 <danielk1977@noemail.net>2009-07-02 07:47:33 +0000
commit602b466e99d3b18eeffff19ee13eca2ef41f3131 (patch)
treee8b91c331aaf7ae70c3ea8a0e8af720b83ac9021 /src/pragma.c
parent325ccfa90e36c8607a5acddaffb25e408013fe05 (diff)
downloadsqlite-602b466e99d3b18eeffff19ee13eca2ef41f3131.tar.gz
sqlite-602b466e99d3b18eeffff19ee13eca2ef41f3131.zip
Cause opening a transaction on a sharable b-tree module automatically obtain a read-lock on page 1. This means there is no way for sqlite3BtreeGetMeta() to fail. (CVS 6836)
FossilOrigin-Name: e3c055f167f895ae45858de9d9d8a264df2f36b6
Diffstat (limited to 'src/pragma.c')
-rw-r--r--src/pragma.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/pragma.c b/src/pragma.c
index f77fc1c38..071e961d4 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.213 2009/06/19 14:06:03 drh Exp $
+** $Id: pragma.c,v 1.214 2009/07/02 07:47:33 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -318,12 +318,13 @@ void sqlite3Pragma(
*/
if( sqlite3StrICmp(zLeft,"default_cache_size")==0 ){
static const VdbeOpList getCacheSize[] = {
- { OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 0 */
- { OP_IfPos, 1, 6, 0},
+ { OP_Transaction, 0, 0, 0}, /* 0 */
+ { OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 1 */
+ { OP_IfPos, 1, 7, 0},
{ OP_Integer, 0, 2, 0},
{ OP_Subtract, 1, 2, 1},
- { OP_IfPos, 1, 6, 0},
- { OP_Integer, 0, 1, 0}, /* 5 */
+ { OP_IfPos, 1, 7, 0},
+ { OP_Integer, 0, 1, 0}, /* 6 */
{ OP_ResultRow, 1, 1, 0},
};
int addr;
@@ -335,7 +336,8 @@ void sqlite3Pragma(
pParse->nMem += 2;
addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
sqlite3VdbeChangeP1(v, addr, iDb);
- sqlite3VdbeChangeP1(v, addr+5, SQLITE_DEFAULT_CACHE_SIZE);
+ sqlite3VdbeChangeP1(v, addr+1, iDb);
+ sqlite3VdbeChangeP1(v, addr+6, SQLITE_DEFAULT_CACHE_SIZE);
}else{
int size = atoi(zRight);
if( size<0 ) size = -size;
@@ -1302,12 +1304,14 @@ void sqlite3Pragma(
}else{
/* Read the specified cookie value */
static const VdbeOpList readCookie[] = {
- { OP_ReadCookie, 0, 1, 0}, /* 0 */
+ { OP_Transaction, 0, 0, 0}, /* 0 */
+ { OP_ReadCookie, 0, 1, 0}, /* 1 */
{ OP_ResultRow, 1, 1, 0}
};
int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);
sqlite3VdbeChangeP1(v, addr, iDb);
- sqlite3VdbeChangeP3(v, addr, iCookie);
+ sqlite3VdbeChangeP1(v, addr+1, iDb);
+ sqlite3VdbeChangeP3(v, addr+1, iCookie);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);
}