From: drh Date: Fri, 19 Nov 2010 14:37:49 +0000 (+0000) Subject: Add the SQLITE_FCNTL_FILE_POINTER verb to sqlite3_file_control(). X-Git-Tag: version-3.7.4~45^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3eb08114570d722737be9a5b76b40e2b88828b34;p=thirdparty%2Fsqlite.git Add the SQLITE_FCNTL_FILE_POINTER verb to sqlite3_file_control(). FossilOrigin-Name: 4425b0645d0afebe3172201012d501c6992daa38 --- diff --git a/manifest b/manifest index 0898bf1ca5..7192b6525d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Ensure\stcl\sis\susing\sutf-8\sas\sthe\ssystem\sencoding\swhen\srunning\scapi3e.test. -D 2010-11-18T16:58:49 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Add\sthe\sSQLITE_FCNTL_FILE_POINTER\sverb\sto\ssqlite3_file_control(). +D 2010-11-19T14:37:49 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -141,7 +144,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e F src/loadext.c 8af9fcc75708d60b88636ccba38b4a7b3c155c3e -F src/main.c 335d2c7ecb093db7b662d9325fe68fb9087a4814 +F src/main.c 721e5530b14b91a1fb6aead279af8b8729fa9a20 F src/malloc.c 3d7284cd9346ab6e3945535761e68c23c6cf40ef F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206 @@ -176,7 +179,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c 550d67688f5e8bc8022faf6d014838afba1415af F src/shell.c 8517fc1f9c59ae4007e6cc8b9af91ab231ea2056 -F src/sqlite.h.in 74768e9a569d65a62c99f3d383b37904b4ed7f66 +F src/sqlite.h.in 41ce8844965b659f7a08d425dd9b5730f6d558c3 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqliteInt.h dd28f6138c74cf4833e032a989b6ff7885798cf6 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44 @@ -887,7 +890,18 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P c36f275d70ec8f6dead6adac02885026fdff9666 -R 94e5b29a1e7d3e1ce1116e4aa76418d2 -U dan -Z 48483be6d4c72d388a7a44154f6792c7 +P 0a95589f2166f9ce420e647b73e8c797fe8f4833 +R 3b23e03ba29934a15d55ffe87a7aea6b +T *bgcolor * #90a0f0 +T *branch * superlock +T *sym-superlock * +T -sym-trunk * +U drh +Z db6b185bc4809187648ac59523a661c3 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFM5ovBoxKgR168RlERAhiCAKCL2cgcTOqyxxXfn0ztSMKBMJE8QgCgjFOV +3YKpNtVtoR78SnCwnp0cH5E= +=hUYw +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 328c38d9f3..7bfd9d693b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0a95589f2166f9ce420e647b73e8c797fe8f4833 \ No newline at end of file +4425b0645d0afebe3172201012d501c6992daa38 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 25216070d6..f9e1a1c138 100644 --- a/src/main.c +++ b/src/main.c @@ -2356,7 +2356,10 @@ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){ assert( pPager!=0 ); fd = sqlite3PagerFile(pPager); assert( fd!=0 ); - if( fd->pMethods ){ + if( op==SQLITE_FCNTL_FILE_POINTER ){ + *(sqlite3_file**)pArg = fd; + rc = SQLITE_OK; + }else if( fd->pMethods ){ rc = sqlite3OsFileControl(fd, op, pArg); } sqlite3BtreeLeave(pBtree); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 1138cb2a59..95c3812749 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -705,6 +705,8 @@ struct sqlite3_io_methods { #define SQLITE_LAST_ERRNO 4 #define SQLITE_FCNTL_SIZE_HINT 5 #define SQLITE_FCNTL_CHUNK_SIZE 6 +#define SQLITE_FCNTL_FILE_POINTER 7 + /* ** CAPI3REF: Mutex Handle @@ -5234,7 +5236,7 @@ sqlite3_mutex *sqlite3_db_mutex(sqlite3*); ** ^The [sqlite3_file_control()] interface makes a direct call to the ** xFileControl method for the [sqlite3_io_methods] object associated ** with a particular database identified by the second argument. ^The -** name of the database "main" for the main database or "temp" for the +** name of the database is "main" for the main database or "temp" for the ** TEMP database, or the name that appears after the AS keyword for ** databases that are added using the [ATTACH] SQL command. ** ^A NULL pointer can be used in place of "main" to refer to the @@ -5244,6 +5246,12 @@ sqlite3_mutex *sqlite3_db_mutex(sqlite3*); ** the xFileControl method. ^The return value of the xFileControl ** method becomes the return value of this routine. ** +** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes +** a pointer to the underlying [sqlite3_file] object to be written into +** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER +** case is a short-circuit path which does not actually invoke the +** underlying sqlite3_io_methods.xFileControl method. +** ** ^If the second parameter (zDbName) does not match the name of any ** open database file, then SQLITE_ERROR is returned. ^This error ** code is not remembered and will not be recalled by [sqlite3_errcode()]