mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Added support for proxy file locking style
Added pragma support for controlling proxy file locking Added file control access to last errno and proxy locking Added support for TMPDIR environment variable Extended unit tests to cover new proxy locking pragmas and file control features (CVS 5934) FossilOrigin-Name: b9bc36d3d5e35821ef69c0881a84c0afed253c9e
This commit is contained in:
44
src/pragma.c
44
src/pragma.c
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.194 2008/11/17 19:18:55 danielk1977 Exp $
|
||||
** $Id: pragma.c,v 1.195 2008/11/21 00:10:35 aswift Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -706,6 +706,48 @@ void sqlite3Pragma(
|
||||
}
|
||||
}else
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]lock_proxy_file
|
||||
** PRAGMA [database.]lock_proxy_file = ":auto:"|"lock_file_path"
|
||||
**
|
||||
** Return or set the value of the lock_proxy_file flag. Changing
|
||||
** the value sets a specific file to be used for database access locks.
|
||||
**
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft, "lock_proxy_file")==0 ){
|
||||
if( !zRight ){
|
||||
Pager *pPager = sqlite3BtreePager(pDb->pBt);
|
||||
char *proxy_file_path = NULL;
|
||||
sqlite3_file *pFile = sqlite3PagerFile(pPager);
|
||||
sqlite3OsFileControl(pFile, SQLITE_GET_LOCKPROXYFILE,
|
||||
&proxy_file_path);
|
||||
|
||||
if( proxy_file_path ){
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME,
|
||||
"lock_proxy_file", SQLITE_STATIC);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, proxy_file_path, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
|
||||
}
|
||||
}else{
|
||||
Pager *pPager = sqlite3BtreePager(pDb->pBt);
|
||||
sqlite3_file *pFile = sqlite3PagerFile(pPager);
|
||||
int res;
|
||||
if( zRight[0] ){
|
||||
res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE,
|
||||
zRight);
|
||||
} else {
|
||||
res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE,
|
||||
NULL);
|
||||
}
|
||||
if( res!=SQLITE_OK ){
|
||||
sqlite3ErrorMsg(pParse, "failed to set lock proxy file");
|
||||
goto pragma_out;
|
||||
}
|
||||
}
|
||||
}else
|
||||
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]synchronous
|
||||
** PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL
|
||||
|
||||
Reference in New Issue
Block a user