mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Simplifications to the LockTable opcode. (CVS 4954)
FossilOrigin-Name: 66c5d715bbb732b0861a8a6f994cb4a8f259f2f8
This commit is contained in:
18
src/btree.c
18
src/btree.c
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.448 2008/03/29 16:01:04 drh Exp $
|
||||
** $Id: btree.c,v 1.449 2008/04/02 16:29:31 drh Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
@@ -7075,13 +7075,17 @@ int sqlite3BtreeSchemaLocked(Btree *p){
|
||||
*/
|
||||
int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
|
||||
int rc = SQLITE_OK;
|
||||
u8 lockType = (isWriteLock?WRITE_LOCK:READ_LOCK);
|
||||
sqlite3BtreeEnter(p);
|
||||
rc = queryTableLock(p, iTab, lockType);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = lockTable(p, iTab, lockType);
|
||||
if( p->sharable ){
|
||||
u8 lockType = READ_LOCK + isWriteLock;
|
||||
assert( READ_LOCK+1==WRITE_LOCK );
|
||||
assert( isWriteLock==0 || isWriteLock==1 );
|
||||
sqlite3BtreeEnter(p);
|
||||
rc = queryTableLock(p, iTab, lockType);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = lockTable(p, iTab, lockType);
|
||||
}
|
||||
sqlite3BtreeLeave(p);
|
||||
}
|
||||
sqlite3BtreeLeave(p);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user