Add the SQLITE_FCNTL_WIN32_GET_HANDLE file control.
FossilOrigin-Name: 16039be3739b8d3b34a1e6093eaebb09e07f984b
This commit is contained in:
commit
8705f868e0
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Bump\sthe\sversion\snumber\sin\santicipation\sof\sthe\snext\sdevelopment\scycle.
|
||||
D 2016-10-14T21:16:27.395
|
||||
C Add\sthe\sSQLITE_FCNTL_WIN32_GET_HANDLE\sfile\scontrol.
|
||||
D 2016-10-14T21:27:50.450
|
||||
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
|
||||
@ -371,7 +371,7 @@ F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c be9ca0f901a2b6c1bc93dc338f4863675180c189
|
||||
F src/os_win.c 520f23475f1de530c435d30b67b7b15fe90874b0
|
||||
F src/os_win.c cf90abd4e50d9f56d2c20ce8e005aff55d7bd8e9
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c bf5b71bde3e9b6110e7d6990607db881f6a471a2
|
||||
F src/pager.h 966d2769e76ae347c8a32c4165faf6e6cb64546d
|
||||
@ -388,7 +388,7 @@ F src/resolve.c 3fac1b2737ea5a724f20b921ac7e259c9be2100b
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c ea3af83e2d0f245fef81ea4cf04cb730ce67f722
|
||||
F src/shell.c b80396d2fadce4681397707e30078bf416e1dec2
|
||||
F src/sqlite.h.in 2683a291ed8db5228024267be6421f0de507b80e
|
||||
F src/sqlite.h.in 1011de924a6a7340c74e5442cb76f7b49c134512
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
|
||||
F src/sqliteInt.h 8d241c2c0a1a7b6611d3e9398f41d69426da850d
|
||||
@ -396,7 +396,7 @@ F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
|
||||
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
|
||||
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
|
||||
F src/tclsqlite.c aef87dcd8cb66564d560ab48d43d19ac812a1eab
|
||||
F src/test1.c 61a08ed5861f3396ea4ff83931387696b692e1f8
|
||||
F src/test1.c 1f1a399956c8730d5f7b09c729e98764f2082162
|
||||
F src/test2.c b7174313e993754303a8b33c43df7c44b46857ab
|
||||
F src/test3.c d03f5b5da9a2410b7a91c64b0d3306ed28ab6fee
|
||||
F src/test4.c 18ec393bb4d0ad1de729f0b94da7267270f3d8e6
|
||||
@ -679,7 +679,7 @@ F test/expr.test 66a2c9ac34f74f036faa4092f5402c7d3162fc93
|
||||
F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9
|
||||
F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79
|
||||
F test/fallocate.test 3e979af17dfa7e5e9dda5eba1a696c04fa9d47f7
|
||||
F test/filectrl.test 7c13f96457435238da99aff7343ad6a3a4885787
|
||||
F test/filectrl.test c6547e6c3c4c3ef9707a0b3dc147de718135cacc
|
||||
F test/filefmt.test e4edbdc637ca9576ccf4337a3cce627d9df7a56c
|
||||
F test/fkey1.test 13e3d48236a2b9f5c5ebd232eef9b3ab682a8a2c
|
||||
F test/fkey2.test f3d27ecba480a348c328965d154214719bb158a9
|
||||
@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 707875582fcba352b4906a595ad89198d84711d8
|
||||
R 87fa5c02031b01e516917f863b526e7b
|
||||
U drh
|
||||
Z b28813ae6ede81ad47c41c9f8f93c9ca
|
||||
P aa6de9c40ba2d906772b9032fd5d798661f6d4cc b6ddabe1818c36007c476a31e2e35755630a5f14
|
||||
R 60e5658793423fe7463e5f09d2e53763
|
||||
U mistachkin
|
||||
Z 76feeade398c4222d6ce153559d25186
|
||||
|
@ -1 +1 @@
|
||||
aa6de9c40ba2d906772b9032fd5d798661f6d4cc
|
||||
16039be3739b8d3b34a1e6093eaebb09e07f984b
|
@ -3488,6 +3488,12 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_WIN32_GET_HANDLE: {
|
||||
LPHANDLE phFile = (LPHANDLE)pArg;
|
||||
*phFile = pFile->h;
|
||||
OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#ifdef SQLITE_TEST
|
||||
case SQLITE_FCNTL_WIN32_SET_HANDLE: {
|
||||
LPHANDLE phFile = (LPHANDLE)pArg;
|
||||
|
@ -978,6 +978,12 @@ struct sqlite3_io_methods {
|
||||
** on whether or not the file has been renamed, moved, or deleted since it
|
||||
** was first opened.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
|
||||
** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
|
||||
** underlying native file handle associated with a file handle. This file
|
||||
** control interprets its argument as a pointer to a native file handle and
|
||||
** writes the resulting value there.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
|
||||
** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
|
||||
** opcode causes the xFileControl method to swap the file handle with the one
|
||||
@ -1028,6 +1034,7 @@ struct sqlite3_io_methods {
|
||||
#define SQLITE_FCNTL_RBU 26
|
||||
#define SQLITE_FCNTL_VFS_POINTER 27
|
||||
#define SQLITE_FCNTL_JOURNAL_POINTER 28
|
||||
#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
|
||||
|
||||
/* deprecated names */
|
||||
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
||||
|
33
src/test1.c
33
src/test1.c
@ -5677,6 +5677,38 @@ static int SQLITE_TCLAPI file_control_win32_av_retry(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** tclcmd: file_control_win32_get_handle DB
|
||||
**
|
||||
** This TCL command runs the sqlite3_file_control interface with
|
||||
** the SQLITE_FCNTL_WIN32_GET_HANDLE opcode.
|
||||
*/
|
||||
static int file_control_win32_get_handle(
|
||||
ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
HANDLE hFile = NULL;
|
||||
char z[100];
|
||||
|
||||
if( objc!=2 ){
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
rc = sqlite3_file_control(db, NULL, SQLITE_FCNTL_WIN32_GET_HANDLE,
|
||||
(void*)&hFile);
|
||||
sqlite3_snprintf(sizeof(z), z, "%d %p", rc, (void*)hFile);
|
||||
Tcl_AppendResult(interp, z, (char*)0);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** tclcmd: file_control_win32_set_handle DB HANDLE
|
||||
**
|
||||
@ -7441,6 +7473,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
{ "file_control_sizehint_test", file_control_sizehint_test, 0 },
|
||||
#if SQLITE_OS_WIN
|
||||
{ "file_control_win32_av_retry", file_control_win32_av_retry, 0 },
|
||||
{ "file_control_win32_get_handle", file_control_win32_get_handle, 0 },
|
||||
{ "file_control_win32_set_handle", file_control_win32_set_handle, 0 },
|
||||
#endif
|
||||
{ "file_control_persist_wal", file_control_persist_wal, 0 },
|
||||
|
@ -43,4 +43,30 @@ do_test filectrl-1.6 {
|
||||
} {/etilqs_/}
|
||||
db close
|
||||
forcedelete .test_control_lockproxy.db-conch test.proxy
|
||||
forcedelete test.db test2.db
|
||||
|
||||
if {$tcl_platform(platform)=="windows"} {
|
||||
do_test filectrl-2.1 {
|
||||
sqlite3 db test2.db
|
||||
set size [file size test2.db]
|
||||
set handle [file_control_win32_get_handle db]
|
||||
db close
|
||||
forcedelete test2.db
|
||||
list $size $handle [expr {$handle != 0}]
|
||||
} {/^0 \{0 \d+\} 1$/}
|
||||
|
||||
do_test filectrl-2.2 {
|
||||
sqlite3 db test2.db
|
||||
execsql {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576));
|
||||
}
|
||||
set size [file size test2.db]
|
||||
set handle [file_control_win32_get_handle db]
|
||||
db close
|
||||
forcedelete test2.db
|
||||
list $size $handle [expr {$handle != 0}]
|
||||
} {/^1\d+ \{0 \d+\} 1$/}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user