mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Remove the xLockState method for sqlite3_io_methods. Replace it with
a defined call to xFileControl(). This simplifies the interface and also gives us coverage testing of sqlite3_file_control(). (CVS 4355) FossilOrigin-Name: 306586c412b87c6d12bac796641517afa3f9eb6a
This commit is contained in:
34
manifest
34
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Allow\ssqllimits1.test\sto\sbe\srun\sfrom\sa\sregular\sbuild\sof\stestfixture.\sAdd\sthe\s'amalgamation-testfixture'\starget\sto\smain.mk\s-\sto\sbuild\stestfixture\svia\ssqlite3.c.\s(CVS\s4354)
|
C Remove\sthe\sxLockState\smethod\sfor\ssqlite3_io_methods.\s\sReplace\sit\swith\na\sdefined\scall\sto\sxFileControl().\s\sThis\ssimplifies\sthe\sinterface\sand\nalso\sgives\sus\scoverage\stesting\sof\ssqlite3_file_control().\s(CVS\s4355)
|
||||||
D 2007-08-31T17:42:48
|
D 2007-08-31T18:34:59
|
||||||
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
|
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
|
||||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -95,7 +95,7 @@ F src/func.c 10135a09d37f89b524bfea7c36368699e9c3b89a
|
|||||||
F src/hash.c 8fe2fa52bd17869c87748e42cff5b1e7fbf90822
|
F src/hash.c 8fe2fa52bd17869c87748e42cff5b1e7fbf90822
|
||||||
F src/hash.h 3ad3da76bfb954978d227bf495568b0e6da2c19e
|
F src/hash.h 3ad3da76bfb954978d227bf495568b0e6da2c19e
|
||||||
F src/insert.c b11e5ca0d68bf2a7a56f47a052a0ee67dd4e2f89
|
F src/insert.c b11e5ca0d68bf2a7a56f47a052a0ee67dd4e2f89
|
||||||
F src/journal.c 573911e274738b3fda813d4f0a6e319f8a9ecd36
|
F src/journal.c 2e0fb96d5e407a28b756b4a8b3694f2dccabe7f8
|
||||||
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
|
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
|
||||||
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
|
||||||
F src/loadext.c d8a41422b7c2a79d4cf89a62da404d6b786704cf
|
F src/loadext.c d8a41422b7c2a79d4cf89a62da404d6b786704cf
|
||||||
@@ -109,28 +109,28 @@ F src/mutex.h 079fa6fe9da18ceb89e79012c010594c6672addb
|
|||||||
F src/mutex_os2.c d47e9bd495583dd31263d8fe55160a31eb600a3c
|
F src/mutex_os2.c d47e9bd495583dd31263d8fe55160a31eb600a3c
|
||||||
F src/mutex_unix.c ff77650261a245035b79c5c8a174f4e05d3cae8a
|
F src/mutex_unix.c ff77650261a245035b79c5c8a174f4e05d3cae8a
|
||||||
F src/mutex_w32.c 54beb16ade8f80ea2bc30bc4dfb2087be3487ef3
|
F src/mutex_w32.c 54beb16ade8f80ea2bc30bc4dfb2087be3487ef3
|
||||||
F src/os.c 8e6ffe83863341b744c426254b3430b756a5115d
|
F src/os.c cc8b74355c931b360a23a8e88e07091e4baa39b8
|
||||||
F src/os.h efcdddd63d172857d9d769d56a0a0f161ac573dd
|
F src/os.h 53e65427899ed5697d79749d646e6a297b70171a
|
||||||
F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
|
F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
|
||||||
F src/os_os2.c 8769301bff502de642ad2634cedcb77d967ce199
|
F src/os_os2.c 8769301bff502de642ad2634cedcb77d967ce199
|
||||||
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
|
||||||
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
|
||||||
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
|
||||||
F src/os_unix.c 5c8fd11fa182b66f7e4f28ac0594e4092535551a
|
F src/os_unix.c 4d36cd037540a9c2af540bd15ab9d2a1dcc164fe
|
||||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||||
F src/os_win.c d8f9a643bbf627380bdc7166cbf70a06d115d2db
|
F src/os_win.c 60ab73611d9deb34018ba96bf05bf3b06cc34051
|
||||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||||
F src/pager.c 0c5fd990734174566ec6d67aebbdc3144f0f67fb
|
F src/pager.c 9b898267587e660a1eed124e95c8fa48b2d7966c
|
||||||
F src/pager.h 80fcf5218fdd46baee07ba8ad899a2da15671014
|
F src/pager.h f204c1a9fe0574953fba89c56d9d9bd1ddfa604a
|
||||||
F src/parse.y 2d2ce439dc6184621fb0b86f4fc5aca7f391a590
|
F src/parse.y 2d2ce439dc6184621fb0b86f4fc5aca7f391a590
|
||||||
F src/pragma.c 59a5e12ad0972ca2403503c12efb77f208c9a144
|
F src/pragma.c 363e548dafb52327face8d99757ab56a7b1c1b26
|
||||||
F src/prepare.c 1506fd279824b1f4bac97514966d0370101f9a6b
|
F src/prepare.c 1506fd279824b1f4bac97514966d0370101f9a6b
|
||||||
F src/printf.c 81e5db668c211b9b8a9483197d6118b19d76fa74
|
F src/printf.c 81e5db668c211b9b8a9483197d6118b19d76fa74
|
||||||
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
|
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
|
||||||
F src/select.c 4706a6115da1bdc09a2be5991168a6cc2c0df267
|
F src/select.c 4706a6115da1bdc09a2be5991168a6cc2c0df267
|
||||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||||
F src/shell.c ac29402b538515fa4697282387be9c1205e6e9eb
|
F src/shell.c ac29402b538515fa4697282387be9c1205e6e9eb
|
||||||
F src/sqlite.h.in fa367ce8e8a9b50eb65189788bad12e6240c82bb
|
F src/sqlite.h.in 090436ac9963592c2c2b4ae9e4d0bb774c722e09
|
||||||
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
|
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
|
||||||
F src/sqliteInt.h adc8a20e80ccf9eef24cc32f241a3427915a136e
|
F src/sqliteInt.h adc8a20e80ccf9eef24cc32f241a3427915a136e
|
||||||
F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12
|
F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12
|
||||||
@@ -141,11 +141,11 @@ F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac
|
|||||||
F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
|
F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
|
||||||
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
|
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
|
||||||
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
|
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
|
||||||
F src/test6.c a3480a6e7dafc8b18af59221063bf90a7bfa1990
|
F src/test6.c 128084277e05073df360a030af68c22c62e19b2b
|
||||||
F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
|
F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
|
||||||
F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
|
F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
|
||||||
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
|
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
|
||||||
F src/test_async.c f222bd196b55a2e73b1427400d5aa97841787167
|
F src/test_async.c 8b6aa6a5701bf3cf52708db178379ee608b44b0c
|
||||||
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
|
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
|
||||||
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
|
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
|
||||||
F src/test_config.c 3f50b4060c360d33d069e64ce5684eac43fbf4db
|
F src/test_config.c 3f50b4060c360d33d069e64ce5684eac43fbf4db
|
||||||
@@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||||
P d3ab3e3911f10b17d0859a34f4f007c790a0cd82
|
P d119427314d27f291b605073d34826cdb89746c1
|
||||||
R d2fe57741cd389ef9ecc7e0f4057df24
|
R 5a754c2a05368b21aadde7128c0f2568
|
||||||
U danielk1977
|
U drh
|
||||||
Z 5fccbc4c380bea847cb60000a3027db2
|
Z d953f5ab4979b6f6daa0a1ff8fd3931b
|
||||||
|
@@ -1 +1 @@
|
|||||||
d119427314d27f291b605073d34826cdb89746c1
|
306586c412b87c6d12bac796641517afa3f9eb6a
|
@@ -10,7 +10,7 @@
|
|||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
**
|
**
|
||||||
** @(#) $Id: journal.c,v 1.3 2007/08/24 08:15:54 danielk1977 Exp $
|
** @(#) $Id: journal.c,v 1.4 2007/08/31 18:34:59 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
||||||
@@ -186,8 +186,7 @@ static struct sqlite3_io_methods JournalFileMethods = {
|
|||||||
0, /* xLock */
|
0, /* xLock */
|
||||||
0, /* xUnlock */
|
0, /* xUnlock */
|
||||||
0, /* xCheckReservedLock */
|
0, /* xCheckReservedLock */
|
||||||
0, /* xBreakLock */
|
0, /* xFileControl */
|
||||||
0, /* xLockState */
|
|
||||||
0, /* xSectorSize */
|
0, /* xSectorSize */
|
||||||
0 /* xDeviceCharacteristics */
|
0 /* xDeviceCharacteristics */
|
||||||
};
|
};
|
||||||
@@ -239,4 +238,3 @@ int sqlite3JournalSize(sqlite3_vfs *pVfs){
|
|||||||
return (pVfs->szOsFile+sizeof(JournalFile));
|
return (pVfs->szOsFile+sizeof(JournalFile));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
11
src/os.c
11
src/os.c
@@ -88,17 +88,6 @@ int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
|
|
||||||
/* These methods are currently only used for testing and debugging. */
|
|
||||||
int sqlite3OsFileHandle(sqlite3_file *id){
|
|
||||||
/* return id->pMethods->xFileHandle(id); */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int sqlite3OsLockState(sqlite3_file *id){
|
|
||||||
return id->pMethods->xLockState(id);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The next group of routines are convenience wrappers around the
|
** The next group of routines are convenience wrappers around the
|
||||||
** VFS methods.
|
** VFS methods.
|
||||||
|
6
src/os.h
6
src/os.h
@@ -240,7 +240,6 @@ int sqlite3OsFileSize(sqlite3_file*, i64 *pSize);
|
|||||||
int sqlite3OsLock(sqlite3_file*, int);
|
int sqlite3OsLock(sqlite3_file*, int);
|
||||||
int sqlite3OsUnlock(sqlite3_file*, int);
|
int sqlite3OsUnlock(sqlite3_file*, int);
|
||||||
int sqlite3OsCheckReservedLock(sqlite3_file *id);
|
int sqlite3OsCheckReservedLock(sqlite3_file *id);
|
||||||
int sqlite3OsLockState(sqlite3_file *id);
|
|
||||||
int sqlite3OsFileControl(sqlite3_file*,int,void*);
|
int sqlite3OsFileControl(sqlite3_file*,int,void*);
|
||||||
int sqlite3OsSectorSize(sqlite3_file *id);
|
int sqlite3OsSectorSize(sqlite3_file *id);
|
||||||
int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
|
int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
|
||||||
@@ -268,11 +267,6 @@ int sqlite3OsCurrentTime(sqlite3_vfs *, double*);
|
|||||||
int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);
|
int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);
|
||||||
int sqlite3OsCloseFree(sqlite3_file *);
|
int sqlite3OsCloseFree(sqlite3_file *);
|
||||||
|
|
||||||
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
|
|
||||||
int sqlite3OsFileHandle(sqlite3_file *id);
|
|
||||||
int sqlite3OsLockState(sqlite3_file *id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Each OS-specific backend defines an instance of the following
|
** Each OS-specific backend defines an instance of the following
|
||||||
** structure for returning a pointer to its sqlite3_vfs. If OS_OTHER
|
** structure for returning a pointer to its sqlite3_vfs. If OS_OTHER
|
||||||
|
@@ -2016,18 +2016,16 @@ static int nolockUnixClose(sqlite3_file *id) {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** No xFileControl opcodes are implemented by this VFS.
|
** Information and control of an open file handle.
|
||||||
*/
|
*/
|
||||||
static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||||
return SQLITE_ERROR;
|
switch( op ){
|
||||||
|
case SQLITE_FCNTL_LOCKSTATE: {
|
||||||
|
*(int*)pArg = ((unixFile*)id)->locktype;
|
||||||
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
return SQLITE_ERROR;
|
||||||
** Return an integer that indices the type of lock currently held
|
|
||||||
** by this handle. (Used for testing and analysis only.)
|
|
||||||
*/
|
|
||||||
static int unixLockState(sqlite3_file *id){
|
|
||||||
return ((unixFile*)id)->locktype;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2066,7 +2064,6 @@ static const sqlite3_io_methods sqlite3UnixIoMethod = {
|
|||||||
unixLock,
|
unixLock,
|
||||||
unixUnlock,
|
unixUnlock,
|
||||||
unixCheckReservedLock,
|
unixCheckReservedLock,
|
||||||
unixLockState,
|
|
||||||
unixFileControl,
|
unixFileControl,
|
||||||
unixSectorSize,
|
unixSectorSize,
|
||||||
unixDeviceCharacteristics
|
unixDeviceCharacteristics
|
||||||
@@ -2088,7 +2085,6 @@ static const sqlite3_io_methods sqlite3AFPLockingUnixIoMethod = {
|
|||||||
afpUnixLock,
|
afpUnixLock,
|
||||||
afpUnixUnlock,
|
afpUnixUnlock,
|
||||||
afpUnixCheckReservedLock,
|
afpUnixCheckReservedLock,
|
||||||
unixLockState,
|
|
||||||
unixFileControl,
|
unixFileControl,
|
||||||
unixSectorSize,
|
unixSectorSize,
|
||||||
unixDeviceCharacteristics
|
unixDeviceCharacteristics
|
||||||
@@ -2109,7 +2105,6 @@ static const sqlite3_io_methods sqlite3FlockLockingUnixIoMethod = {
|
|||||||
flockUnixLock,
|
flockUnixLock,
|
||||||
flockUnixUnlock,
|
flockUnixUnlock,
|
||||||
flockUnixCheckReservedLock,
|
flockUnixCheckReservedLock,
|
||||||
unixLockState,
|
|
||||||
unixFileControl,
|
unixFileControl,
|
||||||
unixSectorSize,
|
unixSectorSize,
|
||||||
unixDeviceCharacteristics
|
unixDeviceCharacteristics
|
||||||
@@ -2130,7 +2125,6 @@ static const sqlite3_io_methods sqlite3DotlockLockingUnixIoMethod = {
|
|||||||
dotlockUnixLock,
|
dotlockUnixLock,
|
||||||
dotlockUnixUnlock,
|
dotlockUnixUnlock,
|
||||||
dotlockUnixCheckReservedLock,
|
dotlockUnixCheckReservedLock,
|
||||||
unixLockState,
|
|
||||||
unixFileControl,
|
unixFileControl,
|
||||||
unixSectorSize,
|
unixSectorSize,
|
||||||
unixDeviceCharacteristics
|
unixDeviceCharacteristics
|
||||||
@@ -2151,7 +2145,6 @@ static const sqlite3_io_methods sqlite3NolockLockingUnixIoMethod = {
|
|||||||
nolockUnixLock,
|
nolockUnixLock,
|
||||||
nolockUnixUnlock,
|
nolockUnixUnlock,
|
||||||
nolockUnixCheckReservedLock,
|
nolockUnixCheckReservedLock,
|
||||||
unixLockState,
|
|
||||||
unixFileControl,
|
unixFileControl,
|
||||||
unixSectorSize,
|
unixSectorSize,
|
||||||
unixDeviceCharacteristics
|
unixDeviceCharacteristics
|
||||||
|
20
src/os_win.c
20
src/os_win.c
@@ -977,19 +977,16 @@ static int winUnlock(sqlite3_file *id, int locktype){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** No xFileControl operations are currently implemented.
|
** Control and query of the open file handle.
|
||||||
*/
|
*/
|
||||||
static int winFileControl(sqlite3_file *id){
|
static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||||
return SQLITE_ERROR;
|
switch( op ){
|
||||||
|
case SQLITE_FCNTL_LOCKSTATE: {
|
||||||
|
*(int*)pArg = ((winFile*)id)->locktype;
|
||||||
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
return SQLITE_ERROR;
|
||||||
** Return an integer that indices the type of lock currently held
|
|
||||||
** by this handle. (Used for testing and analysis only.)
|
|
||||||
*/
|
|
||||||
static int winLockState(sqlite3_file *id){
|
|
||||||
winFile *pFile = (winFile*)id;
|
|
||||||
return pFile->locktype;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1028,7 +1025,6 @@ static const sqlite3_io_methods winIoMethod = {
|
|||||||
winLock,
|
winLock,
|
||||||
winUnlock,
|
winUnlock,
|
||||||
winCheckReservedLock,
|
winCheckReservedLock,
|
||||||
winLockState,
|
|
||||||
winFileControl,
|
winFileControl,
|
||||||
winSectorSize,
|
winSectorSize,
|
||||||
winDeviceCharacteristics
|
winDeviceCharacteristics
|
||||||
|
13
src/pager.c
13
src/pager.c
@@ -18,7 +18,7 @@
|
|||||||
** file simultaneously, or one process from reading the database while
|
** file simultaneously, or one process from reading the database while
|
||||||
** another is writing.
|
** another is writing.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.c,v 1.382 2007/08/31 16:11:36 drh Exp $
|
** @(#) $Id: pager.c,v 1.383 2007/08/31 18:34:59 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_DISKIO
|
#ifndef SQLITE_OMIT_DISKIO
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -5010,17 +5010,6 @@ int sqlite3PagerLockingMode(Pager *pPager, int eMode){
|
|||||||
return (int)pPager->exclusiveMode;
|
return (int)pPager->exclusiveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
|
||||||
/*
|
|
||||||
** Return the current state of the file lock for the given pager.
|
|
||||||
** The return value is one of NO_LOCK, SHARED_LOCK, RESERVED_LOCK,
|
|
||||||
** PENDING_LOCK, or EXCLUSIVE_LOCK.
|
|
||||||
*/
|
|
||||||
int sqlite3PagerLockstate(Pager *pPager){
|
|
||||||
return sqlite3OsLockState(pPager->fd);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_DEBUG
|
#ifdef SQLITE_DEBUG
|
||||||
/*
|
/*
|
||||||
** Print a listing of all referenced pages and their ref count.
|
** Print a listing of all referenced pages and their ref count.
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** subsystem. The page cache subsystem reads and writes a file a page
|
** subsystem. The page cache subsystem reads and writes a file a page
|
||||||
** at a time and provides a journal for rollback.
|
** at a time and provides a journal for rollback.
|
||||||
**
|
**
|
||||||
** @(#) $Id: pager.h,v 1.65 2007/08/31 16:11:36 drh Exp $
|
** @(#) $Id: pager.h,v 1.66 2007/08/31 18:34:59 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PAGER_H_
|
#ifndef _PAGER_H_
|
||||||
@@ -108,10 +108,6 @@ int sqlite3PagerLockingMode(Pager *, int);
|
|||||||
int sqlite3PagerIswriteable(DbPage*);
|
int sqlite3PagerIswriteable(DbPage*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
|
||||||
int sqlite3PagerLockstate(Pager*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_TEST
|
#ifdef SQLITE_TEST
|
||||||
int *sqlite3PagerStats(Pager*);
|
int *sqlite3PagerStats(Pager*);
|
||||||
void sqlite3PagerRefdump(Pager*);
|
void sqlite3PagerRefdump(Pager*);
|
||||||
|
14
src/pragma.c
14
src/pragma.c
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to implement the PRAGMA command.
|
** This file contains code used to implement the PRAGMA command.
|
||||||
**
|
**
|
||||||
** $Id: pragma.c,v 1.148 2007/08/30 10:07:39 danielk1977 Exp $
|
** $Id: pragma.c,v 1.149 2007/08/31 18:34:59 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1108,16 +1108,18 @@ void sqlite3Pragma(
|
|||||||
for(i=0; i<db->nDb; i++){
|
for(i=0; i<db->nDb; i++){
|
||||||
Btree *pBt;
|
Btree *pBt;
|
||||||
Pager *pPager;
|
Pager *pPager;
|
||||||
|
const char *zState = "unknown";
|
||||||
|
int j;
|
||||||
if( db->aDb[i].zName==0 ) continue;
|
if( db->aDb[i].zName==0 ) continue;
|
||||||
sqlite3VdbeOp3(v, OP_String8, 0, 0, db->aDb[i].zName, P3_STATIC);
|
sqlite3VdbeOp3(v, OP_String8, 0, 0, db->aDb[i].zName, P3_STATIC);
|
||||||
pBt = db->aDb[i].pBt;
|
pBt = db->aDb[i].pBt;
|
||||||
if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
|
if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
|
||||||
sqlite3VdbeOp3(v, OP_String8, 0, 0, "closed", P3_STATIC);
|
zState = "closed";
|
||||||
}else{
|
}else if( sqlite3_file_control(db, db->aDb[i].zName,
|
||||||
int j = sqlite3PagerLockstate(pPager);
|
SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
|
||||||
sqlite3VdbeOp3(v, OP_String8, 0, 0,
|
zState = azLockName[j];
|
||||||
(j>=0 && j<=4) ? azLockName[j] : "unknown", P3_STATIC);
|
|
||||||
}
|
}
|
||||||
|
sqlite3VdbeOp3(v, OP_String8, 0, 0, zState, P3_STATIC);
|
||||||
sqlite3VdbeAddOp(v, OP_Callback, 2, 0);
|
sqlite3VdbeAddOp(v, OP_Callback, 2, 0);
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
** the version number) and changes its name to "sqlite3.h" as
|
** the version number) and changes its name to "sqlite3.h" as
|
||||||
** part of the build process.
|
** part of the build process.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite.h.in,v 1.252 2007/08/31 16:11:36 drh Exp $
|
** @(#) $Id: sqlite.h.in,v 1.253 2007/08/31 18:34:59 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef _SQLITE3_H_
|
||||||
#define _SQLITE3_H_
|
#define _SQLITE3_H_
|
||||||
@@ -481,11 +481,10 @@ struct sqlite3_file {
|
|||||||
** write return values. Potential uses for xFileControl() might be
|
** write return values. Potential uses for xFileControl() might be
|
||||||
** functions to enable blocking locks with timeouts, to change the
|
** functions to enable blocking locks with timeouts, to change the
|
||||||
** locking strategy (for example to use dot-file locks), to inquire
|
** locking strategy (for example to use dot-file locks), to inquire
|
||||||
** about the status of a lock, or to break stale locks. No standard
|
** about the status of a lock, or to break stale locks. The SQLite
|
||||||
** xFileControl opcodes are currently defined, but this may change in
|
** core reserves opcodes less than 100 for its own use. Applications
|
||||||
** future releases. Applications that define a custom xFileControl
|
** that define a custom xFileControl method should use opcodes
|
||||||
** method should use opcodes greater than 100 to avoid conflicts
|
** greater than 100 to avoid conflicts.
|
||||||
** with future official opcodes which will be less than that value.
|
|
||||||
**
|
**
|
||||||
** The xSectorSize() method returns the sector size of the
|
** The xSectorSize() method returns the sector size of the
|
||||||
** device that underlies the file. The sector size is the
|
** device that underlies the file. The sector size is the
|
||||||
@@ -531,13 +530,29 @@ struct sqlite3_io_methods {
|
|||||||
int (*xLock)(sqlite3_file*, int);
|
int (*xLock)(sqlite3_file*, int);
|
||||||
int (*xUnlock)(sqlite3_file*, int);
|
int (*xUnlock)(sqlite3_file*, int);
|
||||||
int (*xCheckReservedLock)(sqlite3_file*);
|
int (*xCheckReservedLock)(sqlite3_file*);
|
||||||
int (*xLockState)(sqlite3_file *);
|
|
||||||
int (*xFileControl)(sqlite3_file*, int op, void *pArg);
|
int (*xFileControl)(sqlite3_file*, int op, void *pArg);
|
||||||
int (*xSectorSize)(sqlite3_file*);
|
int (*xSectorSize)(sqlite3_file*);
|
||||||
int (*xDeviceCharacteristics)(sqlite3_file*);
|
int (*xDeviceCharacteristics)(sqlite3_file*);
|
||||||
/* Additional methods may be added in future releases */
|
/* Additional methods may be added in future releases */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Standard File Control Opcodes
|
||||||
|
**
|
||||||
|
** These integer constants are opcodes for the xFileControl method
|
||||||
|
** of the [sqlite3_io_methods] object and to the [sqlite3_file_control()]
|
||||||
|
** interface.
|
||||||
|
**
|
||||||
|
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
|
||||||
|
** opcode cases the xFileControl method to write the current state of
|
||||||
|
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
|
||||||
|
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
|
||||||
|
** into an integer that the pArg argument points to. This capability
|
||||||
|
** is used during testing and only needs to be supported when SQLITE_TEST
|
||||||
|
** is defined.
|
||||||
|
*/
|
||||||
|
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Mutex Handle
|
** CAPI3REF: Mutex Handle
|
||||||
**
|
**
|
||||||
|
@@ -473,9 +473,6 @@ static int cfUnlock(sqlite3_file *pFile, int eLock){
|
|||||||
static int cfCheckReservedLock(sqlite3_file *pFile){
|
static int cfCheckReservedLock(sqlite3_file *pFile){
|
||||||
return sqlite3OsCheckReservedLock(((CrashFile *)pFile)->pRealFile);
|
return sqlite3OsCheckReservedLock(((CrashFile *)pFile)->pRealFile);
|
||||||
}
|
}
|
||||||
static int cfLockState(sqlite3_file *pFile){
|
|
||||||
return sqlite3OsLockState(((CrashFile *)pFile)->pRealFile);
|
|
||||||
}
|
|
||||||
static int cfFileControl(sqlite3_file *pFile, int op, void *pArg){
|
static int cfFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||||
return sqlite3OsFileControl(((CrashFile *)pFile)->pRealFile, op, pArg);
|
return sqlite3OsFileControl(((CrashFile *)pFile)->pRealFile, op, pArg);
|
||||||
}
|
}
|
||||||
@@ -503,7 +500,6 @@ static const sqlite3_io_methods CrashFileVtab = {
|
|||||||
cfLock, /* xLock */
|
cfLock, /* xLock */
|
||||||
cfUnlock, /* xUnlock */
|
cfUnlock, /* xUnlock */
|
||||||
cfCheckReservedLock, /* xCheckReservedLock */
|
cfCheckReservedLock, /* xCheckReservedLock */
|
||||||
cfLockState, /* xLockState */
|
|
||||||
cfFileControl, /* xFileControl */
|
cfFileControl, /* xFileControl */
|
||||||
cfSectorSize, /* xSectorSize */
|
cfSectorSize, /* xSectorSize */
|
||||||
cfDeviceCharacteristics /* xDeviceCharacteristics */
|
cfDeviceCharacteristics /* xDeviceCharacteristics */
|
||||||
|
@@ -612,15 +612,8 @@ static int asyncCheckReservedLock(sqlite3_file *pFile){
|
|||||||
/*
|
/*
|
||||||
** This is a no-op, as the asynchronous backend does not support locking.
|
** This is a no-op, as the asynchronous backend does not support locking.
|
||||||
*/
|
*/
|
||||||
static int asyncBreakLock(sqlite3_file *id){
|
static int asyncFileControl(sqlite3_file *id, int op, void *pArg){
|
||||||
return SQLITE_OK;
|
return SQLITE_ERROR;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** This is broken. But sqlite3OsLockState() is only used for testing anyway.
|
|
||||||
*/
|
|
||||||
static int asyncLockState(sqlite3_file *id){
|
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -656,8 +649,7 @@ static int asyncOpen(
|
|||||||
asyncLock, /* xLock */
|
asyncLock, /* xLock */
|
||||||
asyncUnlock, /* xUnlock */
|
asyncUnlock, /* xUnlock */
|
||||||
asyncCheckReservedLock, /* xCheckReservedLock */
|
asyncCheckReservedLock, /* xCheckReservedLock */
|
||||||
asyncBreakLock, /* xBreakLock */
|
asyncFileControl, /* xFileControl */
|
||||||
asyncLockState, /* xLockState */
|
|
||||||
asyncSectorSize, /* xSectorSize */
|
asyncSectorSize, /* xSectorSize */
|
||||||
asyncDeviceCharacteristics /* xDeviceCharacteristics */
|
asyncDeviceCharacteristics /* xDeviceCharacteristics */
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user