mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Move the implementation of sqlite3_enable_shared_cache from btree.c to main.c. (CVS 2902)
FossilOrigin-Name: 4f2ec95283f1ae0a28b2f9ce0afc5a7203de87fb
This commit is contained in:
29
src/main.c
29
src/main.c
@@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.321 2006/01/10 07:14:24 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.322 2006/01/10 13:58:48 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -1053,3 +1053,30 @@ int sqlite3Corrupt(void){
|
||||
return SQLITE_CORRUPT;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_SHARED_CACHE
|
||||
/*
|
||||
** Enable or disable the shared pager and schema features for the
|
||||
** current thread.
|
||||
**
|
||||
** This routine should only be called when there are no open
|
||||
** database connections.
|
||||
*/
|
||||
int sqlite3_enable_shared_cache(int enable){
|
||||
ThreadData *pTd = sqlite3ThreadData();
|
||||
|
||||
/* It is only legal to call sqlite3_enable_shared_cache() when there
|
||||
** are no currently open b-trees that were opened by the calling thread.
|
||||
** This condition is only easy to detect if the shared-cache were
|
||||
** previously enabled (and is being disabled).
|
||||
*/
|
||||
if( pTd->pBtree && !enable ){
|
||||
assert( pTd->useSharedData );
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
|
||||
pTd->useSharedData = enable;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user