aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-11-13 14:58:35 +0000
committerdrh <>2024-11-13 14:58:35 +0000
commit1b37bc0e668a0bfefbd0a71bdcae25017b29b5fa (patch)
treef85ba0a7001f0078b18b39c0673a5bca7e9f0860 /src
parent92e9fa6fe887fc5cad73b4251ce06e295d7a0d2c (diff)
downloadsqlite-1b37bc0e668a0bfefbd0a71bdcae25017b29b5fa.tar.gz
sqlite-1b37bc0e668a0bfefbd0a71bdcae25017b29b5fa.zip
Add the SQLITE_FCNTL_NULL_IO file-control.
FossilOrigin-Name: f0e917fcf51b59f8ccfe5b9341937341d0e6016eb275d6c33dcb10b0b301a9da
Diffstat (limited to 'src')
-rw-r--r--src/os_unix.c5
-rw-r--r--src/os_win.c5
-rw-r--r--src/sqlite.h.in6
3 files changed, 16 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 8cc188674..b1996278c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3987,6 +3987,11 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
}
#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+ case SQLITE_FCNTL_NULL_IO: {
+ osClose(pFile->h);
+ pFile->h = -1;
+ return SQLITE_OK;
+ }
case SQLITE_FCNTL_LOCKSTATE: {
*(int*)pArg = pFile->eFileLock;
return SQLITE_OK;
diff --git a/src/os_win.c b/src/os_win.c
index 97743412e..4d245263f 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -3599,6 +3599,11 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
return SQLITE_OK;
}
#endif
+ case SQLITE_FCNTL_NULL_IO: {
+ (void)osCloseHandle(pFile->h);
+ pFile->h = NULL;
+ return SQLITE_OK;
+ }
case SQLITE_FCNTL_TEMPFILENAME: {
char *zTFile = 0;
int rc = winGetTempname(pFile->pVfs, &zTFile);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index df1493b66..b84938b45 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -1100,6 +1100,11 @@ struct sqlite3_io_methods {
** pointed to by the pArg argument. This capability is used during testing
** and only needs to be supported when SQLITE_TEST is defined.
**
+** <li>[[SQLITE_FCNTL_NULL_IO]]
+** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
+** or file handle for the [sqlite3_file] object such that it will no longer
+** read or write to the database file.
+**
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1253,6 +1258,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
+#define SQLITE_FCNTL_NULL_IO 43
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE