Move the vfskv.c extension to src/os_kv.c and make it part of the amalgamation,
activated if and only if SQLITE_OS_KV is true. FossilOrigin-Name: f6632e69c2ec1a7ddc4e51f3567e3bc082ee94a6dd51fdafdc0c3bf386a32d4c
This commit is contained in:
parent
25f62508f5
commit
7585f49a0a
@ -184,7 +184,7 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
|
|||||||
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
|
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
|
||||||
memdb.lo memjournal.lo \
|
memdb.lo memjournal.lo \
|
||||||
mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
|
mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
|
||||||
notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
|
notify.lo opcodes.lo os.lo os_kv.lo os_unix.lo os_win.lo \
|
||||||
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
|
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
|
||||||
random.lo resolve.lo rowset.lo rtree.lo \
|
random.lo resolve.lo rowset.lo rtree.lo \
|
||||||
sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmt.lo \
|
sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmt.lo \
|
||||||
@ -257,6 +257,7 @@ SRC = \
|
|||||||
$(TOP)/src/os.h \
|
$(TOP)/src/os.h \
|
||||||
$(TOP)/src/os_common.h \
|
$(TOP)/src/os_common.h \
|
||||||
$(TOP)/src/os_setup.h \
|
$(TOP)/src/os_setup.h \
|
||||||
|
$(TOP)/src/os_kv.c \
|
||||||
$(TOP)/src/os_unix.c \
|
$(TOP)/src/os_unix.c \
|
||||||
$(TOP)/src/os_win.c \
|
$(TOP)/src/os_win.c \
|
||||||
$(TOP)/src/os_win.h \
|
$(TOP)/src/os_win.h \
|
||||||
@ -492,6 +493,7 @@ TESTSRC2 = \
|
|||||||
$(TOP)/src/main.c \
|
$(TOP)/src/main.c \
|
||||||
$(TOP)/src/mem5.c \
|
$(TOP)/src/mem5.c \
|
||||||
$(TOP)/src/os.c \
|
$(TOP)/src/os.c \
|
||||||
|
$(TOP)/src/os_kv.c \
|
||||||
$(TOP)/src/os_unix.c \
|
$(TOP)/src/os_unix.c \
|
||||||
$(TOP)/src/os_win.c \
|
$(TOP)/src/os_win.c \
|
||||||
$(TOP)/src/pager.c \
|
$(TOP)/src/pager.c \
|
||||||
@ -938,6 +940,9 @@ pcache1.lo: $(TOP)/src/pcache1.c $(HDR) $(TOP)/src/pcache.h
|
|||||||
os.lo: $(TOP)/src/os.c $(HDR)
|
os.lo: $(TOP)/src/os.c $(HDR)
|
||||||
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os.c
|
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os.c
|
||||||
|
|
||||||
|
os_kv.lo: $(TOP)/src/os_kv.c $(HDR)
|
||||||
|
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_kv.c
|
||||||
|
|
||||||
os_unix.lo: $(TOP)/src/os_unix.c $(HDR)
|
os_unix.lo: $(TOP)/src/os_unix.c $(HDR)
|
||||||
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_unix.c
|
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_unix.c
|
||||||
|
|
||||||
|
4
main.mk
4
main.mk
@ -68,7 +68,7 @@ LIBOBJ+= vdbe.o parse.o \
|
|||||||
main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
|
main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
|
||||||
memdb.o memjournal.o \
|
memdb.o memjournal.o \
|
||||||
mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
|
mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
|
||||||
notify.o opcodes.o os.o os_unix.o os_win.o \
|
notify.o opcodes.o os.o os_kv.o os_unix.o os_win.o \
|
||||||
pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
|
pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
|
||||||
random.o resolve.o rowset.o rtree.o \
|
random.o resolve.o rowset.o rtree.o \
|
||||||
select.o sqlite3rbu.o status.o stmt.o \
|
select.o sqlite3rbu.o status.o stmt.o \
|
||||||
@ -134,6 +134,7 @@ SRC = \
|
|||||||
$(TOP)/src/os.h \
|
$(TOP)/src/os.h \
|
||||||
$(TOP)/src/os_common.h \
|
$(TOP)/src/os_common.h \
|
||||||
$(TOP)/src/os_setup.h \
|
$(TOP)/src/os_setup.h \
|
||||||
|
$(TOP)/src/os_kv.c \
|
||||||
$(TOP)/src/os_unix.c \
|
$(TOP)/src/os_unix.c \
|
||||||
$(TOP)/src/os_win.c \
|
$(TOP)/src/os_win.c \
|
||||||
$(TOP)/src/os_win.h \
|
$(TOP)/src/os_win.h \
|
||||||
@ -411,6 +412,7 @@ TESTSRC2 = \
|
|||||||
$(TOP)/src/main.c \
|
$(TOP)/src/main.c \
|
||||||
$(TOP)/src/mem5.c \
|
$(TOP)/src/mem5.c \
|
||||||
$(TOP)/src/os.c \
|
$(TOP)/src/os.c \
|
||||||
|
$(TOP)/src/os_kv.c \
|
||||||
$(TOP)/src/os_unix.c \
|
$(TOP)/src/os_unix.c \
|
||||||
$(TOP)/src/os_win.c \
|
$(TOP)/src/os_win.c \
|
||||||
$(TOP)/src/pager.c \
|
$(TOP)/src/pager.c \
|
||||||
|
24
manifest
24
manifest
@ -1,9 +1,9 @@
|
|||||||
C Database\smust\sbe\snamed\seither\s"local"\sor\s"session".\s\sEach\shas\sa\sdistinct\nnamespace.
|
C Move\sthe\svfskv.c\sextension\sto\ssrc/os_kv.c\sand\smake\sit\spart\sof\sthe\samalgamation,\nactivated\sif\sand\sonly\sif\sSQLITE_OS_KV\sis\strue.
|
||||||
D 2022-09-09T16:16:33.749
|
D 2022-09-10T18:20:59.146
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
F Makefile.in 525bccb89e36a927f9312a231f054a2dc029f6af75901c7fc1a781d51b260323
|
F Makefile.in ee179f405fd5f8845473f888517c4ada46099306c33ae1f27dd1aef53fe8e867
|
||||||
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
|
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
|
||||||
F Makefile.msc d547a2fdba38a1c6cd1954977d0b0cc017f5f8fbfbc65287bf8d335808938016
|
F Makefile.msc d547a2fdba38a1c6cd1954977d0b0cc017f5f8fbfbc65287bf8d335808938016
|
||||||
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
|
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
|
||||||
@ -335,7 +335,6 @@ F ext/misc/uint.c 053fed3bce2e89583afcd4bf804d75d659879bbcedac74d0fa9ed548839a03
|
|||||||
F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9
|
F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9
|
||||||
F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917b9c751
|
F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917b9c751
|
||||||
F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
|
F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
|
||||||
F ext/misc/vfskv.c f154254c7585a0434d50d1b0fa0bb27b03ae4231a9045961e58a046dc5ea40ab
|
|
||||||
F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
|
F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
|
||||||
F ext/misc/vfsstat.c 474d08efc697b8eba300082cb1eb74a5f0f3df31ed257db1cb07e72ab0e53dfb
|
F ext/misc/vfsstat.c 474d08efc697b8eba300082cb1eb74a5f0f3df31ed257db1cb07e72ab0e53dfb
|
||||||
F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae
|
F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae
|
||||||
@ -510,7 +509,7 @@ F ext/wasm/testing2.js d37433c601f88ed275712c1cfc92d3fb36c7c22e1ed8c7396fb2359e4
|
|||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||||
F main.mk 20801eed419dc58936ff9449b04041edbbbc0488a9fc683e72471dded050e0bb
|
F main.mk b1b02927b2e0b73d025f93e388f2f7fba07614e972453983bddc65cd2bf33bb1
|
||||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||||
@ -553,7 +552,7 @@ F src/insert.c aea5361767817f917b0f0f647a1f0b1621bd858938ae6ae545c3b6b9814b798f
|
|||||||
F src/json.c 7749b98c62f691697c7ee536b570c744c0583cab4a89200fdd0fc2aa8cc8cbd6
|
F src/json.c 7749b98c62f691697c7ee536b570c744c0583cab4a89200fdd0fc2aa8cc8cbd6
|
||||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||||
F src/loadext.c 853385cc7a604157e137585097949252d5d0c731768e16b044608e5c95c3614b
|
F src/loadext.c 853385cc7a604157e137585097949252d5d0c731768e16b044608e5c95c3614b
|
||||||
F src/main.c 8983b4a316d7e09946dd731913aa41712f02e2b55cb5c6c92126ccfe2473244a
|
F src/main.c e11267cdd380be68d95d4292666636a7f1dff5f17a395f3d55be910d7e9350fb
|
||||||
F src/malloc.c b7a3430cbe91d3e8e04fc10c2041b3a19794e63556ad2441a13d8dadd9b2bafc
|
F src/malloc.c b7a3430cbe91d3e8e04fc10c2041b3a19794e63556ad2441a13d8dadd9b2bafc
|
||||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||||
@ -572,7 +571,8 @@ F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6
|
|||||||
F src/os.c 0eb831ba3575af5277e47f4edd14fdfc90025c67eb25ce5cda634518d308d4e9
|
F src/os.c 0eb831ba3575af5277e47f4edd14fdfc90025c67eb25ce5cda634518d308d4e9
|
||||||
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
|
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
|
||||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
F src/os_kv.c dc409476c3e533def81d022849726f2892e69e6529d4a40a637224cfb3f5df68 w ext/misc/vfskv.c
|
||||||
|
F src/os_setup.h 0711dbc4678f3ac52d7fe736951b6384a0615387c4ba5135a4764e4e31f4b6a6
|
||||||
F src/os_unix.c 102f7e5c5b59c18ea3dbc929dc3be8acb3afc0e0b6ad572e032335c9c27f44f1
|
F src/os_unix.c 102f7e5c5b59c18ea3dbc929dc3be8acb3afc0e0b6ad572e032335c9c27f44f1
|
||||||
F src/os_win.c e9454cb141908e8eef2102180bad353a36480612d5b736e4c2bd5777d9b25a34
|
F src/os_win.c e9454cb141908e8eef2102180bad353a36480612d5b736e4c2bd5777d9b25a34
|
||||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||||
@ -594,7 +594,7 @@ F src/shell.c.in e7e7c2c69ae86c5ee9e8ad66227203d46ff6dce8700a1b1dababff01c71d33d
|
|||||||
F src/sqlite.h.in b9b7fd73239d94db20332bb6e504688001e5564b655e1318a4427a1caef4b99e
|
F src/sqlite.h.in b9b7fd73239d94db20332bb6e504688001e5564b655e1318a4427a1caef4b99e
|
||||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||||
F src/sqlite3ext.h a988810c9b21c0dc36dc7a62735012339dc76fc7ab448fb0792721d30eacb69d
|
F src/sqlite3ext.h a988810c9b21c0dc36dc7a62735012339dc76fc7ab448fb0792721d30eacb69d
|
||||||
F src/sqliteInt.h 94e7fc2a5f0fa5d1f0af84513fd2d1c70a9f6e772556b9dfef16feee63291eae
|
F src/sqliteInt.h 44eb45c25d379361ee1bd7fc49205471c6cb8a3727aed42372cf4716f653ebf2
|
||||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||||
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
||||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||||
@ -1938,7 +1938,7 @@ F tool/mkshellc.tcl df5d249617f9cc94d5c48eb0401673eb3f31f383ecbc54e8a13ca3dd97e8
|
|||||||
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
|
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
|
||||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||||
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
|
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
|
||||||
F tool/mksqlite3c.tcl eee7e9d9c58abb1045f6ed74ad95ad26e8d22be29fdc431deea5267fb3fa049c
|
F tool/mksqlite3c.tcl 4fc26a9bfa0c4505b203d7ca0cf086e75ebcd4d63eb719c82f37e3fecdf23d37
|
||||||
F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf
|
F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf
|
||||||
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
||||||
F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5
|
F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5
|
||||||
@ -2001,8 +2001,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 74fbf6c2a97729e481d5562344e960d0c237aeb1f07240262d32a24fb1f4b5a3
|
P c8e41279294ea7c2f041c7d4cbbd85fce47d55f2f56180ca837316f7dfd75237
|
||||||
R ef722c3c17f5bd16a7c59b26dec45e05
|
R 781601077fda92ceda7382ba24a16664
|
||||||
U drh
|
U drh
|
||||||
Z c4e335313d89d964aa7abb0331378ddc
|
Z b2ad663d300b47ac24999ede7b88d1e7
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@ -1 +1 @@
|
|||||||
c8e41279294ea7c2f041c7d4cbbd85fce47d55f2f56180ca837316f7dfd75237
|
f6632e69c2ec1a7ddc4e51f3567e3bc082ee94a6dd51fdafdc0c3bf386a32d4c
|
@ -4781,8 +4781,8 @@ int sqlite3_snapshot_open(
|
|||||||
*/
|
*/
|
||||||
int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb){
|
int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb){
|
||||||
int rc = SQLITE_ERROR;
|
int rc = SQLITE_ERROR;
|
||||||
int iDb;
|
|
||||||
#ifndef SQLITE_OMIT_WAL
|
#ifndef SQLITE_OMIT_WAL
|
||||||
|
int iDb;
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||||
if( !sqlite3SafetyCheckOk(db) ){
|
if( !sqlite3SafetyCheckOk(db) ){
|
||||||
|
@ -14,45 +14,28 @@
|
|||||||
** Key/Value storage engine where both keys and values must be pure
|
** Key/Value storage engine where both keys and values must be pure
|
||||||
** text.
|
** text.
|
||||||
*/
|
*/
|
||||||
#include <sqlite3ext.h>
|
#include <sqliteInt.h>
|
||||||
SQLITE_EXTENSION_INIT1
|
#if SQLITE_OS_KV
|
||||||
#include <string.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** Debugging logic
|
** Debugging logic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* KVVFS_TRACE() is used for tracing calls to kvstorage routines. */
|
/* SQLITE_KV_TRACE() is used for tracing calls to kvstorage routines. */
|
||||||
#if 0
|
#if 0
|
||||||
#define KVVFS_TRACE(X) printf X;
|
#define SQLITE_KV_TRACE(X) printf X;
|
||||||
#else
|
#else
|
||||||
#define KVVFS_TRACE(X)
|
#define SQLITE_KV_TRACE(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* KVVFS_LOG() is used for tracing calls to the VFS interface */
|
/* SQLITE_KV_LOG() is used for tracing calls to the VFS interface */
|
||||||
#if 0
|
#if 0
|
||||||
#define KVVFS_LOG(X) printf X;
|
#define SQLITE_KV_LOG(X) printf X;
|
||||||
#else
|
#else
|
||||||
#define KVVFS_LOG(X)
|
#define SQLITE_KV_LOG(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
** The low-level storage engine
|
|
||||||
*/
|
|
||||||
#define KVSTORAGE_KEY_SZ 24
|
|
||||||
static int kvstorageWrite(const char*, const char *zKey, const char *zData);
|
|
||||||
static int kvstorageDelete(const char*, const char *zKey);
|
|
||||||
static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Forward declaration of objects used by this VFS implementation
|
** Forward declaration of objects used by this VFS implementation
|
||||||
*/
|
*/
|
||||||
@ -176,6 +159,17 @@ static sqlite3_io_methods kvvfs_jrnl_io_methods = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****** Storage subsystem **************************************************/
|
/****** Storage subsystem **************************************************/
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/* Forward declarations for the low-level storage engine
|
||||||
|
*/
|
||||||
|
#define KVSTORAGE_KEY_SZ 24
|
||||||
|
#define KVSTORAGE_KEY_PREFIX "kvvfs-"
|
||||||
|
static int kvstorageWrite(const char*, const char *zKey, const char *zData);
|
||||||
|
static int kvstorageDelete(const char*, const char *zKey);
|
||||||
|
static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf);
|
||||||
|
|
||||||
|
|
||||||
/* Expand the key name with an appropriate prefix and put the result
|
/* Expand the key name with an appropriate prefix and put the result
|
||||||
@ -204,7 +198,7 @@ static int kvstorageWrite(
|
|||||||
kvstorageMakeKey(zClass, zKey, zXKey);
|
kvstorageMakeKey(zClass, zKey, zXKey);
|
||||||
fd = fopen(zXKey, "wb");
|
fd = fopen(zXKey, "wb");
|
||||||
if( fd ){
|
if( fd ){
|
||||||
KVVFS_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
|
SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
|
||||||
(int)strlen(zData), zData,
|
(int)strlen(zData), zData,
|
||||||
strlen(zData)>50 ? "..." : ""));
|
strlen(zData)>50 ? "..." : ""));
|
||||||
fputs(zData, fd);
|
fputs(zData, fd);
|
||||||
@ -221,7 +215,7 @@ static int kvstorageDelete(const char *zClass, const char *zKey){
|
|||||||
char zXKey[KVSTORAGE_KEY_SZ];
|
char zXKey[KVSTORAGE_KEY_SZ];
|
||||||
kvstorageMakeKey(zClass, zKey, zXKey);
|
kvstorageMakeKey(zClass, zKey, zXKey);
|
||||||
unlink(zXKey);
|
unlink(zXKey);
|
||||||
KVVFS_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
|
SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,14 +245,14 @@ static int kvstorageRead(
|
|||||||
|| stat(zXKey, &buf)!=0
|
|| stat(zXKey, &buf)!=0
|
||||||
|| !S_ISREG(buf.st_mode)
|
|| !S_ISREG(buf.st_mode)
|
||||||
){
|
){
|
||||||
KVVFS_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
|
SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if( nBuf<0 ){
|
if( nBuf<0 ){
|
||||||
return (int)buf.st_size;
|
return (int)buf.st_size;
|
||||||
}else if( nBuf==1 ){
|
}else if( nBuf==1 ){
|
||||||
zBuf[0] = 0;
|
zBuf[0] = 0;
|
||||||
KVVFS_TRACE(("KVVFS-READ %-15s (%d)\n", zXKey,
|
SQLITE_KV_TRACE(("KVVFS-READ %-15s (%d)\n", zXKey,
|
||||||
(int)buf.st_size));
|
(int)buf.st_size));
|
||||||
return (int)buf.st_size;
|
return (int)buf.st_size;
|
||||||
}
|
}
|
||||||
@ -267,13 +261,13 @@ static int kvstorageRead(
|
|||||||
}
|
}
|
||||||
fd = fopen(zXKey, "rb");
|
fd = fopen(zXKey, "rb");
|
||||||
if( fd==0 ){
|
if( fd==0 ){
|
||||||
KVVFS_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
|
SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
|
||||||
return -1;
|
return -1;
|
||||||
}else{
|
}else{
|
||||||
sqlite3_int64 n = fread(zBuf, 1, nBuf-1, fd);
|
sqlite3_int64 n = fread(zBuf, 1, nBuf-1, fd);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
zBuf[n] = 0;
|
zBuf[n] = 0;
|
||||||
KVVFS_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
|
SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
|
||||||
n, zBuf, n>50 ? "..." : ""));
|
n, zBuf, n>50 ? "..." : ""));
|
||||||
return (int)n;
|
return (int)n;
|
||||||
}
|
}
|
||||||
@ -433,7 +427,7 @@ static void kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){
|
|||||||
static int kvvfsClose(sqlite3_file *pProtoFile){
|
static int kvvfsClose(sqlite3_file *pProtoFile){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
|
|
||||||
KVVFS_LOG(("xClose %s %s\n", pFile->zClass,
|
SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass,
|
||||||
pFile->isJournal ? "journal" : "db"));
|
pFile->isJournal ? "journal" : "db"));
|
||||||
sqlite3_free(pFile->aJrnl);
|
sqlite3_free(pFile->aJrnl);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
@ -450,7 +444,7 @@ static int kvvfsReadJrnl(
|
|||||||
){
|
){
|
||||||
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
||||||
assert( pFile->isJournal );
|
assert( pFile->isJournal );
|
||||||
KVVFS_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
||||||
if( pFile->aJrnl==0 ){
|
if( pFile->aJrnl==0 ){
|
||||||
int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, -1);
|
int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, -1);
|
||||||
char *aTxt;
|
char *aTxt;
|
||||||
@ -487,7 +481,7 @@ static int kvvfsReadDb(
|
|||||||
char aData[131073];
|
char aData[131073];
|
||||||
assert( iOfst>=0 );
|
assert( iOfst>=0 );
|
||||||
assert( iAmt>=0 );
|
assert( iAmt>=0 );
|
||||||
KVVFS_LOG(("xRead('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
SQLITE_KV_LOG(("xRead('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
||||||
if( iOfst+iAmt>=512 ){
|
if( iOfst+iAmt>=512 ){
|
||||||
if( (iOfst % iAmt)!=0 ){
|
if( (iOfst % iAmt)!=0 ){
|
||||||
return SQLITE_IOERR_READ;
|
return SQLITE_IOERR_READ;
|
||||||
@ -537,7 +531,7 @@ static int kvvfsWriteJrnl(
|
|||||||
){
|
){
|
||||||
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
||||||
sqlite3_int64 iEnd = iOfst+iAmt;
|
sqlite3_int64 iEnd = iOfst+iAmt;
|
||||||
KVVFS_LOG(("xWrite('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
SQLITE_KV_LOG(("xWrite('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
||||||
if( iEnd>=0x10000000 ) return SQLITE_FULL;
|
if( iEnd>=0x10000000 ) return SQLITE_FULL;
|
||||||
if( pFile->aJrnl==0 || pFile->nJrnl<iEnd ){
|
if( pFile->aJrnl==0 || pFile->nJrnl<iEnd ){
|
||||||
char *aNew = sqlite3_realloc(pFile->aJrnl, iEnd);
|
char *aNew = sqlite3_realloc(pFile->aJrnl, iEnd);
|
||||||
@ -567,7 +561,7 @@ static int kvvfsWriteDb(
|
|||||||
unsigned int pgno;
|
unsigned int pgno;
|
||||||
char zKey[30];
|
char zKey[30];
|
||||||
char aData[131073];
|
char aData[131073];
|
||||||
KVVFS_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
|
||||||
assert( iAmt>=512 && iAmt<=65536 );
|
assert( iAmt>=512 && iAmt<=65536 );
|
||||||
assert( (iAmt & (iAmt-1))==0 );
|
assert( (iAmt & (iAmt-1))==0 );
|
||||||
pgno = 1 + iOfst/iAmt;
|
pgno = 1 + iOfst/iAmt;
|
||||||
@ -585,7 +579,7 @@ static int kvvfsWriteDb(
|
|||||||
*/
|
*/
|
||||||
static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
|
static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
KVVFS_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
|
SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
|
||||||
assert( size==0 );
|
assert( size==0 );
|
||||||
kvstorageDelete(pFile->zClass, "jrnl");
|
kvstorageDelete(pFile->zClass, "jrnl");
|
||||||
sqlite3_free(pFile->aJrnl);
|
sqlite3_free(pFile->aJrnl);
|
||||||
@ -601,7 +595,7 @@ static int kvvfsTruncateDb(sqlite3_file *pProtoFile, sqlite_int64 size){
|
|||||||
){
|
){
|
||||||
char zKey[50];
|
char zKey[50];
|
||||||
unsigned int pgno, pgnoMax;
|
unsigned int pgno, pgnoMax;
|
||||||
KVVFS_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
|
SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
|
||||||
pgno = 1 + size/pFile->szPage;
|
pgno = 1 + size/pFile->szPage;
|
||||||
pgnoMax = 2 + pFile->szDb/pFile->szPage;
|
pgnoMax = 2 + pFile->szDb/pFile->szPage;
|
||||||
while( pgno<=pgnoMax ){
|
while( pgno<=pgnoMax ){
|
||||||
@ -623,7 +617,7 @@ static int kvvfsSyncJrnl(sqlite3_file *pProtoFile, int flags){
|
|||||||
int i, n;
|
int i, n;
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
char *zOut;
|
char *zOut;
|
||||||
KVVFS_LOG(("xSync('%s-journal')\n", pFile->zClass));
|
SQLITE_KV_LOG(("xSync('%s-journal')\n", pFile->zClass));
|
||||||
if( pFile->nJrnl<=0 ){
|
if( pFile->nJrnl<=0 ){
|
||||||
return kvvfsTruncateJrnl(pProtoFile, 0);
|
return kvvfsTruncateJrnl(pProtoFile, 0);
|
||||||
}
|
}
|
||||||
@ -645,7 +639,7 @@ static int kvvfsSyncJrnl(sqlite3_file *pProtoFile, int flags){
|
|||||||
}
|
}
|
||||||
static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
|
static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
KVVFS_LOG(("xSync('%s-db')\n", pFile->zClass));
|
SQLITE_KV_LOG(("xSync('%s-db')\n", pFile->zClass));
|
||||||
if( pFile->szDb>0 ){
|
if( pFile->szDb>0 ){
|
||||||
kvvfsWriteFileSize(pFile, pFile->szDb);
|
kvvfsWriteFileSize(pFile, pFile->szDb);
|
||||||
}
|
}
|
||||||
@ -657,13 +651,13 @@ static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
|
|||||||
*/
|
*/
|
||||||
static int kvvfsFileSizeJrnl(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
|
static int kvvfsFileSizeJrnl(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
KVVFS_LOG(("xFileSize('%s-journal')\n", pFile->zClass));
|
SQLITE_KV_LOG(("xFileSize('%s-journal')\n", pFile->zClass));
|
||||||
*pSize = pFile->nJrnl;
|
*pSize = pFile->nJrnl;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
static int kvvfsFileSizeDb(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
|
static int kvvfsFileSizeDb(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
KVVFS_LOG(("xFileSize('%s-db')\n", pFile->zClass));
|
SQLITE_KV_LOG(("xFileSize('%s-db')\n", pFile->zClass));
|
||||||
if( pFile->szDb>=0 ){
|
if( pFile->szDb>=0 ){
|
||||||
*pSize = pFile->szDb;
|
*pSize = pFile->szDb;
|
||||||
}else{
|
}else{
|
||||||
@ -678,7 +672,7 @@ static int kvvfsFileSizeDb(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
|
|||||||
static int kvvfsLock(sqlite3_file *pProtoFile, int eLock){
|
static int kvvfsLock(sqlite3_file *pProtoFile, int eLock){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
assert( !pFile->isJournal );
|
assert( !pFile->isJournal );
|
||||||
KVVFS_LOG(("xLock(%s,%d)\n", pFile->zClass, eLock));
|
SQLITE_KV_LOG(("xLock(%s,%d)\n", pFile->zClass, eLock));
|
||||||
|
|
||||||
if( eLock!=SQLITE_LOCK_NONE ){
|
if( eLock!=SQLITE_LOCK_NONE ){
|
||||||
pFile->szDb = kvvfsReadFileSize(pFile);
|
pFile->szDb = kvvfsReadFileSize(pFile);
|
||||||
@ -692,7 +686,7 @@ static int kvvfsLock(sqlite3_file *pProtoFile, int eLock){
|
|||||||
static int kvvfsUnlock(sqlite3_file *pProtoFile, int eLock){
|
static int kvvfsUnlock(sqlite3_file *pProtoFile, int eLock){
|
||||||
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
|
||||||
assert( !pFile->isJournal );
|
assert( !pFile->isJournal );
|
||||||
KVVFS_LOG(("xUnlock(%s,%d)\n", pFile->zClass, eLock));
|
SQLITE_KV_LOG(("xUnlock(%s,%d)\n", pFile->zClass, eLock));
|
||||||
if( eLock==SQLITE_LOCK_NONE ){
|
if( eLock==SQLITE_LOCK_NONE ){
|
||||||
pFile->szDb = -1;
|
pFile->szDb = -1;
|
||||||
}
|
}
|
||||||
@ -703,7 +697,7 @@ static int kvvfsUnlock(sqlite3_file *pProtoFile, int eLock){
|
|||||||
** Check if another file-handle holds a RESERVED lock on an kvvfs-file.
|
** Check if another file-handle holds a RESERVED lock on an kvvfs-file.
|
||||||
*/
|
*/
|
||||||
static int kvvfsCheckReservedLock(sqlite3_file *pProtoFile, int *pResOut){
|
static int kvvfsCheckReservedLock(sqlite3_file *pProtoFile, int *pResOut){
|
||||||
KVVFS_LOG(("xCheckReservedLock\n"));
|
SQLITE_KV_LOG(("xCheckReservedLock\n"));
|
||||||
*pResOut = 0;
|
*pResOut = 0;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@ -742,7 +736,7 @@ static int kvvfsOpen(
|
|||||||
int *pOutFlags
|
int *pOutFlags
|
||||||
){
|
){
|
||||||
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
|
||||||
KVVFS_LOG(("xOpen(\"%s\")\n", zName));
|
SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName));
|
||||||
if( strcmp(zName, "local")==0
|
if( strcmp(zName, "local")==0
|
||||||
|| strcmp(zName, "session")==0
|
|| strcmp(zName, "session")==0
|
||||||
){
|
){
|
||||||
@ -757,7 +751,11 @@ static int kvvfsOpen(
|
|||||||
}else{
|
}else{
|
||||||
return SQLITE_CANTOPEN;
|
return SQLITE_CANTOPEN;
|
||||||
}
|
}
|
||||||
pFile->zClass = zName[0]=='s' ? "kvvfs-ses" : "kvvfs-loc";
|
if( zName[0]=='s' ){
|
||||||
|
pFile->zClass = KVSTORAGE_KEY_PREFIX "ses";
|
||||||
|
}else{
|
||||||
|
pFile->zClass = KVSTORAGE_KEY_PREFIX "loc";
|
||||||
|
}
|
||||||
pFile->aJrnl = 0;
|
pFile->aJrnl = 0;
|
||||||
pFile->nJrnl = 0;
|
pFile->nJrnl = 0;
|
||||||
pFile->szPage = -1;
|
pFile->szPage = -1;
|
||||||
@ -772,10 +770,10 @@ static int kvvfsOpen(
|
|||||||
*/
|
*/
|
||||||
static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
|
static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
|
||||||
if( strcmp(zPath, "local-journal")==0 ){
|
if( strcmp(zPath, "local-journal")==0 ){
|
||||||
kvstorageDelete("kvvfs-loc", "jrnl");
|
kvstorageDelete(KVSTORAGE_KEY_PREFIX "loc", "jrnl");
|
||||||
}else
|
}else
|
||||||
if( strcmp(zPath, "session-journal")==0 ){
|
if( strcmp(zPath, "session-journal")==0 ){
|
||||||
kvstorageDelete("kvvfs-ses", "jrnl");
|
kvstorageDelete(KVSTORAGE_KEY_PREFIX "ses", "jrnl");
|
||||||
}
|
}
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@ -790,23 +788,23 @@ static int kvvfsAccess(
|
|||||||
int flags,
|
int flags,
|
||||||
int *pResOut
|
int *pResOut
|
||||||
){
|
){
|
||||||
KVVFS_LOG(("xAccess(\"%s\")\n", zPath));
|
SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath));
|
||||||
if( strcmp(zPath, "local-journal")==0 ){
|
if( strcmp(zPath, "local-journal")==0 ){
|
||||||
*pResOut = kvstorageRead("kvvfs-loc", "jrnl", 0, -1)>0;
|
*pResOut = kvstorageRead(KVSTORAGE_KEY_PREFIX "loc", "jrnl", 0, -1)>0;
|
||||||
}else
|
}else
|
||||||
if( strcmp(zPath, "session-journal")==0 ){
|
if( strcmp(zPath, "session-journal")==0 ){
|
||||||
*pResOut = kvstorageRead("kvvfs-ses", "jrnl", 0, -1)>0;
|
*pResOut = kvstorageRead(KVSTORAGE_KEY_PREFIX "ses", "jrnl", 0, -1)>0;
|
||||||
}else
|
}else
|
||||||
if( strcmp(zPath, "local")==0 ){
|
if( strcmp(zPath, "local")==0 ){
|
||||||
*pResOut = kvstorageRead("kvvfs-loc", "sz", 0, -1)>0;
|
*pResOut = kvstorageRead(KVSTORAGE_KEY_PREFIX "loc", "sz", 0, -1)>0;
|
||||||
}else
|
}else
|
||||||
if( strcmp(zPath, "session")==0 ){
|
if( strcmp(zPath, "session")==0 ){
|
||||||
*pResOut = kvstorageRead("kvvfs-ses", "sz", 0, -1)>0;
|
*pResOut = kvstorageRead(KVSTORAGE_KEY_PREFIX "ses", "sz", 0, -1)>0;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
*pResOut = 0;
|
*pResOut = 0;
|
||||||
}
|
}
|
||||||
KVVFS_LOG(("xAccess returns %d\n",*pResOut));
|
SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,7 +820,7 @@ static int kvvfsFullPathname(
|
|||||||
char *zOut
|
char *zOut
|
||||||
){
|
){
|
||||||
size_t nPath = strlen(zPath);
|
size_t nPath = strlen(zPath);
|
||||||
KVVFS_LOG(("xFullPathname(\"%s\")\n", zPath));
|
SQLITE_KV_LOG(("xFullPathname(\"%s\")\n", zPath));
|
||||||
if( nOut<nPath+1 ) nPath = nOut - 1;
|
if( nOut<nPath+1 ) nPath = nOut - 1;
|
||||||
memcpy(zOut, zPath, nPath);
|
memcpy(zOut, zPath, nPath);
|
||||||
zOut[nPath] = 0;
|
zOut[nPath] = 0;
|
||||||
@ -865,21 +863,13 @@ static int kvvfsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
|
|||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
** This routine is called when the extension is loaded.
|
** This routine is called initialize the KV-vfs as the default VFS.
|
||||||
**
|
|
||||||
** Register the new VFS. Make arrangement to register the virtual table
|
|
||||||
** for each new database connection.
|
|
||||||
*/
|
*/
|
||||||
int sqlite3_vfskv_init(
|
int sqlite3_os_init(void){
|
||||||
sqlite3 *db,
|
return sqlite3_vfs_register(&kvvfs_vfs, 1);
|
||||||
char **pzErrMsg,
|
|
||||||
const sqlite3_api_routines *pApi
|
|
||||||
){
|
|
||||||
SQLITE_EXTENSION_INIT2(pApi);
|
|
||||||
sqlite3_vfs_register(&kvvfs_vfs, 1);
|
|
||||||
return SQLITE_OK_LOAD_PERMANENTLY;
|
|
||||||
}
|
}
|
||||||
|
int sqlite3_os_end(void){
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
#endif /* SQLITE_OS_KV */
|
@ -20,23 +20,23 @@
|
|||||||
** Figure out if we are dealing with Unix, Windows, or some other operating
|
** Figure out if we are dealing with Unix, Windows, or some other operating
|
||||||
** system.
|
** system.
|
||||||
**
|
**
|
||||||
** After the following block of preprocess macros, all of SQLITE_OS_UNIX,
|
** After the following block of preprocess macros, all of
|
||||||
** SQLITE_OS_WIN, and SQLITE_OS_OTHER will defined to either 1 or 0. One of
|
**
|
||||||
** the three will be 1. The other two will be 0.
|
** SQLITE_OS_KV
|
||||||
|
** SQLITE_OS_OTHER
|
||||||
|
** SQLITE_OS_UNIX
|
||||||
|
** SQLITE_OS_WIN
|
||||||
|
**
|
||||||
|
** will defined to either 1 or 0. One of them will be 1. The others will be 0.
|
||||||
|
** If none of the macros are initially defined, then select either
|
||||||
|
** SQLITE_OS_UNIX or SQLITE_OS_WIN depending on the target platform.
|
||||||
|
**
|
||||||
|
** If SQLITE_OS_OTHER=1 is specified at compile-time, then the application
|
||||||
|
** must provide its own VFS implementation together with sqlite3_os_init()
|
||||||
|
** and sqlite3_os_end() routines.
|
||||||
*/
|
*/
|
||||||
#if defined(SQLITE_OS_OTHER)
|
#if !defined(SQLITE_OS_KV) && !defined(SQLITE_OS_OTHER) && \
|
||||||
# if SQLITE_OS_OTHER==1
|
!defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_WIN)
|
||||||
# undef SQLITE_OS_UNIX
|
|
||||||
# define SQLITE_OS_UNIX 0
|
|
||||||
# undef SQLITE_OS_WIN
|
|
||||||
# define SQLITE_OS_WIN 0
|
|
||||||
# else
|
|
||||||
# undef SQLITE_OS_OTHER
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
|
|
||||||
# define SQLITE_OS_OTHER 0
|
|
||||||
# ifndef SQLITE_OS_WIN
|
|
||||||
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
|
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
|
||||||
defined(__MINGW32__) || defined(__BORLANDC__)
|
defined(__MINGW32__) || defined(__BORLANDC__)
|
||||||
# define SQLITE_OS_WIN 1
|
# define SQLITE_OS_WIN 1
|
||||||
@ -45,13 +45,47 @@
|
|||||||
# define SQLITE_OS_WIN 0
|
# define SQLITE_OS_WIN 0
|
||||||
# define SQLITE_OS_UNIX 1
|
# define SQLITE_OS_UNIX 1
|
||||||
# endif
|
# endif
|
||||||
# else
|
|
||||||
# define SQLITE_OS_UNIX 0
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#if SQLITE_OS_OTHER+1>1
|
||||||
# ifndef SQLITE_OS_WIN
|
# undef SQLITE_OS_KV
|
||||||
|
# define SQLITE_OS_KV 0
|
||||||
|
# undef SQLITE_OS_UNIX
|
||||||
|
# define SQLITE_OS_UNIX 0
|
||||||
|
# undef SQLITE_OS_WIN
|
||||||
# define SQLITE_OS_WIN 0
|
# define SQLITE_OS_WIN 0
|
||||||
#endif
|
#endif
|
||||||
|
#if SQLITE_OS_KV+1>1
|
||||||
|
# undef SQLITE_OS_OTHER
|
||||||
|
# define SQLITE_OS_OTHER 0
|
||||||
|
# undef SQLITE_OS_UNIX
|
||||||
|
# define SQLITE_OS_UNIX 0
|
||||||
|
# undef SQLITE_OS_WIN
|
||||||
|
# define SQLITE_OS_WIN 0
|
||||||
|
# define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||||
|
# define SQLITE_OMIT_WAL 1
|
||||||
|
# define SQLITE_OMIT DEPRECATED 1
|
||||||
|
# undef SQLITE_TEMP_STORE
|
||||||
|
# define SQLITE_TEMP_STORE 3 /* Always use memory for temporary storage */
|
||||||
|
# define SQLITE_DQS 0
|
||||||
|
# define SQLITE_OMIT_SHARED_CACHE 1
|
||||||
|
# define SQLITE_OMIT_AUTOINIT 1
|
||||||
|
#endif
|
||||||
|
#if SQLITE_OS_UNIX+1>1
|
||||||
|
# undef SQLITE_OS_KV
|
||||||
|
# define SQLITE_OS_KV 0
|
||||||
|
# undef SQLITE_OS_OTHER
|
||||||
|
# define SQLITE_OS_OTHER 0
|
||||||
|
# undef SQLITE_OS_WIN
|
||||||
|
# define SQLITE_OS_WIN 0
|
||||||
|
#endif
|
||||||
|
#if SQLITE_OS_WIN+1>1
|
||||||
|
# undef SQLITE_OS_KV
|
||||||
|
# define SQLITE_OS_KV 0
|
||||||
|
# undef SQLITE_OS_OTHER
|
||||||
|
# define SQLITE_OS_OTHER 0
|
||||||
|
# undef SQLITE_OS_UNIX
|
||||||
|
# define SQLITE_OS_UNIX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* SQLITE_OS_SETUP_H */
|
#endif /* SQLITE_OS_SETUP_H */
|
||||||
|
@ -1268,11 +1268,11 @@ typedef int VList;
|
|||||||
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
|
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
|
||||||
** pointer types (i.e. FuncDef) defined above.
|
** pointer types (i.e. FuncDef) defined above.
|
||||||
*/
|
*/
|
||||||
|
#include "os.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
#include "btree.h"
|
#include "btree.h"
|
||||||
#include "vdbe.h"
|
#include "vdbe.h"
|
||||||
#include "pcache.h"
|
#include "pcache.h"
|
||||||
#include "os.h"
|
|
||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
|
||||||
/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
|
/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
|
||||||
|
@ -355,6 +355,7 @@ foreach file {
|
|||||||
hash.c
|
hash.c
|
||||||
opcodes.c
|
opcodes.c
|
||||||
|
|
||||||
|
os_kv.c
|
||||||
os_unix.c
|
os_unix.c
|
||||||
os_win.c
|
os_win.c
|
||||||
memdb.c
|
memdb.c
|
||||||
|
Loading…
Reference in New Issue
Block a user