aboutsummaryrefslogtreecommitdiff
path: root/src/pragma.c
diff options
context:
space:
mode:
authoraswift <aswift@noemail.net>2008-11-21 00:10:35 +0000
committeraswift <aswift@noemail.net>2008-11-21 00:10:35 +0000
commitaebf413d9ad6e82b729418f7ebfd8a016e9952f8 (patch)
tree90cd9cc1f1b940ff67ecb20a839c491523876543 /src/pragma.c
parentd164fd3483019f7ee1c79e39ad33ebfa22b63597 (diff)
downloadsqlite-aebf413d9ad6e82b729418f7ebfd8a016e9952f8.tar.gz
sqlite-aebf413d9ad6e82b729418f7ebfd8a016e9952f8.zip
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
Diffstat (limited to 'src/pragma.c')
-rw-r--r--src/pragma.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/pragma.c b/src/pragma.c
index 71464e1d8..a467b6289 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.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>
@@ -707,6 +707,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
**