1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

In shared-cache mode, lock all required tables before beginning to execute the body of the statement program. (CVS 2881)

FossilOrigin-Name: 23b587b05b89727248805e6d9e5141e018cf2152
This commit is contained in:
danielk1977
2006-01-07 13:21:04 +00:00
parent 8c0ca7d27c
commit c00da10565
16 changed files with 310 additions and 96 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.284 2006/01/06 21:52:50 drh Exp $
** $Id: btree.c,v 1.285 2006/01/07 13:21:04 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -2686,13 +2686,6 @@ int sqlite3BtreeCursor(
}
}
#ifndef SQLITE_OMIT_SHARED_CACHE
rc = queryTableLock(p, iTable, wrFlag?WRITE_LOCK:READ_LOCK);
if( rc!=SQLITE_OK ){
return rc;
}
#endif
if( pBt->pPage1==0 ){
rc = lockBtreeWithRetry(p);
if( rc!=SQLITE_OK ){
@@ -2715,13 +2708,6 @@ int sqlite3BtreeCursor(
goto create_cursor_exception;
}
/* Obtain the table-lock on the shared-btree. */
rc = lockTable(p, iTable, wrFlag?WRITE_LOCK:READ_LOCK);
if( rc!=SQLITE_OK ){
assert( rc==SQLITE_NOMEM );
goto create_cursor_exception;
}
/* Now that no other errors can occur, finish filling in the BtCursor
** variables, link the cursor into the BtShared list and set *ppCur (the
** output argument to this function).
@@ -6492,6 +6478,15 @@ int sqlite3BtreeSchemaLocked(Btree *p){
return (queryTableLock(p, MASTER_ROOT, READ_LOCK)!=SQLITE_OK);
}
int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
u8 lockType = (isWriteLock?WRITE_LOCK:READ_LOCK);
int rc = queryTableLock(p, iTab, lockType);
if( rc==SQLITE_OK ){
rc = lockTable(p, iTab, lockType);
}
return rc;
}
#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Enable the shared pager and schema features.