From 3c013479c3884f5f996bc914a7fd32df84b867d8 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 6 Feb 2025 13:18:49 +0000 Subject: [PATCH 01/72] Fix a dependencies/order-of-operations bug in ext/wasm/GNUmakefile which causes creation of files filtered via c-pp to fail if the ext/wasm/jswasm dir did not exist beforehand. FossilOrigin-Name: 4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388 --- ext/wasm/GNUmakefile | 1 + manifest | 17 +++++++---------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 3e9621c6d2..dc8ea54fd4 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -425,6 +425,7 @@ define SQLITE.CALL.C-PP.FILTER # $2 = Output file: c-pp -o $(2).js # $3 = optional c-pp -D... flags $(2): $(1) $$(MAKEFILE) $$(bin.c-pp) + mkdir -p $$(dir $$@) $$(bin.c-pp) -f $(1) -o $$@ $(3) $(SQLITE.CALL.C-PP.FILTER.global) #CLEAN_FILES += $(2) endef diff --git a/manifest b/manifest index d38d362fbb..334058434b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.49.0 -D 2025-02-06T11:55:18.769 +C Fix\sa\sdependencies/order-of-operations\sbug\sin\sext/wasm/GNUmakefile\swhich\scauses\screation\sof\sfiles\sfiltered\svia\sc-pp\sto\sfail\sif\sthe\sext/wasm/jswasm\sdir\sdid\snot\sexist\sbeforehand. +D 2025-02-06T13:18:49.829 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 47f121d057c08ba49443c06c1c51ba2572e3d5d28a06c968cf0b2ccd5878c3d3 +F ext/wasm/GNUmakefile 7d1076680e687d01e0f4f343624db4e00e31edbe67bd0cb2e3ad8ecea98a3cae F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -2209,11 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9f28f6694f97d5ee0345b45f9bf81e3fdce0990ce32fb9bdbbaac079126a67c9 -R 84a73aa92675a2727074c491235ee053 -T +sym-major-release * -T +sym-release * -T +sym-version-3.49.0 * -U drh -Z 345e0ae7aa6443f7f8d274ba6f526736 +P 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde +R ace1a556cd2682c15f244d0a70c9d1c1 +U stephan +Z e2303326f9884746fc80a4c5bceed35d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 71c984af80..ee3aa0d336 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde +4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388 From 01bfe2a53114761f0afa301e5d17d00d99e789c4 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 6 Feb 2025 13:36:31 +0000 Subject: [PATCH 02/72] Bump version number to 3.50.0 for the next dev cycle. FossilOrigin-Name: 46d08071f3f9fef78bc2444b52060e0e7de8c357a2aa213ac13c565e33acc4a0 --- VERSION | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index 549b777ead..ca25ff637a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.49.0 +3.50.0 diff --git a/manifest b/manifest index 334058434b..1f8d299de4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sdependencies/order-of-operations\sbug\sin\sext/wasm/GNUmakefile\swhich\scauses\screation\sof\sfiles\sfiltered\svia\sc-pp\sto\sfail\sif\sthe\sext/wasm/jswasm\sdir\sdid\snot\sexist\sbeforehand. -D 2025-02-06T13:18:49.829 +C Bump\sversion\snumber\sto\s3.50.0\sfor\sthe\snext\sdev\scycle. +D 2025-02-06T13:36:31.028 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -7,7 +7,7 @@ F Makefile.in 38485d15d9190cdad0d7bee25af7b442028865964025dcc61f40fd8d6e369cfc F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a9b95ae9807e17f9b0734ebe97d68032141c3f95286bb64593cb73b206f043cf F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 -F VERSION 01f7606130e48fd58a74d1e45e565f2674819d6eadbc219d328d94bb3362b818 +F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d87031 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde -R ace1a556cd2682c15f244d0a70c9d1c1 +P 4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388 +R b5d195e43beae1111c42ac081a32392a U stephan -Z e2303326f9884746fc80a4c5bceed35d +Z ceb27f6deb0f1234888251cc1a8b6e99 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ee3aa0d336..367bfe7636 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388 +46d08071f3f9fef78bc2444b52060e0e7de8c357a2aa213ac13c565e33acc4a0 From 65552a7ae1c77f627f7667837580c44baa1ba3ef Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 6 Feb 2025 17:10:38 +0000 Subject: [PATCH 03/72] Fix a harmless typo in a comment. FossilOrigin-Name: ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/insert.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1f8d299de4..1d31210c3e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bump\sversion\snumber\sto\s3.50.0\sfor\sthe\snext\sdev\scycle. -D 2025-02-06T13:36:31.028 +C Fix\sa\sharmless\stypo\sin\sa\scomment. +D 2025-02-06T17:10:38.852 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -739,7 +739,7 @@ F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c db8bfff30fd7f71812651df3ddf5d1624b9e19104b31e349cd9055bbc9d622c4 +F src/insert.c ccadada52dc508ab8229e343425ab2504db57cfcdf8271f0f9ce1c2c6cad97c1 F src/json.c 68a98c020c22127f2d65f08855f7fc7460ff352a6ce0b543d8931dde83319c22 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388 -R b5d195e43beae1111c42ac081a32392a -U stephan -Z ceb27f6deb0f1234888251cc1a8b6e99 +P 46d08071f3f9fef78bc2444b52060e0e7de8c357a2aa213ac13c565e33acc4a0 +R c4f19381dd3461bfce62af076631de2d +U drh +Z 430f69c01ee43f942d60706245b3b05a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 367bfe7636..d648338bf7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -46d08071f3f9fef78bc2444b52060e0e7de8c357a2aa213ac13c565e33acc4a0 +ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278 diff --git a/src/insert.c b/src/insert.c index 83baeece64..e2d910fce4 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1394,7 +1394,7 @@ void sqlite3Insert( continue; }else if( pColumn==0 ){ /* Hidden columns that are not explicitly named in the INSERT - ** get there default value */ + ** get their default value */ sqlite3ExprCodeFactorable(pParse, sqlite3ColumnExpr(pTab, &pTab->aCol[i]), iRegStore); From 038424727b4fef582dfb6f6badbcadb39039e39c Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 6 Feb 2025 17:29:14 +0000 Subject: [PATCH 04/72] Adjust the test/speedtest.tcl script so that it uses an on-disk database rather than an in-memory database. FossilOrigin-Name: e93d7aa1db9bdbf1996c4c168e67284177e384b7acf176d74a0458258faab05c --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/speedtest.tcl | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 1d31210c3e..27e4110605 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\stypo\sin\sa\scomment. -D 2025-02-06T17:10:38.852 +C Adjust\sthe\stest/speedtest.tcl\sscript\sso\sthat\sit\suses\san\son-disk\sdatabase\nrather\sthan\san\sin-memory\sdatabase. +D 2025-02-06T17:29:14.625 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1680,7 +1680,7 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad -F test/speedtest.tcl 8a9362c1e429318e741b91d26888e7edcc326f98c3aea505ffd618cc5b9e7f0a x +F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x F test/speedtest1.c 204acd8af326bbca2c28f68166635d4574381f4cabbac1bc243663f5dcc5051d F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 46d08071f3f9fef78bc2444b52060e0e7de8c357a2aa213ac13c565e33acc4a0 -R c4f19381dd3461bfce62af076631de2d +P ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278 +R 3389deb8f0facbb95e58d6e9fc976f10 U drh -Z 430f69c01ee43f942d60706245b3b05a +Z 9628165988950eefdec8a4b63484fc0a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d648338bf7..a345c88775 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278 +e93d7aa1db9bdbf1996c4c168e67284177e384b7acf176d74a0458258faab05c diff --git a/test/speedtest.tcl b/test/speedtest.tcl index 93b407c94e..d201297158 100755 --- a/test/speedtest.tcl +++ b/test/speedtest.tcl @@ -174,9 +174,14 @@ if {!$dryrun} { } lappend speedtestflags --testset $testset set stcmd [list valgrind --tool=cachegrind ./speedtest1 {*}$speedtestflags] +lappend stcmd speedtest1.db lappend stcmd >valgrind-out.txt 2>valgrind-err.txt puts $stcmd if {!$dryrun} { + foreach file {speedtest1.db speedtest1.db-journal speedtest1.db-wal + speedtest1.db-shm} { + if {[file exists $file]} {file delete $file} + } exec {*}$stcmd } From 6b3010a1344835e1c57f736cdb06c35ebefd24f0 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 01:43:05 +0000 Subject: [PATCH 05/72] Bump TEA configure.ac version number. FossilOrigin-Name: a1a9c780d1f1b47b0408397edded9c5d230c7b144207ad142d06c048792d31fa --- autoconf/tea/configure.ac | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac index e653798fc5..d3952707a2 100644 --- a/autoconf/tea/configure.ac +++ b/autoconf/tea/configure.ac @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([sqlite],[3.49.0]) +AC_INIT([sqlite],[3.50.0]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/manifest b/manifest index 27e4110605..cad7d41db4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adjust\sthe\stest/speedtest.tcl\sscript\sso\sthat\sit\suses\san\son-disk\sdatabase\nrather\sthan\san\sin-memory\sdatabase. -D 2025-02-06T17:29:14.625 +C Bump\sTEA\sconfigure.ac\sversion\snumber. +D 2025-02-07T01:43:05.809 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -24,7 +24,7 @@ F autoconf/auto.def 23bc095a3890c0ca334abf7ef67d1c8af4c22c12832bcc738015e868d54f F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac d22326594f005a493a7857cb4ad2496b91480101be731d7f0541bb8d7eba22a2 +F autoconf/tea/configure.ac 830cb2af5a3888312d0fd88402c2509d551d60e4c03f0481006a07c78313ef12 F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 55aec3c6d7e9a1de9b8d2fdc9c27fd055da3ac3a51b572195e2ae7300bcfd3a2 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278 -R 3389deb8f0facbb95e58d6e9fc976f10 -U drh -Z 9628165988950eefdec8a4b63484fc0a +P e93d7aa1db9bdbf1996c4c168e67284177e384b7acf176d74a0458258faab05c +R 862fe61394e7b3cb4c5d861b55c28308 +U stephan +Z 4a5b39d46ead9ead0e536423680a6ea5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a345c88775..0a49cc208d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e93d7aa1db9bdbf1996c4c168e67284177e384b7acf176d74a0458258faab05c +a1a9c780d1f1b47b0408397edded9c5d230c7b144207ad142d06c048792d31fa From 4192a95d23f828bb556b8602ac4df6edeb002ffc Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 11:15:58 +0000 Subject: [PATCH 06/72] Fix out-of-tree builds of the autoconf bundle, as reported in [forum:a0cd0beb1baa6bef|forum post a0cd0beb1baa6bef]. FossilOrigin-Name: d47964a65bcfd4bc0b06baca281467a0b7fc87eba912a19c0974f63a54928ff8 --- autoconf/Makefile.in | 27 ++++++++++++++++++--------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 0c97f16321..1229a72117 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -1,8 +1,17 @@ ######################################################################## # This is a main makefile for the "autoconf" bundle of SQLite. This is # a trimmed-down version of the canonical makefile, devoid of most -# documentation. For the full docs, see 'main.mk' in the canonical +# documentation. For the full docs, see /main.mk in the canonical # source tree. +# +# Maintenance reminders: +# +# - To keep this working with an out-of-tree build, be sure to prefix +# input file names with $(TOP)/ where appropriate (which is most +# places). +# +# - The original/canonical recipes can be found in /main.mk in the +# canonical source tree. all: TOP = @abs_top_srcdir@ @@ -123,8 +132,8 @@ LDFLAGS.libsqlite3 = \ LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS) -sqlite3.o: sqlite3.h sqlite3.c - $(CC) -c sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3) +sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c + $(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3) libsqlite3.LIB = libsqlite3$(T.lib) libsqlite3.SO = libsqlite3$(T.dll) @@ -169,9 +178,9 @@ install-lib: install-lib-$(ENABLE_LIB_STATIC) install: install-lib -sqlite3$(T.exe): shell.c sqlite3.c +sqlite3$(T.exe): $(TOP)/shell.c $(TOP)/sqlite3.c $(CC) -o $@ \ - shell.c sqlite3.c \ + $(TOP)/shell.c $(TOP)/sqlite3.c \ -I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \ $(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \ $(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) @@ -181,16 +190,16 @@ install-shell: sqlite3$(T.exe) $(install-dir.bin) $(INSTALL.strip) sqlite3$(T.exe) "$(install-dir.bin)" install: install-shell -install-headers: sqlite3.h $(install-dir.include) - $(INSTALL.noexec) sqlite3.h sqlite3ext.h "$(install-dir.include)" +install-headers: $(TOP)/sqlite3.h $(install-dir.include) + $(INSTALL.noexec) $(TOP)/sqlite3.h $(TOP)/sqlite3ext.h "$(install-dir.include)" install: install-headers install-pc: sqlite3.pc $(install-dir.pkgconfig) $(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)" install: install-pc -install-man1: sqlite3.1 $(install-dir.man1) - $(INSTALL.noexec) sqlite3.1 "$(install-dir.man1)" +install-man1: $(TOP)/sqlite3.1 $(install-dir.man1) + $(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)" install: install-man1 clean: diff --git a/manifest b/manifest index cad7d41db4..58056cf593 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bump\sTEA\sconfigure.ac\sversion\snumber. -D 2025-02-07T01:43:05.809 +C Fix\sout-of-tree\sbuilds\sof\sthe\sautoconf\sbundle,\sas\sreported\sin\s[forum:a0cd0beb1baa6bef|forum\spost\sa0cd0beb1baa6bef]. +D 2025-02-07T11:15:58.181 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def e7e92090c98aeb0174d29988c259834eb1b71ae1ea927015c3ef300f6f9b68ae F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 56697ad25ecf23afa317148b06bdc14f85960b42e5ec434ac1ba87f63a3cb789 +F autoconf/Makefile.in 1748696041b706722fcc2289630aec596e556e10677914ec1dd5de9c627324fa F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e93d7aa1db9bdbf1996c4c168e67284177e384b7acf176d74a0458258faab05c -R 862fe61394e7b3cb4c5d861b55c28308 +P a1a9c780d1f1b47b0408397edded9c5d230c7b144207ad142d06c048792d31fa +R b8a9ec2caf630431b78b8fafa6d467ea U stephan -Z 4a5b39d46ead9ead0e536423680a6ea5 +Z 0e72d164ec413ce5120bfc7018dcffe2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0a49cc208d..f997b3b722 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a1a9c780d1f1b47b0408397edded9c5d230c7b144207ad142d06c048792d31fa +d47964a65bcfd4bc0b06baca281467a0b7fc87eba912a19c0974f63a54928ff8 From d8452a9517c42a917c7f95aecde1f976f9d876ba Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 12:33:48 +0000 Subject: [PATCH 07/72] Reorder a piece of ext/wasm/GNUmakefile to correct the timing of various var accesses. Fixes a problem [https://github.com/sqlite/sqlite-wasm/pull/99|reported in the downstream npm subproject] and explains the confusion in [4aa025a943a4024094b9] (which has been reverted). FossilOrigin-Name: 65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7 --- ext/wasm/GNUmakefile | 46 ++++++++++++++++++++++------------------- ext/wasm/index.html | 4 ++-- ext/wasm/mkwasmbuilds.c | 1 + manifest | 16 +++++++------- manifest.uuid | 2 +- 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index dc8ea54fd4..4369635cf2 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -910,6 +910,31 @@ sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js sqlite3-worker1-promiser.mjs := $(dir.dout)/sqlite3-worker1-promiser.mjs sqlite3-worker1-bundler-friendly.mjs := $(dir.dout)/sqlite3-worker1-bundler-friendly.mjs sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js + +ifneq (1,$(MAKING_CLEAN)) +# This block MUST come between the above definitions of +# sqlite3-...js/mjs and the $(eval) calls below this block which use +# SQLITE.CALL.C-PP.FILTER. +######################################################################## +# bin.mkwb is used for generating some of the makefile code for the +# various wasm builds. It used to be generated in this makefile via a +# difficult-to-read/maintain block of $(eval)'d code. Attempts were +# made to generate it from tcl and bash (shell) but having to escape +# the $ references in those languages made it just as illegible as the +# native makefile code. Somewhat surprisingly, moving that code generation +# to C makes it slightly less illegible than the previous 3 options. +bin.mkwb := ./mkwasmbuilds +$(bin.mkwb): $(bin.mkwb).c $(MAKEFILE) + $(CC) -o $@ $< +DISTCLEAN_FILES += $(bin.mkwb) +.wasmbuilds.make: $(bin.mkwb) + @rm -f $@ + $(bin.mkwb) > $@ + @chmod -w $@ +-include .wasmbuilds.make +endif +DISTCLEAN_FILES += .wasmbuilds.make + $(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js))) $(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.mjs),\ $(c-pp.D.sqlite3-bundler-friendly))) @@ -941,27 +966,6 @@ sqlite3-api.ext.jses += \ all quick: $(sqlite3-api.ext.jses) q: quick -ifneq (1,$(MAKING_CLEAN)) -######################################################################## -# bin.mkwb is used for generating some of the makefile code for the -# various wasm builds. It used to be generated in this makefile via a -# difficult-to-read/maintain block of $(eval)'d code. Attempts were -# made to generate it from tcl and bash (shell) but having to escape -# the $ references in those languages made it just as illegible as the -# native makefile code. Somewhat surprisingly, moving that code generation -# to C makes it slightly less illegible than the previous 3 options. -bin.mkwb := ./mkwasmbuilds -$(bin.mkwb): $(bin.mkwb).c $(MAKEFILE) - $(CC) -o $@ $< -DISTCLEAN_FILES += $(bin.mkwb) -.wasmbuilds.make: $(bin.mkwb) - @rm -f $@ - $(bin.mkwb) > $@ - @chmod -w $@ --include .wasmbuilds.make -endif -DISTCLEAN_FILES += .wasmbuilds.make - ######################################################################## # batch-runner.js is part of one of the test apps which reads in SQL # dumps generated by $(speedtest1) and executes them. diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 5d53b62d48..a3d41f1a9c 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -84,8 +84,8 @@ wrapper is significantly easier to use, however.
  • demo-worker1-promiser: a demo of the Promise-based wrapper of the Worker1 API.
  • - +
  • demo-worker1-promiser-esm: + same as the previous demo except loads the promiser from an ESM module.
  • speedtest1 ports (sqlite3's primary benchmarking tool)... diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index 1e09f83c01..e762b572cd 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -274,6 +274,7 @@ static void mk_lib_mode(const char *zName /* build name */, if( !zEmcc ) zEmcc = ""; pf("%s# Begin build [%s-%s]\n", zBanner, zNM); + pf("# zApiJsOut=%s\n# zJsOut=%s\n# zCmppD=%s\n", zApiJsOut, zJsOut, zCmppD); pf("$(info Setting up build [%s-%s]: %s)\n", zNM, zJsOut); mk_pre_post(zNM, zCmppD); pf("\nemcc.flags.%s.%s ?=\n", zNM); diff --git a/manifest b/manifest index 58056cf593..d5d82d5ef5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sout-of-tree\sbuilds\sof\sthe\sautoconf\sbundle,\sas\sreported\sin\s[forum:a0cd0beb1baa6bef|forum\spost\sa0cd0beb1baa6bef]. -D 2025-02-07T11:15:58.181 +C Reorder\sa\spiece\sof\sext/wasm/GNUmakefile\sto\scorrect\sthe\stiming\sof\svarious\svar\saccesses.\sFixes\sa\sproblem\s[https://github.com/sqlite/sqlite-wasm/pull/99|reported\sin\sthe\sdownstream\snpm\ssubproject]\sand\sexplains\sthe\sconfusion\sin\s[4aa025a943a4024094b9]\s(which\shas\sbeen\sreverted). +D 2025-02-07T12:33:48.387 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 7d1076680e687d01e0f4f343624db4e00e31edbe67bd0cb2e3ad8ecea98a3cae +F ext/wasm/GNUmakefile df23a3cb3bfb13f17fc76132a0127a89e2ad64f46b71efee9743929cfd52d441 F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -677,10 +677,10 @@ F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1 F ext/wasm/fiddle/index.html c79b1741cbeba78f88af0a84cf5ec7de87a909a6a8d10a369b1f4824c66c2088 F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730 -F ext/wasm/index.html 10ff3ad190aadccb713109fa55a38e5c1f3c2a8cf05cd31783745bab3f184079 +F ext/wasm/index.html e4bbffdb3d40eff12b3f9c7abedef91787e2935620b7f8d40f2c774b80ad8fa9 F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54 F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8 -F ext/wasm/mkwasmbuilds.c d5885bacf2253bed913cdc7eb16b44f9c9e782133e10600652d1a78841c337af +F ext/wasm/mkwasmbuilds.c 954fe4242e877aeb60de44070628f5215ff51e5d102db6e2cb7da8c21e9e3401 F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a1a9c780d1f1b47b0408397edded9c5d230c7b144207ad142d06c048792d31fa -R b8a9ec2caf630431b78b8fafa6d467ea +P d47964a65bcfd4bc0b06baca281467a0b7fc87eba912a19c0974f63a54928ff8 +R bc3b5d925c6179c0542f51782afdf047 U stephan -Z 0e72d164ec413ce5120bfc7018dcffe2 +Z 4ad5c2be721c326cfa9c17d54c17536c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f997b3b722..778ccade2d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d47964a65bcfd4bc0b06baca281467a0b7fc87eba912a19c0974f63a54928ff8 +65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7 From 7a7002143c893ca06035ddc15c71f095a6b95849 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 12:58:09 +0000 Subject: [PATCH 08/72] configure: change extension of static libraries from .lib to .a on msys/cygwin, as per discussion in [forum:02db2d4240|forum post 02db2d4240]. Replace unidiomatic JS-style use of inner procs in autosetup/proj.tcl with TCL lambdas. FossilOrigin-Name: 46f51e2a3707614a2b3ca6261bc6e0e8835477fdb7cbcf2f06b20cdebde2bab9 --- autosetup/proj.tcl | 20 +++++++++++--------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 88da2112cf..5eeec0afb9 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -760,7 +760,7 @@ proc proj-exe-extension {} { # Trivia: for .dylib files, the linker needs the -dynamiclib flag # instead of -shared. proc proj-dll-extension {} { - proc inner {key} { + set inner {{key} { switch -glob -- [get-define $key] { *apple* { return ".dylib" @@ -772,9 +772,9 @@ proc proj-dll-extension {} { return ".so" } } - } - define BUILD_DLLEXT [inner build] - define TARGET_DLLEXT [inner host] + }} + define BUILD_DLLEXT [apply $inner build] + define TARGET_DLLEXT [apply $inner host] } ######################################################################## @@ -784,18 +784,20 @@ proc proj-dll-extension {} { # BUILD_LIBEXT and TARGET_LIBEXT to the conventional static library # extension for the being-built-on resp. the target platform. proc proj-lib-extension {} { - proc inner {key} { + set inner {{key} { switch -glob -- [get-define $key] { *-*-ming* - *-*-cygwin - *-*-msys { - return ".lib" + return ".a" + # ^^^ this was ".lib" until 2025-02-07. See + # https://sqlite.org/forum/forumpost/02db2d4240 } default { return ".a" } } - } - define BUILD_LIBEXT [inner build] - define TARGET_LIBEXT [inner host] + }} + define BUILD_LIBEXT [apply $inner build] + define TARGET_LIBEXT [apply $inner host] } ######################################################################## diff --git a/manifest b/manifest index d5d82d5ef5..29a95f233f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reorder\sa\spiece\sof\sext/wasm/GNUmakefile\sto\scorrect\sthe\stiming\sof\svarious\svar\saccesses.\sFixes\sa\sproblem\s[https://github.com/sqlite/sqlite-wasm/pull/99|reported\sin\sthe\sdownstream\snpm\ssubproject]\sand\sexplains\sthe\sconfusion\sin\s[4aa025a943a4024094b9]\s(which\shas\sbeen\sreverted). -D 2025-02-07T12:33:48.387 +C configure:\schange\sextension\sof\sstatic\slibraries\sfrom\s.lib\sto\s.a\son\smsys/cygwin,\sas\sper\sdiscussion\sin\s[forum:02db2d4240|forum\spost\s02db2d4240].\sReplace\sunidiomatic\sJS-style\suse\sof\sinner\sprocs\sin\sautosetup/proj.tcl\swith\sTCL\slambdas. +D 2025-02-07T12:58:09.364 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 5a74bdbf43c52289e3f482f3b9578db4bd657e88e8fe04b16c564d9fb710540a F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 9adf1539673cef15bff862d9360b479e6920cc2c0d85de707b0ba31c04ce4531 +F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 F autosetup/sqlite-config.tcl 00af5b9d94d580367bf01984b86397e8d35b74090427def9591a54ded0e1a287 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d47964a65bcfd4bc0b06baca281467a0b7fc87eba912a19c0974f63a54928ff8 -R bc3b5d925c6179c0542f51782afdf047 +P 65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7 +R dbe2a8083128cb507b4a3778dff39744 U stephan -Z 4ad5c2be721c326cfa9c17d54c17536c +Z 17346bc038bd674448e57b726746aecf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 778ccade2d..d18bacd0ca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7 +46f51e2a3707614a2b3ca6261bc6e0e8835477fdb7cbcf2f06b20cdebde2bab9 From ede1690cce75ecd6fb965c2ff99c54f92e694ed6 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 7 Feb 2025 13:37:15 +0000 Subject: [PATCH 09/72] Reduce the amount of memset() needed to initialize the Parse object. FossilOrigin-Name: 284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/sqliteInt.h | 4 ++-- src/trigger.c | 2 ++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 29a95f233f..57aee4069f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure:\schange\sextension\sof\sstatic\slibraries\sfrom\s.lib\sto\s.a\son\smsys/cygwin,\sas\sper\sdiscussion\sin\s[forum:02db2d4240|forum\spost\s02db2d4240].\sReplace\sunidiomatic\sJS-style\suse\sof\sinner\sprocs\sin\sautosetup/proj.tcl\swith\sTCL\slambdas. -D 2025-02-07T12:58:09.364 +C Reduce\sthe\samount\sof\smemset()\sneeded\sto\sinitialize\sthe\sParse\sobject. +D 2025-02-07T13:37:15.659 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -785,7 +785,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 9d7052c71f46ca3a1a4880ba4a62590da334651139a38327d488894d9c883f3b +F src/sqliteInt.h d85806d6d66210ddf8b14158c6301608ca6abfa952b5a8e57c9852926a4c9728 F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -843,7 +843,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 375a772e2342274f4bf73605a70633237da09deed00a9bf4c4816a56777ea7c9 F src/treeview.c d85ce76e6d1498d781957c07cb234da6d77ce0ed2d196480d516f54dabc62279 -F src/trigger.c 247e2d712d5edc6021d52a169f6ac9a9c10d7144bc4ac7ea06c1ed2aa414659f +F src/trigger.c 9f887ae4d3077d9de67d312e1da12f57e8b3a598468876bb3b8ccc6c1bca2eb1 F src/update.c 0e01aa6a3edf9ec112b33eb714b9016a81241497b1fb7c3e74332f4f71756508 F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7 -R dbe2a8083128cb507b4a3778dff39744 -U stephan -Z 17346bc038bd674448e57b726746aecf +P 46f51e2a3707614a2b3ca6261bc6e0e8835477fdb7cbcf2f06b20cdebde2bab9 +R 2ea5c3310ea580989e316d82762bea3d +U drh +Z 9a2383046899765f80ff4490e5ed6b3d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d18bacd0ca..7872bfc017 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -46f51e2a3707614a2b3ca6261bc6e0e8835477fdb7cbcf2f06b20cdebde2bab9 +284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31 diff --git a/src/sqliteInt.h b/src/sqliteInt.h index f47009c158..bbef593dfa 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3879,8 +3879,6 @@ struct Parse { int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ Returning *pReturning; /* The RETURNING clause */ } u1; - u32 oldmask; /* Mask of old.* columns referenced */ - u32 newmask; /* Mask of new.* columns referenced */ LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ u8 bReturning; /* Coding a RETURNING trigger */ @@ -3897,6 +3895,8 @@ struct Parse { int aTempReg[8]; /* Holding area for temporary registers */ Parse *pOuterParse; /* Outer Parse object when nested */ Token sNameToken; /* Token with unqualified schema object name */ + u32 oldmask; /* Mask of old.* columns referenced */ + u32 newmask; /* Mask of new.* columns referenced */ /************************************************************************ ** Above is constant between recursions. Below is reset before and after diff --git a/src/trigger.c b/src/trigger.c index e306a2e664..e7b75d344a 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -1277,6 +1277,8 @@ static TriggerPrg *codeRowTrigger( sSubParse.eTriggerOp = pTrigger->op; sSubParse.nQueryLoop = pParse->nQueryLoop; sSubParse.prepFlags = pParse->prepFlags; + sSubParse.oldmask = 0; + sSubParse.newmask = 0; v = sqlite3GetVdbe(&sSubParse); if( v ){ From 189a4a0bbbc81781c2ee8aaf3f31cf55f67085e9 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 14:44:31 +0000 Subject: [PATCH 10/72] Mac-specific build fixes discussed in [forum:9dfd5b8fd525a5d7|forum thread 9dfd5b8fd525a5d7]: rename dylib links and add legacy-compatibility versioning stamps to libsqlite3.dylib. FossilOrigin-Name: 668bcf327a82a63d45be8cf38fdddc855dbcefdedf6c208e091eb7e2d244929d --- Makefile.in | 2 ++ auto.def | 5 ++-- autoconf/Makefile.in | 26 ++++++++++++++++----- autoconf/auto.def | 3 +-- autosetup/jimsh0.c | 32 ++++++++++++-------------- autosetup/sqlite-config.tcl | 46 ++++++++++++++++++++++++++++++++++++- main.mk | 21 +++++++++++++---- manifest | 26 ++++++++++----------- manifest.uuid | 2 +- 9 files changed, 116 insertions(+), 47 deletions(-) diff --git a/Makefile.in b/Makefile.in index 15e61217f2..f514046e00 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,6 +121,8 @@ LDFLAGS.icu = @LDFLAGS_ICU@ CFLAGS.icu = @CFLAGS_ICU@ LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded +LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ +# os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 ENABLE_SHARED = @ENABLE_SHARED@ ENABLE_STATIC = @ENABLE_STATIC@ HAVE_WASI_SDK = @HAVE_WASI_SDK@ diff --git a/auto.def b/auto.def index 52c758850c..3a5a2f64c1 100644 --- a/auto.def +++ b/auto.def @@ -230,7 +230,7 @@ proj-if-opt-truthy dev { define CFLAGS [get-env CFLAGS {-O0 -g}] # -------------^^^^^^^ intentionally using [get-env] instead of # [proj-get-env] here because [sqlite-setup-default-cflags] uses - # [proj-get-env]. + # [proj-get-env] and we want this to supercede that. } sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk] @@ -275,6 +275,5 @@ sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu sqlite-handle-emsdk -sqlite-process-dot-in-files -sqlite-post-config-validation +sqlite-common-late-stage-config sqlite-dump-defines diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 1229a72117..0270b9a1db 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -69,7 +69,6 @@ LDFLAGS.readline = @LDFLAGS_READLINE@ CFLAGS.readline = @CFLAGS_READLINE@ LDFLAGS.icu = @LDFLAGS_ICU@ CFLAGS.icu = @CFLAGS_ICU@ -LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ # When cross-compiling, we need to avoid the -s flag because it only # works on the build host's platform. @@ -124,12 +123,16 @@ SHELL_OPT ?= @OPT_SHELL@ # OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ +LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ +# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded +LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ +# os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 + LDFLAGS.libsqlite3 = \ $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ $(LDFLAGS.math) $(LDFLAGS.dlopen) \ $(LDFLAGS.zlib) $(LDFLAGS.icu) \ $(LDFLAGS.configure) -LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS) sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c @@ -140,7 +143,8 @@ libsqlite3.SO = libsqlite3$(T.dll) $(libsqlite3.SO): sqlite3.o $(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \ - $(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.libsqlite3.soname) + $(LDFLAGS) $(LDFLAGS.libsqlite3) \ + $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) all: $(libsqlite3.SO) $(libsqlite3.LIB): sqlite3.o @@ -149,8 +153,16 @@ all: $(libsqlite3.LIB) install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @echo "Setting up $(libsqlite3.SO) symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ + @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + if [ x.dylib = x$(T.dll) ]; then \ + rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ + dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ + mv $(libsqlite3.SO) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ + ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ + ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ + else \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ @@ -166,7 +178,9 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ ls -la $(libsqlite3.SO).0.8.6; \ - fi + fi; \ + fi + install-so-0 install-so-: install-so: install-so-$(ENABLE_LIB_SHARED) install: install-so diff --git a/autoconf/auto.def b/autoconf/auto.def index 12eb3d75c3..72f50094b8 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -94,5 +94,4 @@ sqlite-handle-icu define ENABLE_LIB_SHARED [opt-bool shared] define ENABLE_LIB_STATIC [opt-bool static] -sqlite-process-dot-in-files -sqlite-post-config-validation +sqlite-common-late-stage-config diff --git a/autosetup/jimsh0.c b/autosetup/jimsh0.c index 4b9cf3eebf..0526b9a446 100644 --- a/autosetup/jimsh0.c +++ b/autosetup/jimsh0.c @@ -75,9 +75,6 @@ extern "C" { #if defined(_WIN32) || defined(WIN32) -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif #define HAVE_DLOPEN void *dlopen(const char *path, int mode); int dlclose(void *handle); @@ -1201,6 +1198,11 @@ int Jim_OpenForRead(const char *filename); #define Jim_FileStat _fstat64 #define Jim_Lseek _lseeki64 #define O_TEXT _O_TEXT + #define O_BINARY _O_BINARY + #define Jim_SetMode _setmode + #ifndef STDIN_FILENO + #define STDIN_FILENO 0 + #endif #else #if defined(HAVE_STAT64) @@ -2941,22 +2943,22 @@ static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int aio_cmd_translation(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - enum {OPT_BINARY, OPT_TEXT}; + enum {OPT_BINARY, OPT_TEXT}; static const char * const options[] = { "binary", "text", NULL }; - int opt; + int opt; - if (Jim_GetEnum(interp, argv[0], options, &opt, NULL, JIM_ERRMSG) != JIM_OK) { - return JIM_ERR; - } -#if defined(_setmode) && defined(O_BINARY) - else { - AioFile *af = Jim_CmdPrivData(interp); - _setmode(af->fh, opt == OPT_BINARY ? O_BINARY : O_TEXT); - } + if (Jim_GetEnum(interp, argv[0], options, &opt, NULL, JIM_ERRMSG) != JIM_OK) { + return JIM_ERR; + } +#if defined(Jim_SetMode) + else { + AioFile *af = Jim_CmdPrivData(interp); + Jim_SetMode(af->fd, opt == OPT_BINARY ? O_BINARY : O_TEXT); + } #endif return JIM_OK; } @@ -24374,10 +24376,6 @@ int Jim_InteractivePrompt(Jim_Interp *interp) #include -#ifdef HAVE_UNISTD_H -#include -#endif - extern int Jim_initjimshInit(Jim_Interp *interp); diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 9f300e317d..cabb32aac0 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -43,7 +43,10 @@ set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] ######################################################################## # Runs some common initialization which must happen immediately after -# autosetup's [options] function is called. +# autosetup's [options] function is called. This is also a convenient +# place to put some generic pieces common to both the canonical +# top-level build and the "autoconf" build, but it's not intended to +# be a catch-all dumping ground for such. proc sqlite-post-options-init {} { # # Carry values from hidden --flag aliases over to their canonical @@ -861,6 +864,47 @@ proc sqlite-handle-math {} { } } +######################################################################## +# If this OS looks like a Mac, checks for the Mac-specific +# -current_version and -compatibility_version linker flags. Defines +# LDFLAGS_MAC_CVERSION to an empty string and returns 0 if they're not +# supported, else defines that to the linker flags and returns 1. +# +# We don't check this on non-Macs because this whole thing is a +# libtool compatibility kludge to account for a version stamp which +# libtool applied only on Mac platforms. +# +# Based on https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7. +proc sqlite-check-mac-cversion {} { + define LDFLAGS_MAC_CVERSION "" + set rc 0 + if {[proj-looks-like-mac]} { + cc-with {} { + # These version numbers are historical libtool-defined values, not + # library-defined ones + if {[cc-check-flags "-Wl,-current_version,9.6.0"] + && [cc-check-flags "-Wl,-compatibility_version,9.0.0"]} { + define LDFLAGS_MAC_CVERSION "-Wl,-compatibility_version,9.0.0 -Wl,-current_version,9.6.0" + set rc 1 + } elseif {[cc-check-flags "-compatibility_version 9.0.0"] + && [cc-check-flags "-current_version 9.6.0"]} { + define LDFLAGS_MAC_CVERSION "-compatibility_version 9.0.0 -current_version 9.6.0" + set rc 1 + } + } + } + return $rc +} + +######################################################################## +# Performs late-stage config steps common to both the canonical and +# autoconf bundle builds. +proc sqlite-common-late-stage-config {} { + sqlite-check-mac-cversion + sqlite-process-dot-in-files + sqlite-post-config-validation +} + ######################################################################## # Perform some late-stage work and generate the configure-process # output file(s). diff --git a/main.mk b/main.mk index 00632a5d5c..38d1ba5f56 100644 --- a/main.mk +++ b/main.mk @@ -166,6 +166,7 @@ LDFLAGS.shlib ?= -shared LDFLAGS.icu ?= # -licui18n -licuuc -licudata CFLAGS.icu ?= LDFLAGS.libsqlite3.soname ?= # see https://sqlite.org/src/forumpost/5a3b44f510df8ded +LDFLAGS.libsqlite3.os-specific ?= # see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 # libreadline (or a workalike): # To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1 LDFLAGS.readline ?= -lreadline # these vary across platforms @@ -1411,7 +1412,7 @@ all: lib # $(libsqlite3.SO): $(LIBOBJ) $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) \ - $(LDFLAGS.libsqlite3.soname) + $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) $(libsqlite3.SO)-1: $(libsqlite3.SO) $(libsqlite3.SO)-0 $(libsqlite3.SO)-: so: $(libsqlite3.SO)-$(ENABLE_SHARED) @@ -1429,6 +1430,9 @@ all: so # unnecessary unless we want to set SONAME to libsqlite3.so.3, which # is also unnecessary. # +# N.B. different transformations are applied on systems where $(T.dll) +# is ".dylib" and none of the following docs apply on such systems. +# # The link named libsqlite3.so.0 is provided in an attempt to reduce # downstream disruption when performing upgrades from pre-3.48 to a # version 3.48 or higher. That name is considered a legacy remnant @@ -1465,8 +1469,16 @@ all: so # install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @echo "Setting up $(libsqlite3.SO) symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ + @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + if [ x.dylib = x$(T.dll) ]; then \ + rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ + dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ + mv $(libsqlite3.SO) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ + ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ + ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ + else \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ @@ -1482,7 +1494,8 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ ls -la $(libsqlite3.SO).0.8.6; \ - fi + fi; \ + fi install-so-0 install-so-: install-so: install-so-$(ENABLE_SHARED) install: install-so diff --git a/manifest b/manifest index 57aee4069f..09675a6203 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Reduce\sthe\samount\sof\smemset()\sneeded\sto\sinitialize\sthe\sParse\sobject. -D 2025-02-07T13:37:15.659 +C Mac-specific\sbuild\sfixes\sdiscussed\sin\s[forum:9dfd5b8fd525a5d7|forum\sthread\s9dfd5b8fd525a5d7]:\srename\sdylib\slinks\sand\sadd\slegacy-compatibility\sversioning\sstamps\sto\slibsqlite3.dylib. +D 2025-02-07T14:44:31.113 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 38485d15d9190cdad0d7bee25af7b442028865964025dcc61f40fd8d6e369cfc +F Makefile.in 85ed87882b5d3fd11e6403212f2120e5e07d341bc96a101cfa9475901edd0754 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a9b95ae9807e17f9b0734ebe97d68032141c3f95286bb64593cb73b206f043cf F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def e7e92090c98aeb0174d29988c259834eb1b71ae1ea927015c3ef300f6f9b68ae +F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 1748696041b706722fcc2289630aec596e556e10677914ec1dd5de9c627324fa +F autoconf/Makefile.in be23c54eef87e6a64d875f96f6cf60a871219c50b04a955ebbd1aac48b4c738e F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 23bc095a3890c0ca334abf7ef67d1c8af4c22c12832bcc738015e868d54fe9d7 +F autoconf/auto.def 71dde17158afcd6fb097b66853371991bb6ca5517b034e2efa9f0c47a2e730f2 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -47,10 +47,10 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034 F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360 F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f -F autosetup/jimsh0.c 5a74bdbf43c52289e3f482f3b9578db4bd657e88e8fe04b16c564d9fb710540a +F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 -F autosetup/sqlite-config.tcl 00af5b9d94d580367bf01984b86397e8d35b74090427def9591a54ded0e1a287 +F autosetup/sqlite-config.tcl f64aff26763e9ea021aabac222d43a9e0107b45f6de82972b93411fe36ef566b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 8cfe182232ac7bbc87530792db6f31c09f2a2f35e9887d0412978746efe42ea9 +F main.mk 70e140c6825aef1ac94c879db7db188be461db15d40e4d9cd9b3e444c2868e21 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 46f51e2a3707614a2b3ca6261bc6e0e8835477fdb7cbcf2f06b20cdebde2bab9 -R 2ea5c3310ea580989e316d82762bea3d -U drh -Z 9a2383046899765f80ff4490e5ed6b3d +P 284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31 +R a5275e98c179fe183ddd026b19c342d8 +U stephan +Z 6ccb26b8380cae53c605eba31ac4066e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7872bfc017..43c7b78aae 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31 +668bcf327a82a63d45be8cf38fdddc855dbcefdedf6c208e091eb7e2d244929d From 7fd936e5ed08c3bae9207c092a22a5c98520a3cb Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 7 Feb 2025 15:49:21 +0000 Subject: [PATCH 11/72] Further reduction in the amount of memset() needed to initialize the Parse object. FossilOrigin-Name: 45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b --- manifest | 24 ++++++++++++------------ manifest.uuid | 2 +- src/analyze.c | 3 ++- src/build.c | 45 ++++++++++++++++++++++++++++----------------- src/parse.y | 23 +++++++++++++++++++---- src/sqliteInt.h | 20 +++++++++++++------- src/trigger.c | 6 ++++-- src/vtab.c | 5 +++-- 8 files changed, 82 insertions(+), 46 deletions(-) diff --git a/manifest b/manifest index 09675a6203..aa76df4c1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Mac-specific\sbuild\sfixes\sdiscussed\sin\s[forum:9dfd5b8fd525a5d7|forum\sthread\s9dfd5b8fd525a5d7]:\srename\sdylib\slinks\sand\sadd\slegacy-compatibility\sversioning\sstamps\sto\slibsqlite3.dylib. -D 2025-02-07T14:44:31.113 +C Further\sreduction\sin\sthe\samount\sof\smemset()\sneeded\sto\sinitialize\sthe\sParse\nobject. +D 2025-02-07T15:49:21.109 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -713,7 +713,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 F src/alter.c aa93e37e4a36a0525bbb2a2aeda20d2018f0aa995542c7dc658e031375e3f532 -F src/analyze.c 9a8b67239d899ac12289db5db3f5bfe7f7a0ad1277f80f87ead1d048085876eb +F src/analyze.c 0823d2edb3ce564157e9d62714cc729027933209b712e95fbabb23e47fff0aec F src/attach.c 3a5cb9ee4aad6c5b22268287340a4f2f7b07959b7a522201be30fee23cd802e9 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 @@ -722,7 +722,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 357f98cdd9fe93f86e93ad3324fd224492480e48506c0c7db8ae3a94f3b5c5ee +F src/build.c cac3aa87f3bf137e12c77194150fb05c949d36a12177fd3acccdaa3669ca9744 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b @@ -769,7 +769,7 @@ F src/os_win.c 49c7725b500f5867e8360e75eeb30f9d70b62fa1f05c8a101da627210578df32 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 3a1c4e7f69af482e33c8cba8a75afe0dda0ea6391240adac22b040ce1bdeef44 F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 -F src/parse.y 5dce477d23c6cd41da97ff9bc4ef93fba0e0a0aaa72a15ddb8a3f71618d76cac +F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 @@ -785,7 +785,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h d85806d6d66210ddf8b14158c6301608ca6abfa952b5a8e57c9852926a4c9728 +F src/sqliteInt.h 51f674754f9424d8ec67c3955d1d161d8b31f30d54dd7032408e08ddc9199236 F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -843,7 +843,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 375a772e2342274f4bf73605a70633237da09deed00a9bf4c4816a56777ea7c9 F src/treeview.c d85ce76e6d1498d781957c07cb234da6d77ce0ed2d196480d516f54dabc62279 -F src/trigger.c 9f887ae4d3077d9de67d312e1da12f57e8b3a598468876bb3b8ccc6c1bca2eb1 +F src/trigger.c da3c25786870d8bf97cd46b493374c2375d1abaf20a9b0f5f8629a3f2f2ce383 F src/update.c 0e01aa6a3edf9ec112b33eb714b9016a81241497b1fb7c3e74332f4f71756508 F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba @@ -859,7 +859,7 @@ F src/vdbemem.c 977438546df236c6a3e7d8b4fe86c0643c13b89b00235db1f11c3a91a4796d30 F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 -F src/vtab.c bd4ab699ac4d1ee6da7339d3fbbb5edf23d9737c1fd322ccd75984329d070472 +F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 4e6181d8780ab0af2e1388d0754cbe6f2f04593d2b1ab6c41699a89942fd8997 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31 -R a5275e98c179fe183ddd026b19c342d8 -U stephan -Z 6ccb26b8380cae53c605eba31ac4066e +P 668bcf327a82a63d45be8cf38fdddc855dbcefdedf6c208e091eb7e2d244929d +R 24656f83648801915afdc285804c022a +U drh +Z 40d028d63f40c912276ee2b133ee3ab3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 43c7b78aae..8fe517c65e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -668bcf327a82a63d45be8cf38fdddc855dbcefdedf6c208e091eb7e2d244929d +45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b diff --git a/src/analyze.c b/src/analyze.c index 9213c202b7..799d43924c 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -215,7 +215,8 @@ static void openStatTable( sqlite3NestedParse(pParse, "CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols ); - aRoot[i] = (u32)pParse->regRoot; + assert( pParse->isCreate || pParse->nErr ); + aRoot[i] = (u32)pParse->u1.cr.regRoot; aCreateTbl[i] = OPFLAG_P2ISREG; } }else{ diff --git a/src/build.c b/src/build.c index cc29610e0a..986107f48d 100644 --- a/src/build.c +++ b/src/build.c @@ -168,10 +168,12 @@ void sqlite3FinishCoding(Parse *pParse){ || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort)); if( v ){ if( pParse->bReturning ){ - Returning *pReturning = pParse->u1.pReturning; + Returning *pReturning; int addrRewind; int reg; + assert( !pParse->isCreate ); + pReturning = pParse->u1.d.pReturning; if( pReturning->nRetCol ){ sqlite3VdbeAddOp0(v, OP_FkCheck); addrRewind = @@ -247,7 +249,9 @@ void sqlite3FinishCoding(Parse *pParse){ } if( pParse->bReturning ){ - Returning *pRet = pParse->u1.pReturning; + Returning *pRet; + assert( !pParse->isCreate ); + pRet = pParse->u1.d.pReturning; if( pRet->nRetCol ){ sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); } @@ -1319,8 +1323,9 @@ void sqlite3StartTable( /* If the file format and encoding in the database have not been set, ** set them now. */ - reg1 = pParse->regRowid = ++pParse->nMem; - reg2 = pParse->regRoot = ++pParse->nMem; + assert( pParse->isCreate ); + reg1 = pParse->u1.cr.regRowid = ++pParse->nMem; + reg2 = pParse->u1.cr.regRoot = ++pParse->nMem; reg3 = ++pParse->nMem; sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT); sqlite3VdbeUsesBtree(v, iDb); @@ -1335,8 +1340,8 @@ void sqlite3StartTable( ** The record created does not contain anything yet. It will be replaced ** by the real entry in code generated at sqlite3EndTable(). ** - ** The rowid for the new entry is left in register pParse->regRowid. - ** The root page number of the new table is left in reg pParse->regRoot. + ** The rowid for the new entry is left in register pParse->u1.cr.regRowid. + ** The root page of the new table is left in reg pParse->u1.cr.regRoot. ** The rowid and root page number values are needed by the code that ** sqlite3EndTable will generate. */ @@ -1347,7 +1352,7 @@ void sqlite3StartTable( #endif { assert( !pParse->bReturning ); - pParse->u1.addrCrTab = + pParse->u1.cr.addrCrTab = sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY); } sqlite3OpenSchemaTable(pParse, iDb); @@ -1425,7 +1430,8 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){ sqlite3ExprListDelete(db, pList); return; } - pParse->u1.pReturning = pRet; + assert( !pParse->isCreate ); + pParse->u1.d.pReturning = pRet; pRet->pParse = pParse; pRet->pReturnEL = pList; sqlite3ParserAddCleanup(pParse, sqlite3DeleteReturning, pRet); @@ -1564,7 +1570,8 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ } p->nCol++; p->nNVCol++; - pParse->constraintName.n = 0; + assert( pParse->isCreate ); + pParse->u1.cr.constraintName.n = 0; } /* @@ -1888,8 +1895,10 @@ void sqlite3AddCheckConstraint( && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt) ){ pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); - if( pParse->constraintName.n ){ - sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); + assert( pParse->isCreate ); + if( pParse->u1.cr.constraintName.n ){ + sqlite3ExprListSetName(pParse, pTab->pCheck, + &pParse->u1.cr.constraintName, 1); }else{ Token t; for(zStart++; sqlite3Isspace(zStart[0]); zStart++){} @@ -2339,9 +2348,9 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ** into BTREE_BLOBKEY. */ assert( !pParse->bReturning ); - if( pParse->u1.addrCrTab ){ + if( pParse->u1.cr.addrCrTab ){ assert( v ); - sqlite3VdbeChangeP3(v, pParse->u1.addrCrTab, BTREE_BLOBKEY); + sqlite3VdbeChangeP3(v, pParse->u1.cr.addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally @@ -2781,7 +2790,7 @@ void sqlite3EndTable( /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT ** statement to populate the new table. The root-page number for the - ** new table is in register pParse->regRoot. + ** new table is in register pParse->u1.cr.regRoot. ** ** Once the SELECT has been coded by sqlite3Select(), it is in a ** suitable state to query for the column names and types to be used @@ -2812,7 +2821,8 @@ void sqlite3EndTable( regRec = ++pParse->nMem; regRowid = ++pParse->nMem; sqlite3MayAbort(pParse); - sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb); + assert( pParse->isCreate ); + sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->u1.cr.regRoot, iDb); sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); addrTop = sqlite3VdbeCurrentAddr(v) + 1; sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); @@ -2857,6 +2867,7 @@ void sqlite3EndTable( ** schema table. We just need to update that slot with all ** the information we've collected. */ + assert( pParse->isCreate ); sqlite3NestedParse(pParse, "UPDATE %Q." LEGACY_SCHEMA_TABLE " SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q" @@ -2865,9 +2876,9 @@ void sqlite3EndTable( zType, p->zName, p->zName, - pParse->regRoot, + pParse->u1.cr.regRoot, zStmt, - pParse->regRowid + pParse->u1.cr.regRowid ); sqlite3DbFree(db, zStmt); sqlite3ChangeCookie(pParse, iDb); diff --git a/src/parse.y b/src/parse.y index e9e2c62e61..76c9a8e4ed 100644 --- a/src/parse.y +++ b/src/parse.y @@ -62,6 +62,11 @@ %include { #include "sqliteInt.h" +/* +** Verify that the pParse->isCreate field is set +*/ +#define ASSERT_IS_CREATE assert(pParse->isCreate) + /* ** Disable all error recovery processing in the parser push-down ** automaton. @@ -125,6 +130,10 @@ static void parserSyntaxError(Parse *pParse, Token *p){ static void disableLookaside(Parse *pParse){ sqlite3 *db = pParse->db; pParse->disableLookaside++; +#ifdef SQLITE_DEBUG + pParse->isCreate = 1; +#endif + memset(&pParse->u1.cr, 0, sizeof(pParse->u1.cr)); DisableLookaside; } @@ -197,7 +206,9 @@ cmd ::= create_table create_table_args. create_table ::= createkw temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). { sqlite3StartTable(pParse,&Y,&Z,T,0,0,E); } -createkw(A) ::= CREATE(A). {disableLookaside(pParse);} +createkw(A) ::= CREATE(A). { + disableLookaside(pParse); +} %type ifnotexists {int} ifnotexists(A) ::= . {A = 0;} @@ -373,7 +384,7 @@ scantok(A) ::= . { // carglist ::= carglist ccons. carglist ::= . -ccons ::= CONSTRAINT nm(X). {pParse->constraintName = X;} +ccons ::= CONSTRAINT nm(X). {ASSERT_IS_CREATE; pParse->u1.cr.constraintName = X;} ccons ::= DEFAULT scantok(A) term(X). {sqlite3AddDefaultValue(pParse,X,A.z,&A.z[A.n]);} ccons ::= DEFAULT LP(A) expr(X) RP(Z). @@ -448,9 +459,9 @@ conslist_opt(A) ::= . {A.n = 0; A.z = 0;} conslist_opt(A) ::= COMMA(A) conslist. conslist ::= conslist tconscomma tcons. conslist ::= tcons. -tconscomma ::= COMMA. {pParse->constraintName.n = 0;} +tconscomma ::= COMMA. {ASSERT_IS_CREATE; pParse->u1.cr.constraintName.n = 0;} tconscomma ::= . -tcons ::= CONSTRAINT nm(X). {pParse->constraintName = X;} +tcons ::= CONSTRAINT nm(X). {ASSERT_IS_CREATE; pParse->u1.cr.constraintName = X;} tcons ::= PRIMARY KEY LP sortlist(X) autoinc(I) RP onconf(R). {sqlite3AddPrimaryKey(pParse,X,R,I,0);} tcons ::= UNIQUE LP sortlist(X) RP onconf(R). @@ -1659,6 +1670,10 @@ trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z) ON fullname(E) foreach_clause when_clause(G). { sqlite3BeginTrigger(pParse, &B, &Z, C, D.a, D.b, E, G, T, NOERR); A = (Z.n==0?B:Z); /*A-overwrites-T*/ +#ifdef SQLITE_DEBUG + assert( pParse->isCreate ); /* Set by createkw reduce action */ + pParse->isCreate = 0; /* But, should not be set for CREATE TRIGGER */ +#endif } %type trigger_time {int} diff --git a/src/sqliteInt.h b/src/sqliteInt.h index bbef593dfa..acc36f07c0 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3841,6 +3841,8 @@ struct Parse { #endif #ifdef SQLITE_DEBUG u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */ + u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER) + ** and ALTER TABLE ADD COLUMN. */ #endif int nRangeReg; /* Size of the temporary register block */ int iRangeReg; /* First register in temporary register block */ @@ -3856,11 +3858,8 @@ struct Parse { ExprList *pConstExpr;/* Constant expressions */ IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */ IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */ - Token constraintName;/* Name of the constraint currently being parsed */ yDbMask writeMask; /* Start a write transaction on these databases */ yDbMask cookieMask; /* Bitmask of schema verified databases */ - int regRowid; /* Register holding rowid of CREATE TABLE entry */ - int regRoot; /* Register holding root page number for new objects */ int nMaxArg; /* Max args passed to user function by sub-program */ int nSelect; /* Number of SELECT stmts. Counter for Select.selId */ #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -3875,10 +3874,6 @@ struct Parse { Table *pTriggerTab; /* Table triggers are being coded for */ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ - union { - int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ - Returning *pReturning; /* The RETURNING clause */ - } u1; LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ u8 bReturning; /* Coding a RETURNING trigger */ @@ -3897,6 +3892,17 @@ struct Parse { Token sNameToken; /* Token with unqualified schema object name */ u32 oldmask; /* Mask of old.* columns referenced */ u32 newmask; /* Mask of new.* columns referenced */ + union { + struct { /* These fields available when isCreate is true */ + int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ + int regRowid; /* Register holding rowid of CREATE TABLE entry */ + int regRoot; /* Register holding root page for new objects */ + Token constraintName; /* Name of the constraint currently being parsed */ + } cr; + struct { /* These fields available to all other statements */ + Returning *pReturning; /* The RETURNING clause */ + } d; + } u1; /************************************************************************ ** Above is constant between recursions. Below is reset before and after diff --git a/src/trigger.c b/src/trigger.c index e7b75d344a..604c3ab42f 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -70,7 +70,8 @@ Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){ assert( pParse->db->pVtabCtx==0 ); #endif assert( pParse->bReturning ); - assert( &(pParse->u1.pReturning->retTrig) == pTrig ); + assert( !pParse->isCreate ); + assert( &(pParse->u1.d.pReturning->retTrig) == pTrig ); pTrig->table = pTab->zName; pTrig->pTabSchema = pTab->pSchema; pTrig->pNext = pList; @@ -1047,7 +1048,8 @@ static void codeReturningTrigger( return; } assert( db->pParse==pParse ); - pReturning = pParse->u1.pReturning; + assert( !pParse->isCreate ); + pReturning = pParse->u1.d.pReturning; if( pTrigger != &(pReturning->retTrig) ){ /* This RETURNING trigger is for a different statement */ return; diff --git a/src/vtab.c b/src/vtab.c index 09f0c2d7f1..e40f60873a 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -479,11 +479,12 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ ** schema table. We just need to update that slot with all ** the information we've collected. ** - ** The VM register number pParse->regRowid holds the rowid of an + ** The VM register number pParse->u1.cr.regRowid holds the rowid of an ** entry in the sqlite_schema table that was created for this vtab ** by sqlite3StartTable(). */ iDb = sqlite3SchemaToIndex(db, pTab->pSchema); + assert( pParse->isCreate ); sqlite3NestedParse(pParse, "UPDATE %Q." LEGACY_SCHEMA_TABLE " " "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q " @@ -492,7 +493,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ pTab->zName, pTab->zName, zStmt, - pParse->regRowid + pParse->u1.cr.regRowid ); v = sqlite3GetVdbe(pParse); sqlite3ChangeCookie(pParse, iDb); From 84b0f221f4e92139077d8246cc373e8264224a97 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 7 Feb 2025 19:09:20 +0000 Subject: [PATCH 12/72] Fix comments on the Parse.nMaxArgs field so that they are correct. Add assert()s to ensure they are correct. Other Parse changes to reduce the amount of memset() needed to initialize it. FossilOrigin-Name: c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/sqliteInt.h | 20 ++++++++++---------- src/vdbe.c | 2 ++ src/vdbeInt.h | 3 ++- src/vdbeaux.c | 23 +++++++++++++++-------- src/wherecode.c | 3 +++ 7 files changed, 43 insertions(+), 30 deletions(-) diff --git a/manifest b/manifest index aa76df4c1f..23bd8c8395 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\sreduction\sin\sthe\samount\sof\smemset()\sneeded\sto\sinitialize\sthe\sParse\nobject. -D 2025-02-07T15:49:21.109 +C Fix\scomments\son\sthe\sParse.nMaxArgs\sfield\sso\sthat\sthey\sare\scorrect.\s\sAdd\nassert()s\sto\sensure\sthey\sare\scorrect.\s\sOther\sParse\schanges\sto\sreduce\sthe\namount\sof\smemset()\sneeded\sto\sinitialize\sit. +D 2025-02-07T19:09:20.404 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -785,7 +785,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 51f674754f9424d8ec67c3955d1d161d8b31f30d54dd7032408e08ddc9199236 +F src/sqliteInt.h f576f21641e8667779424003e552e79a3d3c7e824421f954ef73fce44040581c F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -849,11 +849,11 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 -F src/vdbe.c b428a751953c0c2ff85e3e152ec16e29d488895cd541c8c20876ff9f3bf6978a +F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 -F src/vdbeInt.h 895b1ab7536f018d3d70d690f6c0adbd1062b6dddce1c2cad912927856d4033c +F src/vdbeInt.h 7abc3ce9732fd487ee2544b478ac0526dca443d6d470fc34784d3122d378cf3e F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 -F src/vdbeaux.c 885e16100597507fbbe09d82cbb963bff3fd8a9c1e358dc4f463fc95feb18e8b +F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b F src/vdbeblob.c 255be187436da38b01f276c02e6a08103489bbe2a7c6c21537b7aecbe0e1f797 F src/vdbemem.c 977438546df236c6a3e7d8b4fe86c0643c13b89b00235db1f11c3a91a4796d30 F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f @@ -866,7 +866,7 @@ F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd F src/whereInt.h d20cddddb1d61b18d5cb1fcfa9b77fbeebbc4afe44d996e603452a23b3009ee1 -F src/wherecode.c 0c3d3199a2b769a5e2bb70feb5003dc85b3d86842ecaf903a47f2b4205ca5dab +F src/wherecode.c 5baa06f0daae7d38aca1d4814030b82ad4f127fe6bad18f0644776a474f6088b F src/whereexpr.c 2415c8eee5ff89a8b709d7d83d71c1ff986cd720d0520057e1d8a5371339012a F src/window.c 2bf01f9941a64fbcead61a0e3cb5db3fca5094b30d2ff0d23274c2a81d2e2385 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 668bcf327a82a63d45be8cf38fdddc855dbcefdedf6c208e091eb7e2d244929d -R 24656f83648801915afdc285804c022a +P 45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b +R 07888caf6f9e73972781470e8ad03e81 U drh -Z 40d028d63f40c912276ee2b133ee3ab3 +Z 434b297f89532d0b5b94eab3e74d43a4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8fe517c65e..fb16c00a62 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b +c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c diff --git a/src/sqliteInt.h b/src/sqliteInt.h index acc36f07c0..359ed1b6b1 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3823,19 +3823,20 @@ struct Parse { char *zErrMsg; /* An error message */ Vdbe *pVdbe; /* An engine for executing database bytecode */ int rc; /* Return code from execution */ - u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */ - u8 checkSchema; /* Causes schema cookie check after an error */ + LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ u8 nested; /* Number of nested calls to the parser/code generator */ u8 nTempReg; /* Number of temporary registers in aTempReg[] */ u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ u8 mayAbort; /* True if statement may throw an ABORT exception */ u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ - u8 okConstFactor; /* OK to factor out constants */ u8 disableLookaside; /* Number of times lookaside has been disabled */ u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ - u8 bHasWith; /* True if statement contains WITH */ u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */ + u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ + u8 bReturning; /* Coding a RETURNING trigger */ + u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ + u8 disableTriggers; /* True to disable triggers */ #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ #endif @@ -3844,6 +3845,10 @@ struct Parse { u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER) ** and ALTER TABLE ADD COLUMN. */ #endif + u8 colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */ + u8 bHasWith :1; /* True if statement contains WITH */ + u8 okConstFactor :1; /* OK to factor out constants */ + u8 checkSchema :1; /* Causes schema cookie check after an error */ int nRangeReg; /* Size of the temporary register block */ int iRangeReg; /* First register in temporary register block */ int nErr; /* Number of errors seen */ @@ -3860,7 +3865,7 @@ struct Parse { IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */ yDbMask writeMask; /* Start a write transaction on these databases */ yDbMask cookieMask; /* Bitmask of schema verified databases */ - int nMaxArg; /* Max args passed to user function by sub-program */ + int nMaxArg; /* Max args to xUpdate and xFilter vtab methods */ int nSelect; /* Number of SELECT stmts. Counter for Select.selId */ #ifndef SQLITE_OMIT_PROGRESS_CALLBACK u32 nProgressSteps; /* xProgress steps taken during sqlite3_prepare() */ @@ -3874,11 +3879,6 @@ struct Parse { Table *pTriggerTab; /* Table triggers are being coded for */ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ - LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ - u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ - u8 bReturning; /* Coding a RETURNING trigger */ - u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ - u8 disableTriggers; /* True to disable triggers */ /************************************************************************** ** Fields above must be initialized to zero. The fields that follow, diff --git a/src/vdbe.c b/src/vdbe.c index d41ac8d517..ec871c5a6e 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -8363,6 +8363,7 @@ case OP_VFilter: { /* jump, ncycle */ /* Invoke the xFilter method */ apArg = p->apArg; + assert( nArg<=p->napArg ); for(i = 0; ivtabOnConflict; apArg = p->apArg; pX = &aMem[pOp->p3]; + assert( nArg<=p->napArg ); for(i=0; ipParse; int *aLabel = pParse->aLabel; @@ -916,15 +916,19 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ } #ifndef SQLITE_OMIT_VIRTUALTABLE case OP_VUpdate: { - if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2; + if( pOp->p2>nMaxVtabArgs ) nMaxVtabArgs = pOp->p2; break; } case OP_VFilter: { int n; + /* The instruction immediately prior to VFilter will be an + ** OP_Integer that sets the "argc" value for the VFilter. See + ** the code where OP_VFilter is generated at tag-20250207a. */ assert( (pOp - p->aOp) >= 3 ); assert( pOp[-1].opcode==OP_Integer ); + assert( pOp[-1].p2==pOp->p3+1 ); n = pOp[-1].p1; - if( n>nMaxArgs ) nMaxArgs = n; + if( n>nMaxVtabArgs ) nMaxVtabArgs = n; /* Fall through into the default case */ /* no break */ deliberate_fall_through } @@ -965,7 +969,7 @@ resolve_p2_values_loop_exit: pParse->aLabel = 0; } pParse->nLabel = 0; - *pMaxFuncArgs = nMaxArgs; + *pMaxVtabArgs = nMaxVtabArgs; assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) ); } @@ -2643,7 +2647,7 @@ void sqlite3VdbeMakeReady( int nVar; /* Number of parameters */ int nMem; /* Number of VM memory registers */ int nCursor; /* Number of cursors required */ - int nArg; /* Number of arguments in subprograms */ + int nArg; /* Max number args to xFilter or xUpdate */ int n; /* Loop counter */ struct ReusableSpace x; /* Reusable bulk memory */ @@ -2715,6 +2719,9 @@ void sqlite3VdbeMakeReady( p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*)); } } +#ifdef SQLITE_DEBUG + p->napArg = nArg; +#endif if( db->mallocFailed ){ p->nVar = 0; diff --git a/src/wherecode.c b/src/wherecode.c index 045653aac8..1a0cdc6d71 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1608,6 +1608,9 @@ Bitmask sqlite3WhereCodeOneLoopStart( } sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); + /* The instruction immediately prior to OP_VFilter must be an OP_Integer + ** that sets the "argc" value for xVFilter. This is necessary for + ** resolveP2() to work correctly. See tag-20250207a. */ sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, pLoop->u.vtab.idxStr, pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC); From 7df570421c5522fff619ac526d27f8d16a4ad247 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 7 Feb 2025 19:18:20 +0000 Subject: [PATCH 13/72] build: work around a report of (install -d DIR) failing in one environment if DIR already exists. FossilOrigin-Name: 8f7b7840d48c391d43ac034ebfee9227dc1c2800adda24f02f3d3bb942f4380e --- autoconf/Makefile.in | 3 ++- main.mk | 3 ++- manifest | 17 +++++++++-------- manifest.uuid | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 0270b9a1db..b41c03e76c 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -86,7 +86,8 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - $(INSTALL) -d "$@" + if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi +# ^^^^ on some platforms, install -d fails if the target already exists. # diff --git a/main.mk b/main.mk index 38d1ba5f56..27b8848879 100644 --- a/main.mk +++ b/main.mk @@ -435,7 +435,8 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - $(INSTALL) -d "$@" + if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi +# ^^^^ on some platforms, install -d fails if the target already exists. # # After jimsh is compiled, we run some sanity checks to ensure that diff --git a/manifest b/manifest index 23bd8c8395..7e646eaf0b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scomments\son\sthe\sParse.nMaxArgs\sfield\sso\sthat\sthey\sare\scorrect.\s\sAdd\nassert()s\sto\sensure\sthey\sare\scorrect.\s\sOther\sParse\schanges\sto\sreduce\sthe\namount\sof\smemset()\sneeded\sto\sinitialize\sit. -D 2025-02-07T19:09:20.404 +C build:\swork\saround\sa\sreport\sof\s(install\s-d\sDIR)\sfailing\sin\sone\senvironment\sif\sDIR\salready\sexists. +D 2025-02-07T19:18:20.610 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in be23c54eef87e6a64d875f96f6cf60a871219c50b04a955ebbd1aac48b4c738e +F autoconf/Makefile.in ee765abbb5de7281932f8ea14123cd5a854a05cab692f39626af89a371bee81f F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 70e140c6825aef1ac94c879db7db188be461db15d40e4d9cd9b3e444c2868e21 +F main.mk 0e3695222412c9388d8e7db612249cd0cd02722c62a16c48be7c77a7639628a8 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2209,8 +2209,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b -R 07888caf6f9e73972781470e8ad03e81 -U drh -Z 434b297f89532d0b5b94eab3e74d43a4 +P c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c +Q +4bc6fe30c967e4f15e2c154a1af5434bfecd89cab0e4d040a5bf68c8ce47a546 +R 7551ae18ae903d03005b95f880daf40a +U stephan +Z 025070a553bc5509ae846762654dc19b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fb16c00a62..5455a6525b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c +8f7b7840d48c391d43ac034ebfee9227dc1c2800adda24f02f3d3bb942f4380e From f62d053b49c287544c9b807cf9a067b7dca252fa Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 8 Feb 2025 11:15:41 +0000 Subject: [PATCH 14/72] Improvements to the hash table used to store symbols in the schema, so that it works better (requires fewer calls to sqlite3StrICmp()) for large schemas, and uses less code space. FossilOrigin-Name: 0318b68c845c84eded757c67f820e1783551574ac9e5670be640c4bfe22a934b --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/hash.c | 43 +++++++++++++++++++++++-------------------- src/hash.h | 1 + 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/manifest b/manifest index 23bd8c8395..dedc3aa948 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scomments\son\sthe\sParse.nMaxArgs\sfield\sso\sthat\sthey\sare\scorrect.\s\sAdd\nassert()s\sto\sensure\sthey\sare\scorrect.\s\sOther\sParse\schanges\sto\sreduce\sthe\namount\sof\smemset()\sneeded\sto\sinitialize\sit. -D 2025-02-07T19:09:20.404 +C Improvements\sto\sthe\shash\stable\sused\sto\sstore\ssymbols\sin\sthe\sschema,\sso\sthat\nit\sworks\sbetter\s(requires\sfewer\scalls\sto\ssqlite3StrICmp())\sfor\slarge\sschemas,\nand\suses\sless\scode\sspace. +D 2025-02-08T11:15:41.775 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -735,8 +735,8 @@ F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c 0712a5b03fdfc8af0cda6d076bfe231b66388d3d5a28b46dc1a94b90d41cac6a F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b -F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 -F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 +F src/hash.c ab8e8cf8733ccef6fd00831fff56a0fbdfa886505c08778338b8d0dc2f9d003d +F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c ccadada52dc508ab8229e343425ab2504db57cfcdf8271f0f9ce1c2c6cad97c1 @@ -2209,8 +2209,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b -R 07888caf6f9e73972781470e8ad03e81 +P c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c +R 51c0e52e763f3a11eebcce49c33f5a3b +T *branch * hash-improvements +T *sym-hash-improvements * +T -sym-trunk * U drh -Z 434b297f89532d0b5b94eab3e74d43a4 +Z 9b37fd3883a56be3a46fd4cef0eab379 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fb16c00a62..764f1c6d8a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c +0318b68c845c84eded757c67f820e1783551574ac9e5670be640c4bfe22a934b diff --git a/src/hash.c b/src/hash.c index 8ec043f119..c822cb5f1f 100644 --- a/src/hash.c +++ b/src/hash.c @@ -55,11 +55,19 @@ void sqlite3HashClear(Hash *pH){ static unsigned int strHash(const char *z){ unsigned int h = 0; unsigned char c; - while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/ + while( z[0] ){ /*OPTIMIZATION-IF-TRUE*/ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). ** 0x9e3779b1 is 2654435761 which is the closest prime number to - ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */ - h += sqlite3UpperToLower[c]; + ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. + ** + ** Only bits 0xdf for ASCII and bits 0xbf for EBCDIC each octet are + ** hashed since the omitted bits determine the upper/lower case difference. + */ +#ifdef SQLITE_EBCDIC + h += 0xbf & (unsigned char)*(z++); +#else + h += 0xdf & (unsigned char)*(z++); +#endif h *= 0x9e3779b1; } return h; @@ -132,9 +140,8 @@ static int rehash(Hash *pH, unsigned int new_size){ pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht); memset(new_ht, 0, new_size*sizeof(struct _ht)); for(elem=pH->first, pH->first=0; elem; elem = next_elem){ - unsigned int h = strHash(elem->pKey) % new_size; next_elem = elem->next; - insertElement(pH, &new_ht[h], elem); + insertElement(pH, &new_ht[elem->h % new_size], elem); } return 1; } @@ -154,21 +161,20 @@ static HashElem *findElementWithHash( unsigned int h; /* The computed hash */ static HashElem nullElement = { 0, 0, 0, 0 }; + h = strHash(pKey); if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/ struct _ht *pEntry; - h = strHash(pKey) % pH->htsize; - pEntry = &pH->ht[h]; + pEntry = &pH->ht[h % pH->htsize]; elem = pEntry->chain; count = pEntry->count; }else{ - h = 0; elem = pH->first; count = pH->count; } if( pHash ) *pHash = h; while( count ){ assert( elem!=0 ); - if( sqlite3StrICmp(elem->pKey,pKey)==0 ){ + if( h==elem->h && sqlite3StrICmp(elem->pKey,pKey)==0 ){ return elem; } elem = elem->next; @@ -180,10 +186,9 @@ static HashElem *findElementWithHash( /* Remove a single entry from the hash table given a pointer to that ** element and a hash on the element's key. */ -static void removeElementGivenHash( +static void removeElement( Hash *pH, /* The pH containing "elem" */ - HashElem* elem, /* The element to be removed from the pH */ - unsigned int h /* Hash value for the element */ + HashElem *elem /* The element to be removed from the pH */ ){ struct _ht *pEntry; if( elem->prev ){ @@ -195,7 +200,7 @@ static void removeElementGivenHash( elem->next->prev = elem->prev; } if( pH->ht ){ - pEntry = &pH->ht[h]; + pEntry = &pH->ht[elem->h % pH->htsize]; if( pEntry->chain==elem ){ pEntry->chain = elem->next; } @@ -246,7 +251,7 @@ void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){ if( elem->data ){ void *old_data = elem->data; if( data==0 ){ - removeElementGivenHash(pH,elem,h); + removeElement(pH,elem); }else{ elem->data = data; elem->pKey = pKey; @@ -257,14 +262,12 @@ void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){ new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) ); if( new_elem==0 ) return data; new_elem->pKey = pKey; + new_elem->h = h; new_elem->data = data; pH->count++; - if( pH->count>=10 && pH->count > 2*pH->htsize ){ - if( rehash(pH, pH->count*2) ){ - assert( pH->htsize>0 ); - h = strHash(pKey) % pH->htsize; - } + if( pH->count>=5 && pH->count > 2*pH->htsize ){ + rehash(pH, pH->count*3); } - insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem); + insertElement(pH, pH->ht ? &pH->ht[new_elem->h % pH->htsize] : 0, new_elem); return 0; } diff --git a/src/hash.h b/src/hash.h index 3f491e45c0..cff65d6e50 100644 --- a/src/hash.h +++ b/src/hash.h @@ -60,6 +60,7 @@ struct HashElem { HashElem *next, *prev; /* Next and previous elements in the table */ void *data; /* Data associated with this element */ const char *pKey; /* Key associated with this element */ + unsigned int h; /* hash for pKey */ }; /* From 03c65171b8ff533b28927a1e5fb7939b87077de0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 8 Feb 2025 13:34:19 +0000 Subject: [PATCH 15/72] Fix GCC-isms and compiler warnings introduced by recent check-ins [c56092507c967230] and [6e57848fe1e0e2b5]. FossilOrigin-Name: 91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636 --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/hash.c | 3 +-- src/sqliteInt.h | 13 +++++++++---- src/vdbeInt.h | 4 ---- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index dba09df8c1..910bb3ea65 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\ssymbol\stable\shash:\sfaster\slookups\swith\sfewer\scalls\sto\nsqlite3StrICmp()\sfor\sschemas\swith\smany\ssymbols\sand\slarge\snames. -D 2025-02-08T12:04:25.764 +C Fix\sGCC-isms\sand\scompiler\swarnings\sintroduced\sby\srecent\scheck-ins\n[c56092507c967230]\sand\s[6e57848fe1e0e2b5]. +D 2025-02-08T13:34:19.496 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -735,7 +735,7 @@ F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c 0712a5b03fdfc8af0cda6d076bfe231b66388d3d5a28b46dc1a94b90d41cac6a F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b -F src/hash.c ab8e8cf8733ccef6fd00831fff56a0fbdfa886505c08778338b8d0dc2f9d003d +F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 @@ -785,7 +785,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h f576f21641e8667779424003e552e79a3d3c7e824421f954ef73fce44040581c +F src/sqliteInt.h 7585b45f585c82f803ab89ccd475819c6dfb9eae0dc2afcae62c9d894137e0e8 F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -851,7 +851,7 @@ F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 -F src/vdbeInt.h 7abc3ce9732fd487ee2544b478ac0526dca443d6d470fc34784d3122d378cf3e +F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b F src/vdbeblob.c 255be187436da38b01f276c02e6a08103489bbe2a7c6c21537b7aecbe0e1f797 @@ -2209,9 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8f7b7840d48c391d43ac034ebfee9227dc1c2800adda24f02f3d3bb942f4380e 0318b68c845c84eded757c67f820e1783551574ac9e5670be640c4bfe22a934b -R 50206c8b661a5653165b14de78589549 -T +closed 0318b68c845c84eded757c67f820e1783551574ac9e5670be640c4bfe22a934b +P 6e57848fe1e0e2b533dd65c2bc5fbac660202cf91cb94ac5468a3434e367a087 +R 2c411617d97350770bd64ca35d94ddfa U drh -Z 088e4d406ab0098b87fcdd617d96f661 +Z 8dddf39b318eaf54797fe9748f81eadf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9320ac90f4..c4ad2d2b75 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6e57848fe1e0e2b533dd65c2bc5fbac660202cf91cb94ac5468a3434e367a087 +91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636 diff --git a/src/hash.c b/src/hash.c index c822cb5f1f..8cc6c09663 100644 --- a/src/hash.c +++ b/src/hash.c @@ -54,7 +54,6 @@ void sqlite3HashClear(Hash *pH){ */ static unsigned int strHash(const char *z){ unsigned int h = 0; - unsigned char c; while( z[0] ){ /*OPTIMIZATION-IF-TRUE*/ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). ** 0x9e3779b1 is 2654435761 which is the closest prime number to @@ -159,7 +158,7 @@ static HashElem *findElementWithHash( HashElem *elem; /* Used to loop thru the element list */ unsigned int count; /* Number of elements left to test */ unsigned int h; /* The computed hash */ - static HashElem nullElement = { 0, 0, 0, 0 }; + static HashElem nullElement = { 0, 0, 0, 0, 0 }; h = strHash(pKey); if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 359ed1b6b1..e46744a129 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -843,6 +843,11 @@ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef INT8_TYPE i8; /* 1-byte signed integer */ +/* A bitfield type for use inside of structures. Always follow with :N where +** N is the number of bits. +*/ +typedef unsigned bft; /* Bit Field Type */ + /* ** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value ** that can be stored in a u32 without loss of data. The value @@ -3845,10 +3850,10 @@ struct Parse { u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER) ** and ALTER TABLE ADD COLUMN. */ #endif - u8 colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */ - u8 bHasWith :1; /* True if statement contains WITH */ - u8 okConstFactor :1; /* OK to factor out constants */ - u8 checkSchema :1; /* Causes schema cookie check after an error */ + bft colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */ + bft bHasWith :1; /* True if statement contains WITH */ + bft okConstFactor :1; /* OK to factor out constants */ + bft checkSchema :1; /* Causes schema cookie check after an error */ int nRangeReg; /* Size of the temporary register block */ int iRangeReg; /* First register in temporary register block */ int nErr; /* Number of errors seen */ diff --git a/src/vdbeInt.h b/src/vdbeInt.h index ecc757dd0d..12af827268 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -398,10 +398,6 @@ struct sqlite3_context { sqlite3_value *argv[1]; /* Argument set */ }; -/* A bitfield type for use inside of structures. Always follow with :N where -** N is the number of bits. -*/ -typedef unsigned bft; /* Bit Field Type */ /* The ScanStatus object holds a single value for the ** sqlite3_stmt_scanstatus() interface. From 9d90a3af2fa1108ee3c914f9cb5b602bfb04949d Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 8 Feb 2025 14:15:42 +0000 Subject: [PATCH 16/72] Use the sqlite3ColumnIndex() routine to look up a column in a table, rather than using a custom loop. Performance improvement, size reduction, and complexity decrease. FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8 --- manifest | 26 +++++++-------- manifest.uuid | 2 +- src/alter.c | 6 ++-- src/build.c | 27 ++++++--------- src/expr.c | 8 +---- src/insert.c | 36 +++++++++----------- src/main.c | 9 ++--- src/resolve.c | 90 ++++++++++++++++++++++---------------------------- src/update.c | 46 +++++++++++--------------- src/vdbeblob.c | 8 ++--- 10 files changed, 106 insertions(+), 152 deletions(-) diff --git a/manifest b/manifest index 910bb3ea65..adfd9058d8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sGCC-isms\sand\scompiler\swarnings\sintroduced\sby\srecent\scheck-ins\n[c56092507c967230]\sand\s[6e57848fe1e0e2b5]. -D 2025-02-08T13:34:19.496 +C Use\sthe\ssqlite3ColumnIndex()\sroutine\sto\slook\sup\sa\scolumn\sin\sa\stable,\srather\nthan\susing\sa\scustom\sloop.\s\sPerformance\simprovement,\ssize\sreduction,\sand\ncomplexity\sdecrease. +D 2025-02-08T14:15:42.707 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -712,7 +712,7 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 -F src/alter.c aa93e37e4a36a0525bbb2a2aeda20d2018f0aa995542c7dc658e031375e3f532 +F src/alter.c 1751e231d8385067fa0d0145f0d461a092db6bd3d7edbfc3172db625aceccd9a F src/analyze.c 0823d2edb3ce564157e9d62714cc729027933209b712e95fbabb23e47fff0aec F src/attach.c 3a5cb9ee4aad6c5b22268287340a4f2f7b07959b7a522201be30fee23cd802e9 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc @@ -722,7 +722,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c cac3aa87f3bf137e12c77194150fb05c949d36a12177fd3acccdaa3669ca9744 +F src/build.c 48796a45299dbdf6331bc1bf2eb5319330980f469c1eaaed17d487a381cea488 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b @@ -730,7 +730,7 @@ F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c 8705be31ee713aaa43c97d91399db09f16ee41b88250406eb99de6b47f550a98 +F src/expr.c 15fabfb67261e298a39fe61457f3cfa24148d9ca8d02f4dff385feb5cf523ea7 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c 0712a5b03fdfc8af0cda6d076bfe231b66388d3d5a28b46dc1a94b90d41cac6a @@ -739,11 +739,11 @@ F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c ccadada52dc508ab8229e343425ab2504db57cfcdf8271f0f9ce1c2c6cad97c1 +F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 F src/json.c 68a98c020c22127f2d65f08855f7fc7460ff352a6ce0b543d8931dde83319c22 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 -F src/main.c 59bdd8d9bbdb3a746eaef14d611ddd5638aa18acef7c5e3271e815dbd215a1af +F src/main.c b99d15d843f7a86adbec855de77b1656dde07359722ef63a9d9393678dbb58d1 F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -778,7 +778,7 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68 +F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 83e88fbb36f89b6703b348777491619554f0fd6f917c9fdf51e4c2e9cda6c04e F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 @@ -844,7 +844,7 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 375a772e2342274f4bf73605a70633237da09deed00a9bf4c4816a56777ea7c9 F src/treeview.c d85ce76e6d1498d781957c07cb234da6d77ce0ed2d196480d516f54dabc62279 F src/trigger.c da3c25786870d8bf97cd46b493374c2375d1abaf20a9b0f5f8629a3f2f2ce383 -F src/update.c 0e01aa6a3edf9ec112b33eb714b9016a81241497b1fb7c3e74332f4f71756508 +F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850 @@ -854,7 +854,7 @@ F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b -F src/vdbeblob.c 255be187436da38b01f276c02e6a08103489bbe2a7c6c21537b7aecbe0e1f797 +F src/vdbeblob.c 9166b6eb7054e5da82e35255892fb1ed551355a4716452539e8e3ac14f25fbe3 F src/vdbemem.c 977438546df236c6a3e7d8b4fe86c0643c13b89b00235db1f11c3a91a4796d30 F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6e57848fe1e0e2b533dd65c2bc5fbac660202cf91cb94ac5468a3434e367a087 -R 2c411617d97350770bd64ca35d94ddfa +P 91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636 +R 3617bbdf30502e1c991c0fb4581bc1ec U drh -Z 8dddf39b318eaf54797fe9748f81eadf +Z 863c9742465b0aa338b6dd538c7f9637 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c4ad2d2b75..a40ac617bb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636 +351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8 diff --git a/src/alter.c b/src/alter.c index ff20757589..5f706b513f 100644 --- a/src/alter.c +++ b/src/alter.c @@ -632,10 +632,8 @@ void sqlite3AlterRenameColumn( ** altered. Set iCol to be the index of the column being renamed */ zOld = sqlite3NameFromToken(db, pOld); if( !zOld ) goto exit_rename_column; - for(iCol=0; iColnCol; iCol++){ - if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break; - } - if( iCol==pTab->nCol ){ + iCol = sqlite3ColumnIndex(pTab, zOld); + if( iCol<0 ){ sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pOld); goto exit_rename_column; } diff --git a/src/build.c b/src/build.c index 986107f48d..2e28af2d1f 100644 --- a/src/build.c +++ b/src/build.c @@ -1473,7 +1473,6 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ char *zType; Column *pCol; sqlite3 *db = pParse->db; - u8 hName; Column *aNew; u8 eType = COLTYPE_CUSTOM; u8 szEst = 1; @@ -1527,13 +1526,11 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ memcpy(z, sName.z, sName.n); z[sName.n] = 0; sqlite3Dequote(z); - hName = sqlite3StrIHash(z); - for(i=0; inCol; i++){ - if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zCnName)==0 ){ - sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); - sqlite3DbFree(db, z); - return; - } + i = sqlite3ColumnIndex(p, z); + if( i>=0 ){ + sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); + sqlite3DbFree(db, z); + return; } aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0])); if( aNew==0 ){ @@ -1544,7 +1541,7 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ pCol = &p->aCol[p->nCol]; memset(pCol, 0, sizeof(p->aCol[0])); pCol->zCnName = z; - pCol->hName = hName; + pCol->hName = sqlite3StrIHash(z); sqlite3ColumnPropertiesFromName(p, pCol); if( sType.n==0 ){ @@ -1835,15 +1832,11 @@ void sqlite3AddPrimaryKey( assert( pCExpr!=0 ); sqlite3StringToId(pCExpr); if( pCExpr->op==TK_ID ){ - const char *zCName; assert( !ExprHasProperty(pCExpr, EP_IntValue) ); - zCName = pCExpr->u.zToken; - for(iCol=0; iColnCol; iCol++){ - if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zCnName)==0 ){ - pCol = &pTab->aCol[iCol]; - makeColumnPartOfPrimaryKey(pParse, pCol); - break; - } + iCol = sqlite3ColumnIndex(pTab, pCExpr->u.zToken); + if( iCol>=0 ){ + pCol = &pTab->aCol[iCol]; + makeColumnPartOfPrimaryKey(pParse, pCol); } } } diff --git a/src/expr.c b/src/expr.c index 8f898a1e3b..df47e34593 100644 --- a/src/expr.c +++ b/src/expr.c @@ -2966,13 +2966,7 @@ const char *sqlite3RowidAlias(Table *pTab){ int ii; assert( VisibleRowid(pTab) ); for(ii=0; iinCol; iCol++){ - if( sqlite3_stricmp(azOpt[ii], pTab->aCol[iCol].zCnName)==0 ) break; - } - if( iCol==pTab->nCol ){ - return azOpt[ii]; - } + if( sqlite3ColumnIndex(pTab, azOpt[ii])<0 ) return azOpt[ii]; } return 0; } diff --git a/src/insert.c b/src/insert.c index e2d910fce4..c1ca1897ed 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1075,28 +1075,22 @@ void sqlite3Insert( aTabColMap = sqlite3DbMallocZero(db, pTab->nCol*sizeof(int)); if( aTabColMap==0 ) goto insert_cleanup; for(i=0; inId; i++){ - const char *zCName = pColumn->a[i].zName; - u8 hName = sqlite3StrIHash(zCName); - for(j=0; jnCol; j++){ - if( pTab->aCol[j].hName!=hName ) continue; - if( sqlite3StrICmp(zCName, pTab->aCol[j].zCnName)==0 ){ - if( aTabColMap[j]==0 ) aTabColMap[j] = i+1; - if( i!=j ) bIdListInOrder = 0; - if( j==pTab->iPKey ){ - ipkColumn = i; assert( !withoutRowid ); - } -#ifndef SQLITE_OMIT_GENERATED_COLUMNS - if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ - sqlite3ErrorMsg(pParse, - "cannot INSERT into generated column \"%s\"", - pTab->aCol[j].zCnName); - goto insert_cleanup; - } -#endif - break; + j = sqlite3ColumnIndex(pTab, pColumn->a[i].zName); + if( j>=0 ){ + if( aTabColMap[j]==0 ) aTabColMap[j] = i+1; + if( i!=j ) bIdListInOrder = 0; + if( j==pTab->iPKey ){ + ipkColumn = i; assert( !withoutRowid ); } - } - if( j>=pTab->nCol ){ +#ifndef SQLITE_OMIT_GENERATED_COLUMNS + if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ + sqlite3ErrorMsg(pParse, + "cannot INSERT into generated column \"%s\"", + pTab->aCol[j].zCnName); + goto insert_cleanup; + } +#endif + }else{ if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ ipkColumn = i; bIdListInOrder = 0; diff --git a/src/main.c b/src/main.c index 6a9d03d87c..17d0cd434a 100644 --- a/src/main.c +++ b/src/main.c @@ -3943,13 +3943,10 @@ int sqlite3_table_column_metadata( if( zColumnName==0 ){ /* Query for existence of table only */ }else{ - for(iCol=0; iColnCol; iCol++){ + iCol = sqlite3ColumnIndex(pTab, zColumnName); + if( iCol>=0 ){ pCol = &pTab->aCol[iCol]; - if( 0==sqlite3StrICmp(pCol->zCnName, zColumnName) ){ - break; - } - } - if( iCol==pTab->nCol ){ + }else{ if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){ iCol = pTab->iPKey; pCol = iCol>=0 ? &pTab->aCol[iCol] : 0; diff --git a/src/resolve.c b/src/resolve.c index d6a5144af8..54ce4fb1ea 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -294,7 +294,6 @@ static int lookupName( Schema *pSchema = 0; /* Schema of the expression */ int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */ Table *pTab = 0; /* Table holding the row */ - Column *pCol; /* A column of pTab */ ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */ const char *zCol = pRight->u.zToken; @@ -345,7 +344,6 @@ static int lookupName( if( pSrcList ){ for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){ - u8 hCol; pTab = pItem->pSTab; assert( pTab!=0 && pTab->zName!=0 ); assert( pTab->nCol>0 || pParse->nErr ); @@ -433,43 +431,38 @@ static int lookupName( sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab); } } - hCol = sqlite3StrIHash(zCol); - for(j=0, pCol=pTab->aCol; jnCol; j++, pCol++){ - if( pCol->hName==hCol - && sqlite3StrICmp(pCol->zCnName, zCol)==0 - ){ - if( cnt>0 ){ - if( pItem->fg.isUsing==0 - || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 - ){ - /* Two or more tables have the same column name which is - ** not joined by USING. This is an error. Signal as much - ** by clearing pFJMatch and letting cnt go above 1. */ - sqlite3ExprListDelete(db, pFJMatch); - pFJMatch = 0; - }else - if( (pItem->fg.jointype & JT_RIGHT)==0 ){ - /* An INNER or LEFT JOIN. Use the left-most table */ - continue; - }else - if( (pItem->fg.jointype & JT_LEFT)==0 ){ - /* A RIGHT JOIN. Use the right-most table */ - cnt = 0; - sqlite3ExprListDelete(db, pFJMatch); - pFJMatch = 0; - }else{ - /* For a FULL JOIN, we must construct a coalesce() func */ - extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); - } + j = sqlite3ColumnIndex(pTab, zCol); + if( j>=0 ){ + if( cnt>0 ){ + if( pItem->fg.isUsing==0 + || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 + ){ + /* Two or more tables have the same column name which is + ** not joined by USING. This is an error. Signal as much + ** by clearing pFJMatch and letting cnt go above 1. */ + sqlite3ExprListDelete(db, pFJMatch); + pFJMatch = 0; + }else + if( (pItem->fg.jointype & JT_RIGHT)==0 ){ + /* An INNER or LEFT JOIN. Use the left-most table */ + continue; + }else + if( (pItem->fg.jointype & JT_LEFT)==0 ){ + /* A RIGHT JOIN. Use the right-most table */ + cnt = 0; + sqlite3ExprListDelete(db, pFJMatch); + pFJMatch = 0; + }else{ + /* For a FULL JOIN, we must construct a coalesce() func */ + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); } - cnt++; - pMatch = pItem; - /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ - pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j; - if( pItem->fg.isNestedFrom ){ - sqlite3SrcItemColumnUsed(pItem, j); - } - break; + } + cnt++; + pMatch = pItem; + /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ + pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j; + if( pItem->fg.isNestedFrom ){ + sqlite3SrcItemColumnUsed(pItem, j); } } if( 0==cnt && VisibleRowid(pTab) ){ @@ -559,23 +552,18 @@ static int lookupName( if( pTab ){ int iCol; - u8 hCol = sqlite3StrIHash(zCol); pSchema = pTab->pSchema; cntTab++; - for(iCol=0, pCol=pTab->aCol; iColnCol; iCol++, pCol++){ - if( pCol->hName==hCol - && sqlite3StrICmp(pCol->zCnName, zCol)==0 - ){ - if( iCol==pTab->iPKey ){ - iCol = -1; - } - break; + iCol = sqlite3ColumnIndex(pTab, zCol); + if( iCol>=0 ){ + if( pTab->iPKey==iCol ) iCol = -1; + }else{ + if( sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ + iCol = -1; + }else{ + iCol = pTab->nCol; } } - if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ - /* IMP: R-51414-32910 */ - iCol = -1; - } if( iColnCol ){ cnt++; pMatch = 0; diff --git a/src/update.c b/src/update.c index a8e7f77803..979afea1f5 100644 --- a/src/update.c +++ b/src/update.c @@ -465,38 +465,32 @@ void sqlite3Update( */ chngRowid = chngPk = 0; for(i=0; inExpr; i++){ - u8 hCol = sqlite3StrIHash(pChanges->a[i].zEName); /* If this is an UPDATE with a FROM clause, do not resolve expressions ** here. The call to sqlite3Select() below will do that. */ if( nChangeFrom==0 && sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ goto update_cleanup; } - for(j=0; jnCol; j++){ - if( pTab->aCol[j].hName==hCol - && sqlite3StrICmp(pTab->aCol[j].zCnName, pChanges->a[i].zEName)==0 - ){ - if( j==pTab->iPKey ){ - chngRowid = 1; - pRowidExpr = pChanges->a[i].pExpr; - iRowidExpr = i; - }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ - chngPk = 1; - } -#ifndef SQLITE_OMIT_GENERATED_COLUMNS - else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ - testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); - testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); - sqlite3ErrorMsg(pParse, - "cannot UPDATE generated column \"%s\"", - pTab->aCol[j].zCnName); - goto update_cleanup; - } -#endif - aXRef[j] = i; - break; + j = sqlite3ColumnIndex(pTab, pChanges->a[i].zEName); + if( j>=0 ){ + if( j==pTab->iPKey ){ + chngRowid = 1; + pRowidExpr = pChanges->a[i].pExpr; + iRowidExpr = i; + }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ + chngPk = 1; } - } - if( j>=pTab->nCol ){ +#ifndef SQLITE_OMIT_GENERATED_COLUMNS + else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ + testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); + testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); + sqlite3ErrorMsg(pParse, + "cannot UPDATE generated column \"%s\"", + pTab->aCol[j].zCnName); + goto update_cleanup; + } +#endif + aXRef[j] = i; + }else{ if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zEName) ){ j = -1; chngRowid = 1; diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 6cb36da37a..79698d0af4 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -192,12 +192,8 @@ int sqlite3_blob_open( pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName; /* Now search pTab for the exact column. */ - for(iCol=0; iColnCol; iCol++) { - if( sqlite3StrICmp(pTab->aCol[iCol].zCnName, zColumn)==0 ){ - break; - } - } - if( iCol==pTab->nCol ){ + iCol = sqlite3ColumnIndex(pTab, zColumn); + if( iCol<0 ){ sqlite3DbFree(db, zErr); zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn); rc = SQLITE_ERROR; From 66172ceb890bb0e6a03478f02b5603335abdfe1e Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 8 Feb 2025 16:16:08 +0000 Subject: [PATCH 17/72] Put a 16-byte hash table for column names on each Table object, to speed up column name lookups. FossilOrigin-Name: 11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/build.c | 4 ++++ src/select.c | 28 +++++++++++++++++++++++++--- src/sqliteInt.h | 1 + 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index adfd9058d8..66664febff 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sthe\ssqlite3ColumnIndex()\sroutine\sto\slook\sup\sa\scolumn\sin\sa\stable,\srather\nthan\susing\sa\scustom\sloop.\s\sPerformance\simprovement,\ssize\sreduction,\sand\ncomplexity\sdecrease. -D 2025-02-08T14:15:42.707 +C Put\sa\s16-byte\shash\stable\sfor\scolumn\snames\son\seach\sTable\sobject,\sto\sspeed\nup\scolumn\sname\slookups. +D 2025-02-08T16:16:08.621 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -722,7 +722,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 48796a45299dbdf6331bc1bf2eb5319330980f469c1eaaed17d487a381cea488 +F src/build.c 83c43ddb517a15673d1dc17f88ea8cd1db06e0d277e6dc666ac8985017a99ac5 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b @@ -780,12 +780,12 @@ F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 83e88fbb36f89b6703b348777491619554f0fd6f917c9fdf51e4c2e9cda6c04e +F src/select.c 5c8ac3f0b7dd72745719f0137119a6f9016a9c2633a7351ef11c00a43b4c0944 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 7585b45f585c82f803ab89ccd475819c6dfb9eae0dc2afcae62c9d894137e0e8 +F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636 -R 3617bbdf30502e1c991c0fb4581bc1ec +P 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8 +R cda99bdc5b1dd85ef2acf18a1826a5a1 U drh -Z 863c9742465b0aa338b6dd538c7f9637 +Z c5517dc029ab4cf78c2ac97792e86679 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a40ac617bb..c62113f3d6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8 +11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f diff --git a/src/build.c b/src/build.c index 2e28af2d1f..7b80425291 100644 --- a/src/build.c +++ b/src/build.c @@ -1565,6 +1565,10 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ pCol->affinity = sqlite3AffinityType(zType, pCol); pCol->colFlags |= COLFLAG_HASTYPE; } + if( p->nCol<=0xff ){ + u8 h = pCol->hName % sizeof(p->aHx); + p->aHx[h] = p->nCol; + } p->nCol++; p->nNVCol++; assert( pParse->isCreate ); diff --git a/src/select.c b/src/select.c index cf25c8e678..e848c46a39 100644 --- a/src/select.c +++ b/src/select.c @@ -319,10 +319,32 @@ int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ */ int sqlite3ColumnIndex(Table *pTab, const char *zCol){ int i; - u8 h = sqlite3StrIHash(zCol); + u8 h; Column *pCol; - for(pCol=pTab->aCol, i=0; inCol; pCol++, i++){ - if( pCol->hName==h && sqlite3StrICmp(pCol->zCnName, zCol)==0 ) return i; + + if( pTab->nCol==0 ){ + return -1; + } + h = sqlite3StrIHash(zCol); + + i = pTab->aHx[h % sizeof(pTab->aHx)]; + assert( inCol ); + if( pTab->aCol[i].hName==h + && sqlite3StrICmp(pTab->aCol[i].zCnName, zCol)==0 + ){ + return i; + } + pCol = pTab->aCol; + i = 0; + while( 1 /*exit-by-break*/ ){ + if( pCol->hName==h + && sqlite3StrICmp(pCol->zCnName, zCol)==0 + ){ + return i; + } + i++; + if( i>=pTab->nCol ) break; + pCol++; } return -1; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index e46744a129..c8ecaf8571 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2431,6 +2431,7 @@ struct Table { } u; Trigger *pTrigger; /* List of triggers on this object */ Schema *pSchema; /* Schema that contains this table */ + u8 aHx[16]; /* Column aHt[K%sizeof(aHt)] might have hash K */ }; /* From 5b0b8653b665a02686d80ec67f0d93de522f82e5 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 9 Feb 2025 00:54:56 +0000 Subject: [PATCH 18/72] Add the "star" testset to speedtest1. Include it as part of "mix1". FossilOrigin-Name: f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597 --- manifest | 12 ++--- manifest.uuid | 2 +- test/speedtest1.c | 120 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 122 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 66664febff..a6ff85864c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Put\sa\s16-byte\shash\stable\sfor\scolumn\snames\son\seach\sTable\sobject,\sto\sspeed\nup\scolumn\sname\slookups. -D 2025-02-08T16:16:08.621 +C Add\sthe\s"star"\stestset\sto\sspeedtest1.\s\sInclude\sit\sas\spart\sof\s"mix1". +D 2025-02-09T00:54:56.995 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1681,7 +1681,7 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x -F test/speedtest1.c 204acd8af326bbca2c28f68166635d4574381f4cabbac1bc243663f5dcc5051d +F test/speedtest1.c ef340d391366afc875d11fc59332601c470154352b0db836b2cba813999a8fb4 F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8 -R cda99bdc5b1dd85ef2acf18a1826a5a1 +P 11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f +R 1a1bec3385a102a8e6f260d5d8c260d8 U drh -Z c5517dc029ab4cf78c2ac97792e86679 +Z 34712e1b605bf59fda97cb6a7434984c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c62113f3d6..ac22274f1b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f +f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597 diff --git a/test/speedtest1.c b/test/speedtest1.c index 9d8ddc4545..c6d5fd4a10 100644 --- a/test/speedtest1.c +++ b/test/speedtest1.c @@ -64,10 +64,9 @@ static const char zHelp[] = " --stats Show statistics at the end\n" " --stmtscanstatus Activate SQLITE_DBCONFIG_STMT_SCANSTATUS\n" " --temp N N from 0 to 9. 0: no temp table. 9: all temp tables\n" - " --testset T Run test-set T (main, cte, rtree, orm, fp, json," - " debug)\n" - " Can be a comma-separated list of values, with /SCALE\n" - " suffixes or macro \"mix1\"\n" + " --testset T Run test-set T (main, cte, rtree, orm, fp, json,\n" + " star, debug). Can be a comma-separated list of\n" + " values, with /SCALE suffixes or macro \"mix1\"\n" " --trace Turn on SQL tracing\n" " --threads N Use up to N threads for sorting\n" " --utf16be Set text encoding to UTF-16BE\n" @@ -1458,6 +1457,114 @@ void testset_fp(void){ speedtest1_end_test(); } +/* +** A testset for star-schema queries. +*/ +void testset_star(void){ + int n; + int i; + n = g.szTest*50; + speedtest1_begin_test(100, "Create a fact table with %d entries", n); + speedtest1_exec( + "CREATE TABLE facttab(" + " attr01 INT," + " attr02 INT," + " attr03 INT," + " data01 TEXT," + " attr04 INT," + " attr05 INT," + " attr06 INT," + " attr07 INT," + " attr08 INT," + " factid INTEGER PRIMARY KEY," + " data02 TEXT" + ");" + ); + speedtest1_exec( + "WITH RECURSIVE counter(nnn) AS" + "(VALUES(1) UNION ALL SELECT nnn+1 FROM counter WHERE nnn<%d)" + "INSERT INTO facttab(attr01,attr02,attr03,attr04,attr05," + "attr06,attr07,attr08,data01,data02)" + "SELECT random()%%12, random()%%13, random()%%14, random()%%15," + "random()%%16, random()%%17, random()%%18, random()%%19," + "concat('data-',nnn), format('%%x',random()) FROM counter;", + n + ); + speedtest1_end_test(); + + speedtest1_begin_test(110, "Create indexes on all attributes columns"); + for(i=1; i<=8; i++){ + speedtest1_exec( + "CREATE INDEX fact_attr%02d ON facttab(attr%02d)", i, i + ); + } + speedtest1_end_test(); + + speedtest1_begin_test(120, "Create dimension tables"); + for(i=1; i<=8; i++){ + speedtest1_exec( + "CREATE TABLE dimension%02d(" + "beta%02d INT, " + "content%02d TEXT, " + "rate%02d REAL)", + i, i, i, i + ); + speedtest1_exec( + "WITH RECURSIVE ctr(nn) AS" + " (VALUES(1) UNION ALL SELECT nn+1 FROM ctr WHERE nn<%d)" + " INSERT INTO dimension%02d" + " SELECT nn%%(%d), concat('content-%02d-',nn)," + " (random()%%10000)*0.125 FROM ctr;", + 4*(i+1), i, 2*(i+1), i + ); + if( i&2 ){ + speedtest1_exec( + "CREATE INDEX dim%02d ON dimension%02d(beta%02d);", + i, i, i + ); + }else{ + speedtest1_exec( + "CREATE INDEX dim%02d ON dimension%02d(beta%02d,content%02d);", + i, i, i, i + ); + } + } + speedtest1_end_test(); + + speedtest1_begin_test(130, "Star query over the entire fact table"); + speedtest1_exec( + "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)" + " FROM facttab, dimension01, dimension02, dimension03, dimension04," + " dimension05, dimension06, dimension07, dimension08" + " WHERE attr01=beta01" + " AND attr02=beta02" + " AND attr03=beta03" + " AND attr04=beta04" + " AND attr05=beta05" + " AND attr06=beta06" + " AND attr07=beta07" + " AND attr08=beta08" + ";" + ); + speedtest1_end_test(); + + speedtest1_begin_test(130, "Star query with LEFT JOINs"); + speedtest1_exec( + "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)" + " FROM facttab LEFT JOIN dimension01 ON attr01=beta01" + " LEFT JOIN dimension02 ON attr02=beta02" + " JOIN dimension03 ON attr03=beta03" + " JOIN dimension04 ON attr04=beta04" + " JOIN dimension05 ON attr05=beta05" + " LEFT JOIN dimension06 ON attr06=beta06" + " JOIN dimension07 ON attr07=beta07" + " JOIN dimension08 ON attr08=beta08" + " WHERE facttab.data01 LIKE 'data-9%%'" + ";" + ); + speedtest1_end_test(); +} + #ifdef SQLITE_ENABLE_RTREE /* Generate two numbers between 1 and mx. The first number is less than ** the second. Usually the numbers are near each other but can sometimes @@ -2560,7 +2667,8 @@ int main(int argc, char **argv){ } g.eTemp = argv[i][0] - '0'; }else if( strcmp(z,"testset")==0 ){ - static char zMix1Tests[] = "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10"; + static char zMix1Tests[] = + "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star"; ARGC_VALUE_CHECK(1); zTSet = argv[++i]; if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests; @@ -2749,6 +2857,8 @@ int main(int argc, char **argv){ testset_orm(); }else if( strcmp(zThisTest,"cte")==0 ){ testset_cte(); + }else if( strcmp(zThisTest,"star")==0 ){ + testset_star(); }else if( strcmp(zThisTest,"fp")==0 ){ testset_fp(); }else if( strcmp(zThisTest,"json")==0 ){ From 3e06f2d79b15754999892a4ded6a7585520294a6 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 01:25:00 +0000 Subject: [PATCH 19/72] configure: when transfering ENABLE/OMIT flags from CFLAGS to OPT_FEATURE_FLAGS, also do the same for CPPFLAGS and remove those ENABLE/OMIT flags from CFLAGS/CPPFLAGS to mimic legacy build behavior. Strip ENABLE/OMIT flags from BUILD_CFLAGS but do not transfer those to OPT_FEATURE_FLAGS, also to mimic legacy behavior. This is the second part of a fix discussed at [forum:9801e54665afd728|forum post 9801e54665afd728]. FossilOrigin-Name: 16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf --- autosetup/sqlite-config.tcl | 36 ++++++++++++++++++++++++++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index cabb32aac0..2a73548662 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -230,23 +230,47 @@ proc sqlite-setup-default-cflags {} { # BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD. define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] - # Copy all CFLAGS entries matching -DSQLITE_OMIT* and + # Copy all CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived # from the legacy build and was missing the 3.48.0 release (the # initial Autosetup port). # https://sqlite.org/forum/forumpost/9801e54665afd728 # + # Handling of CPPFLAGS, as well as removing ENABLE/OMIT from + # CFLAGS/CPPFLAGS, was missing in the 3.49.0 release as well. + # # If any configure flags for features are in conflict with - # CFLAGS-specified feature flags, all bets are off. There are no - # guarantees about which one will take precedence. - foreach cf [get-define CFLAGS ""] { + # CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There + # are no guarantees about which one will take precedence. + foreach flagDef {CFLAGS CPPFLAGS} { + set tmp "" + foreach cf [get-define $flagDef ""] { + switch -glob -- $cf { + -DSQLITE_OMIT* - + -DSQLITE_ENABLE* { + sqlite-add-feature-flag $cf + } + default { + lappend tmp $cf + } + } + } + define $flagDef $tmp + } + + # Strip all SQLITE_ENABLE/OMIT flags from BUILD_CFLAGS, + # for compatibility with the legacy build. + set tmp "" + foreach cf [get-define BUILD_CFLAGS ""] { switch -glob -- $cf { -DSQLITE_OMIT* - - -DSQLITE_ENABLE* { - sqlite-add-feature-flag $cf + -DSQLITE_ENABLE* {} + default { + lappend tmp $cf } } } + define BUILD_CFLAGS $tmp } ######################################################################## diff --git a/manifest b/manifest index a6ff85864c..3de37a6e66 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"star"\stestset\sto\sspeedtest1.\s\sInclude\sit\sas\spart\sof\s"mix1". -D 2025-02-09T00:54:56.995 +C configure:\swhen\stransfering\sENABLE/OMIT\sflags\sfrom\sCFLAGS\sto\sOPT_FEATURE_FLAGS,\salso\sdo\sthe\ssame\sfor\sCPPFLAGS\sand\sremove\sthose\sENABLE/OMIT\sflags\sfrom\sCFLAGS/CPPFLAGS\sto\smimic\slegacy\sbuild\sbehavior.\sStrip\sENABLE/OMIT\sflags\sfrom\sBUILD_CFLAGS\sbut\sdo\snot\stransfer\sthose\sto\sOPT_FEATURE_FLAGS,\salso\sto\smimic\slegacy\sbehavior.\sThis\sis\sthe\ssecond\spart\sof\sa\sfix\sdiscussed\sat\s[forum:9801e54665afd728|forum\spost\s9801e54665afd728]. +D 2025-02-09T01:25:00.990 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 -F autosetup/sqlite-config.tcl f64aff26763e9ea021aabac222d43a9e0107b45f6de82972b93411fe36ef566b +F autosetup/sqlite-config.tcl d2c6467c557ec0437f2115e94fbe7a77af2d3e6d34b98b8ad85212f5cb890332 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f -R 1a1bec3385a102a8e6f260d5d8c260d8 -U drh -Z 34712e1b605bf59fda97cb6a7434984c +P f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597 +R 303d972057cca0b1b2eb8945cbdc8b8b +U stephan +Z 7b9d892b6b2cefdb6b9041463ba9bb8b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ac22274f1b..db22146b7e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597 +16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf From f85818268965207d7682438132d51195d4e28bf0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 02:41:35 +0000 Subject: [PATCH 20/72] JS: add a mechanism to the Worker1 exec API to fetch the last_insert_rowid(), as requested in [forum:56bc35390183f5d5|forum post 56bc353901]. FossilOrigin-Name: c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9 --- ext/wasm/api/sqlite3-api-worker1.c-pp.js | 25 +++++++++++++++++++----- ext/wasm/demo-worker1-promiser.c-pp.js | 5 ++++- ext/wasm/demo-worker1.js | 5 ++++- manifest | 16 +++++++-------- manifest.uuid | 2 +- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-worker1.c-pp.js b/ext/wasm/api/sqlite3-api-worker1.c-pp.js index 9918625459..5e088f4384 100644 --- a/ext/wasm/api/sqlite3-api-worker1.c-pp.js +++ b/ext/wasm/api/sqlite3-api-worker1.c-pp.js @@ -279,11 +279,11 @@ The arguments are in the same form accepted by oo1.DB.exec(), with the exceptions noted below. - If the `countChanges` arguments property (added in version 3.43) is - truthy then the `result` property contained by the returned object - will have a `changeCount` property which holds the number of changes - made by the provided SQL. Because the SQL may contain an arbitrary - number of statements, the `changeCount` is calculated by calling + If `args.countChanges` (added in version 3.43) is truthy then the + `result` property contained by the returned object will have a + `changeCount` property which holds the number of changes made by the + provided SQL. Because the SQL may contain an arbitrary number of + statements, the `changeCount` is calculated by calling `sqlite3_total_changes()` before and after the SQL is evaluated. If the value of `countChanges` is 64 then the `changeCount` property will be returned as a 64-bit integer in the form of a BigInt (noting @@ -292,6 +292,15 @@ calling `sqlite3_total_changes64()` before and after the SQL is evaluated. + If the `args.lastInsertRowId` (added in version 3.50.0) is truthy + then the `result` property contained by the returned object will + have a `lastInsertRowId` will hold a BigInt-type value corresponding + to the result of sqlite3_last_insert_rowid(). This value is only + fetched once, after the SQL is run, regardless of how many + statements the SQL contains. This API has no idea whether the SQL + contains any INSERTs, so it is up to the client to apply/rely on + this property only when it makes sense to do so. + A function-type args.callback property cannot cross the window/Worker boundary, so is not useful here. If args.callback is a string then it is assumed to be a @@ -542,6 +551,12 @@ sqlite3.initWorker1API = function(){ if(undefined !== changeCount){ rc.changeCount = db.changes(true,64===rc.countChanges) - changeCount; } + const lastInsertRowId = !!rc.lastInsertRowId + ? sqlite3.capi.sqlite3_last_insert_rowid(db) + : undefined; + if( undefined!==lastInsertRowId ){ + rc.lastInsertRowId = lastInsertRowId; + } if(rc.callback instanceof Function){ rc.callback = theCallback; /* Post a sentinel message to tell the client that the end diff --git a/ext/wasm/demo-worker1-promiser.c-pp.js b/ext/wasm/demo-worker1-promiser.c-pp.js index f6fc9568ae..0b8557b826 100644 --- a/ext/wasm/demo-worker1-promiser.c-pp.js +++ b/ext/wasm/demo-worker1-promiser.c-pp.js @@ -115,6 +115,7 @@ delete globalThis.sqlite3Worker1Promiser; "insert into t(a,b) values(1,2),(3,4),(5,6)" ].join(';'), resultRows: [], columnNames: [], + lastInsertRowId: true, countChanges: sqConfig.bigIntEnabled ? 64 : true }, function(ev){ ev = ev.result; @@ -122,7 +123,9 @@ delete globalThis.sqlite3Worker1Promiser; .assert(0===ev.columnNames.length) .assert(sqConfig.bigIntEnabled ? (3n===ev.changeCount) - : (3===ev.changeCount)); + : (3===ev.changeCount)) + .assert('bigint'===typeof ev.lastInsertRowId) + .assert(ev.lastInsertRowId>=3); }); await wtest('exec',{ diff --git a/ext/wasm/demo-worker1.js b/ext/wasm/demo-worker1.js index 60f5e8dec0..1a05cc7ac2 100644 --- a/ext/wasm/demo-worker1.js +++ b/ext/wasm/demo-worker1.js @@ -156,11 +156,14 @@ sql: ["create table t(a,b);", "insert into t(a,b) values(1,2),(3,4),(5,6)" ], + lastInsertRowId: true, resultRows: [], columnNames: [] }, function(ev){ ev = ev.result; T.assert(0===ev.resultRows.length) - .assert(0===ev.columnNames.length); + .assert(0===ev.columnNames.length) + .assert('bigint'===typeof ev.lastInsertRowId) + .assert(ev.lastInsertRowId>=3); }); runOneTest('exec',{ sql: 'select a a, b b from t order by a', diff --git a/manifest b/manifest index 3de37a6e66..c61d26c043 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure:\swhen\stransfering\sENABLE/OMIT\sflags\sfrom\sCFLAGS\sto\sOPT_FEATURE_FLAGS,\salso\sdo\sthe\ssame\sfor\sCPPFLAGS\sand\sremove\sthose\sENABLE/OMIT\sflags\sfrom\sCFLAGS/CPPFLAGS\sto\smimic\slegacy\sbuild\sbehavior.\sStrip\sENABLE/OMIT\sflags\sfrom\sBUILD_CFLAGS\sbut\sdo\snot\stransfer\sthose\sto\sOPT_FEATURE_FLAGS,\salso\sto\smimic\slegacy\sbehavior.\sThis\sis\sthe\ssecond\spart\sof\sa\sfix\sdiscussed\sat\s[forum:9801e54665afd728|forum\spost\s9801e54665afd728]. -D 2025-02-09T01:25:00.990 +C JS:\sadd\sa\smechanism\sto\sthe\sWorker1\sexec\sAPI\sto\sfetch\sthe\slast_insert_rowid(),\sas\srequested\sin\s[forum:56bc35390183f5d5|forum\spost\s56bc353901]. +D 2025-02-09T02:41:35.084 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -641,7 +641,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b93954066 F ext/wasm/api/sqlite3-api-glue.c-pp.js 5c0209e6a28164b4c2c1a34b0bb4aee3b7b1a264988d7e71fac08b8ede5b7ae3 F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc5207bf746fc77d59848813225f F ext/wasm/api/sqlite3-api-prologue.js 5ff913355b3144f1c9719d0406667fa6e13eb813c71ed7ce29440e2e65363e82 -F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d27567e63e8bc8b832d74371c352d +F ext/wasm/api/sqlite3-api-worker1.c-pp.js f646a65257973b8c4481f8a6a216370b85644f23e64b126e7ae113570587c0ab F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d @@ -667,9 +667,9 @@ F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32 F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e F ext/wasm/demo-jsstorage.js 44e3ae7ec2483b6c511384c3c290beb6f305c721186bcf5398ca4e00004a06b8 F ext/wasm/demo-worker1-promiser.c-pp.html 635cf90685805e21772a5f7a35d1ace80f98a9ef7c42ff04d7a125ddca7e5db8 -F ext/wasm/demo-worker1-promiser.c-pp.js fcc628cb42fcfaf07d250477801de1e6deb1e319d003976612a0db8d76b9fccc +F ext/wasm/demo-worker1-promiser.c-pp.js af168699d3cab1c27ad2364ebe06cd49db300bdbf404e23b00d5742ed52816ba F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d -F ext/wasm/demo-worker1.js 836bece8615b17b1b572584f7b15912236a5947fe8c68b98d2737d7e287447ef +F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535da776950314 F ext/wasm/dist.make 92ef4ffe33022a50f92d602acabad10bd8dd91759f3eb7df27fc6d7d37072b96 F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f F ext/wasm/fiddle.make d4969f0322a582c57a22ce3541f10a5b09a609d14eab32891f613f43b3c14d8b @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597 -R 303d972057cca0b1b2eb8945cbdc8b8b +P 16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf +R 5520495f3ccea7918b4a343a7efb2785 U stephan -Z 7b9d892b6b2cefdb6b9041463ba9bb8b +Z 1bf6695082490bb2a22dcd9297477549 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index db22146b7e..cfcb1b16c1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf +c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9 From 00bc96c05c9fb6294c4785037e9ad67e72fcf882 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 03:24:00 +0000 Subject: [PATCH 21/72] wasm: when building in -O0 mode (typical dev mode), use -sASSERTIONS=2, else -sASSERTIONS=0, in response [https://github.com/emscripten-core/emscripten/pull/23629/commits/7e3e35cbff9c5688eacb3cddc5045f872d744efd|Emscripten checkin 7e3e35cbff9], which adds assertions to check for the condition reported in [https://github.com/emscripten-core/emscripten/issues/23420|Emscripten ticket 23420]. Update some unrelated JS-side internal docs. FossilOrigin-Name: 1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962 --- ext/wasm/GNUmakefile | 6 ++++++ ext/wasm/api/post-js-header.js | 10 +++++----- ext/wasm/api/sqlite3-api-prologue.js | 12 ++++++------ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 4369635cf2..e18ec074c6 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -619,6 +619,12 @@ emcc.exportedRuntimeMethods := \ emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 emcc.jsflags += -sIMPORTED_MEMORY +ifeq (,$(filter -O0,$(emcc_opt))) +emcc.assert ?= 0 +else +emcc.assert ?= 2 +endif +emcc.jsflags += -sASSERTIONS=$(emcc.assert) emcc.jsflags += -sSTRICT_JS=0 # STRICT_JS disabled due to: # https://github.com/emscripten-core/emscripten/issues/18610 diff --git a/ext/wasm/api/post-js-header.js b/ext/wasm/api/post-js-header.js index a543c14f3a..77e3cd227c 100644 --- a/ext/wasm/api/post-js-header.js +++ b/ext/wasm/api/post-js-header.js @@ -8,16 +8,16 @@ point the sqlite3 JS API bits will get set up. */ Module.runSQLite3PostLoadInit = function(EmscriptenModule/*the Emscripten-style module object*/){ - /** ^^^ As don't use Module.postRun, as that runs a different time + /** ^^^ Don't use Module.postRun, as that runs a different time depending on whether this file is built with emcc 3.1.x or 4.0.x. This function name is intentionally obnoxiously verbose to ensure that we don't collide with current and future Emscripten symbol names. */ 'use strict'; - //console.warn("This is the start of the Module.postRun handler."); + //console.warn("This is the start of Module.runSQLite3PostLoadInit()"); /* This function will contain at least the following: - - post-js-header.js (this file) + - post-js-header.js => this file - sqlite3-api-prologue.js => Bootstrapping bits to attach the rest to - common/whwasmutil.js => Replacements for much of Emscripten's glue - jaccwabyt/jaccwabyt.js => Jaccwabyt (C/JS struct binding) @@ -26,8 +26,8 @@ Module.runSQLite3PostLoadInit = function(EmscriptenModule/*the Emscripten-style - sqlite3-api-worker1.js => Worker-based API - sqlite3-vfs-helper.c-pp.js => Utilities for VFS impls - sqlite3-vtab-helper.c-pp.js => Utilities for virtual table impls - - sqlite3-vfs-opfs.c-pp.js => OPFS VFS + - sqlite3-vfs-opfs.c-pp.js => OPFS VFS - sqlite3-vfs-opfs-sahpool.c-pp.js => OPFS SAHPool VFS - sqlite3-api-cleanup.js => final API cleanup - - post-js-footer.js => closes this postRun() function + - post-js-footer.js => closes this function */ diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index 277efa14ab..6b032be84d 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -12,12 +12,12 @@ This file is intended to be combined at build-time with other related code, most notably a header and footer which wraps this - whole file into an Emscripten Module.postRun()-style handler. The - sqlite3 JS API has no hard requirements on Emscripten and does not - expose any Emscripten APIs to clients. It is structured such that - its build can be tweaked to include it in arbitrary WASM - environments which can supply the necessary underlying features - (e.g. a POSIX file I/O layer). + whole file into a single callback which can be run after Emscripten + loads the corresponding WASM module. The sqlite3 JS API has no hard + requirements on Emscripten and does not expose any Emscripten APIs + to clients. It is structured such that its build can be tweaked to + include it in arbitrary WASM environments which can supply the + necessary underlying features (e.g. a POSIX file I/O layer). Main project home page: https://sqlite.org diff --git a/manifest b/manifest index c61d26c043..5332ffd8f1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JS:\sadd\sa\smechanism\sto\sthe\sWorker1\sexec\sAPI\sto\sfetch\sthe\slast_insert_rowid(),\sas\srequested\sin\s[forum:56bc35390183f5d5|forum\spost\s56bc353901]. -D 2025-02-09T02:41:35.084 +C wasm:\swhen\sbuilding\sin\s-O0\smode\s(typical\sdev\smode),\suse\s-sASSERTIONS=2,\selse\s-sASSERTIONS=0,\sin\sresponse\s[https://github.com/emscripten-core/emscripten/pull/23629/commits/7e3e35cbff9c5688eacb3cddc5045f872d744efd|Emscripten\scheckin\s7e3e35cbff9],\swhich\sadds\sassertions\sto\scheck\sfor\sthe\scondition\sreported\sin\s[https://github.com/emscripten-core/emscripten/issues/23420|Emscripten\sticket\s23420].\sUpdate\ssome\sunrelated\sJS-side\sinternal\sdocs. +D 2025-02-09T03:24:00.963 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile df23a3cb3bfb13f17fc76132a0127a89e2ad64f46b71efee9743929cfd52d441 +F ext/wasm/GNUmakefile 654f27c0735e83c63f541b1964ef0f57423ceb71b05146de90c56b2f534f7b3b F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -635,12 +635,12 @@ F ext/wasm/api/README.md c64ec8e84449c069e0217706d9d7d31b3bd53627228b2ba0c3cddbd F ext/wasm/api/extern-post-js.c-pp.js 3fcd904f1204685dea84e5ae90d8b7e65a1dcebab1e838386d8328b74cce46c9 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90ae151e37fa9f75bf41 -F ext/wasm/api/post-js-header.js 54b2b4294501b3866245cc94315a16f5424c0e87729d0fb610fba151593c6d26 +F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701 F ext/wasm/api/pre-js.c-pp.js a614a2c82b12c4d96d8e3ba77330329efc53c4d56a8a7e60ade900f341866cfb F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359 F ext/wasm/api/sqlite3-api-glue.c-pp.js 5c0209e6a28164b4c2c1a34b0bb4aee3b7b1a264988d7e71fac08b8ede5b7ae3 F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc5207bf746fc77d59848813225f -F ext/wasm/api/sqlite3-api-prologue.js 5ff913355b3144f1c9719d0406667fa6e13eb813c71ed7ce29440e2e65363e82 +F ext/wasm/api/sqlite3-api-prologue.js 9e7d89a2c0d02b8b2052a62757a89f1e7e4dbcc0d9cd3f2dafa896786954dad2 F ext/wasm/api/sqlite3-api-worker1.c-pp.js f646a65257973b8c4481f8a6a216370b85644f23e64b126e7ae113570587c0ab F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 3774befd97cd1a5e2895c8225a894aad946848c6d9b4028acc988b5d123475af @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf -R 5520495f3ccea7918b4a343a7efb2785 +P c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9 +R 28b52c82e3748c1458cec26f6dc126a2 U stephan -Z 1bf6695082490bb2a22dcd9297477549 +Z f11611286d8691d31123798a11e49271 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cfcb1b16c1..5585f98c01 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9 +1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962 From e108f97256c2cc60f21edc171ccfcd5eebdf2865 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 04:16:01 +0000 Subject: [PATCH 22/72] wasm: add some build-time validation to ensure that the problem fixed in [65798c09a00662a3] does not recur. Ensure that files generated via mkwasmbuilds.c have the generated makefile as a dependency. FossilOrigin-Name: 55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005 --- ext/wasm/GNUmakefile | 6 +++--- ext/wasm/mkwasmbuilds.c | 23 +++++++++++++++++------ manifest | 15 ++++++++------- manifest.uuid | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index e18ec074c6..c9852e389c 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -165,7 +165,7 @@ dir.wasmfs := $(dir.dout) MKDIR.bld := $(dir.tmp) $(MKDIR.bld): - -mkdir -p $@ $(dir.dout) + @mkdir -p $@ $(dir.dout) CLEAN_FILES += *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ $(dir.fiddle)/*~ \ $(dir.fiddle-debug)/* $(dir.dout)/* $(dir.tmp)/* @@ -424,8 +424,8 @@ define SQLITE.CALL.C-PP.FILTER # $1 = Input file: c-pp -f $(1).js # $2 = Output file: c-pp -o $(2).js # $3 = optional c-pp -D... flags -$(2): $(1) $$(MAKEFILE) $$(bin.c-pp) - mkdir -p $$(dir $$@) +$(2): $(1) $$(MAKEFILE_LIST) $$(bin.c-pp) + @mkdir -p $$(dir $$@) $$(bin.c-pp) -f $(1) -o $$@ $(3) $(SQLITE.CALL.C-PP.FILTER.global) #CLEAN_FILES += $(2) endef diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index e762b572cd..91c03b6d42 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -151,7 +151,7 @@ static void mk_pre_post(const char *zName /* build name */, /* --pre-js=... */ pf("pre-js.js.%s-%s := $(dir.tmp)/pre-js.%s-%s.js\n", zNM, zNM); - pf("$(pre-js.js.%s-%s): $(MAKEFILE)\n", zNM); + pf("$(pre-js.js.%s-%s): $(MAKEFILE_LIST)\n", zNM); #if 1 pf("$(eval $(call SQLITE.CALL.C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.%s-%s)," "$(c-pp.D.%s-%s)))\n", zNM, zNM); @@ -218,7 +218,7 @@ static void mk_fiddle(){ pf("fiddle-module.js%s := %s/fiddle-module.js\n", zTail, zDir); pf("fiddle-module.wasm%s := " "$(subst .js,.wasm,$(fiddle-module.js%s))\n", zTail, zTail); - pf("$(fiddle-module.js%s):%s $(MAKEFILE) $(MAKEFILE.fiddle) " + pf("$(fiddle-module.js%s):%s $(MAKEFILE_LIST) $(MAKEFILE.fiddle) " "$(EXPORTED_FUNCTIONS.fiddle) " "$(fiddle.cses) $(pre-post-fiddle-module-vanilla.deps) " "$(SOAP.js)\n", @@ -285,7 +285,7 @@ static void mk_lib_mode(const char *zName /* build name */, zApiJsOut, zCmppD); /* target zJsOut */ - pf("%s: %s $(MAKEFILE) $(sqlite3-wasm.cfiles) $(EXPORTED_FUNCTIONS.api) " + pf("%s: %s $(MAKEFILE_LIST) $(sqlite3-wasm.cfiles) $(EXPORTED_FUNCTIONS.api) " "$(pre-post-%s-%s.deps) " "$(sqlite3-api.ext.jses)" /* ^^^ maintenance reminder: we set these as deps so that they @@ -304,9 +304,10 @@ static void mk_lib_mode(const char *zName /* build name */, "\t\t$(cflags.%s) $(cflags.%s.%s) \\\n" "\t\t$(cflags.wasm_extra_init) $(sqlite3-wasm.cfiles)\n", zName, zNM); if( bIsEsm ){ - /* TODO? Replace this CALL with the corresponding makefile code. - ** OTOH, we also use this $(call) in the speedtest1-wasmfs build, - ** which is not part of the rules emitted by this program. */ + /* TODO? Replace this $(call) with the corresponding makefile + ** code. OTOH, we also use this $(call) in the speedtest1-wasmfs + ** build, which is not part of the rules emitted by this + ** program. */ pf("\t@$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,%d)\n", 0==strcmp("sqlite3-wasmfs", zName) ? 1 : 0); } @@ -338,6 +339,16 @@ static void mk_lib_mode(const char *zName /* build name */, /* ^^^^^^ reminder: Mac/BSD sed has no -i flag */ zNM, zName); pf("\t@ls -la $@\n"); + if( 0==strcmp("bundler-friendly", zMode) ){ + /* Avoid a 3rd occurance of the bug fixed by 65798c09a00662a3, + ** which was (in two cases) caused by makefile refactoring and + ** not recognized until after a release was made with the broken + ** sqlite3-bundler-friendly.mjs: */ + pf("\t@if grep -e '^ *importScripts(' $@; " + "then echo 'ERROR: bug fixed in 65798c09a00662a3 has re-appeared'; " + "exit 1; fi;\n"); + } + }else{ pf("\t@ls -la %s $@\n", zWasmOut); } diff --git a/manifest b/manifest index 5332ffd8f1..1172e83ce6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C wasm:\swhen\sbuilding\sin\s-O0\smode\s(typical\sdev\smode),\suse\s-sASSERTIONS=2,\selse\s-sASSERTIONS=0,\sin\sresponse\s[https://github.com/emscripten-core/emscripten/pull/23629/commits/7e3e35cbff9c5688eacb3cddc5045f872d744efd|Emscripten\scheckin\s7e3e35cbff9],\swhich\sadds\sassertions\sto\scheck\sfor\sthe\scondition\sreported\sin\s[https://github.com/emscripten-core/emscripten/issues/23420|Emscripten\sticket\s23420].\sUpdate\ssome\sunrelated\sJS-side\sinternal\sdocs. -D 2025-02-09T03:24:00.963 +C wasm:\sadd\ssome\sbuild-time\svalidation\sto\sensure\sthat\sthe\sproblem\sfixed\sin\s[65798c09a00662a3]\sdoes\snot\srecur.\sEnsure\sthat\sfiles\sgenerated\svia\smkwasmbuilds.c\shave\sthe\sgenerated\smakefile\sas\sa\sdependency. +D 2025-02-09T04:16:01.518 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -619,7 +619,7 @@ F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01 F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 654f27c0735e83c63f541b1964ef0f57423ceb71b05146de90c56b2f534f7b3b +F ext/wasm/GNUmakefile 06e0556e9840fd3d8870997025c2507ace9ba7bf11195f770295fc7947dfc1b5 F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -680,7 +680,7 @@ F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf1 F ext/wasm/index.html e4bbffdb3d40eff12b3f9c7abedef91787e2935620b7f8d40f2c774b80ad8fa9 F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54 F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8 -F ext/wasm/mkwasmbuilds.c 954fe4242e877aeb60de44070628f5215ff51e5d102db6e2cb7da8c21e9e3401 +F ext/wasm/mkwasmbuilds.c baf6636e139e2c1e3b56e8dc26073ec80f6d14ae1876b023985315f43ccf312b F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -2209,8 +2209,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9 -R 28b52c82e3748c1458cec26f6dc126a2 +P 1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962 +Q +012b308b04e6a9e3acbb842317b01b4b91ac165b925918cf20c1f52d045a6ec0 +R 808b1c99ce5bd703201eda0df9bba093 U stephan -Z f11611286d8691d31123798a11e49271 +Z 6ac45fbba274f684a5ae3627af8e6a38 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5585f98c01..f2651eae98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962 +55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005 From 63f49265244842f04ae40d14df0bc8b434ca85e1 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 04:38:56 +0000 Subject: [PATCH 23/72] configure: if the linker supports --out-implib, generate libsqlite3.X.a, where X is the platform's DLL file extension. Discussion in/around [forum:0c7fc097b2|forum post 0c7fc097b2]. FossilOrigin-Name: 6092b0b86bf93a3d58a83774b6d07ef9735e6c8a0f2ac2d0a6d263c2e9f1e3ca --- Makefile.in | 6 ++++-- autosetup/sqlite-config.tcl | 22 ++++++++++++++++++++++ main.mk | 2 +- manifest | 17 ++++++++--------- manifest.uuid | 2 +- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index f514046e00..b932f56e20 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,8 +121,10 @@ LDFLAGS.icu = @LDFLAGS_ICU@ CFLAGS.icu = @CFLAGS_ICU@ LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded -LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ -# os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 +LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@ +# os-specific: see +# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 +# - https://sqlite.org/forum/forumpost/0c7fc097b2 ENABLE_SHARED = @ENABLE_SHARED@ ENABLE_STATIC = @ENABLE_STATIC@ HAVE_WASI_SDK = @HAVE_WASI_SDK@ diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 2a73548662..f1888084e4 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -920,11 +920,33 @@ proc sqlite-check-mac-cversion {} { return $rc } +######################################################################## +# Define LDFLAGS_OUT_IMPLIB to either an empty string or to a +# -Wl,... flag for the platform-specific --out-implib flag, which is +# used for building an "import library .dll.a" file on some platforms +# (e.g. mingw). Returns 1 if supported, else 0. +# +# Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2 +proc sqlite-check-out-implib {} { + define LDFLAGS_OUT_IMPLIB "" + set rc 0 + cc-with {} { + set dll "libsqlite3[get-define TARGET_DLLEXT]" + set flags "-Wl,--out-implib,${dll}.a" + if {[cc-check-flags $flags]} { + define LDFLAGS_OUT_IMPLIB $flags + set rc 1 + } + } + return $rc +} + ######################################################################## # Performs late-stage config steps common to both the canonical and # autoconf bundle builds. proc sqlite-common-late-stage-config {} { sqlite-check-mac-cversion + sqlite-check-out-implib sqlite-process-dot-in-files sqlite-post-config-validation } diff --git a/main.mk b/main.mk index 27b8848879..f5d8185f71 100644 --- a/main.mk +++ b/main.mk @@ -2332,7 +2332,7 @@ tidy: tidy-. rm -f lemon$(B.exe) sqlite*.tar.gz rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) rm -f parse.* fts5parse.* - rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) + rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) libsqlite3$(T.dll).a rm -f tclsqlite3$(T.exe) $(TESTPROGS) rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) diff --git a/manifest b/manifest index 1172e83ce6..ea5197a572 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C wasm:\sadd\ssome\sbuild-time\svalidation\sto\sensure\sthat\sthe\sproblem\sfixed\sin\s[65798c09a00662a3]\sdoes\snot\srecur.\sEnsure\sthat\sfiles\sgenerated\svia\smkwasmbuilds.c\shave\sthe\sgenerated\smakefile\sas\sa\sdependency. -D 2025-02-09T04:16:01.518 +C configure:\sif\sthe\slinker\ssupports\s--out-implib,\sgenerate\slibsqlite3.X.a,\swhere\sX\sis\sthe\splatform's\sDLL\sfile\sextension.\sDiscussion\sin/around\s[forum:0c7fc097b2|forum\spost\s0c7fc097b2]. +D 2025-02-09T04:38:56.042 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 85ed87882b5d3fd11e6403212f2120e5e07d341bc96a101cfa9475901edd0754 +F Makefile.in 63c4d6e535dac4b7f6a6ffa566c96e3d68fa7f244799c38ee1e3d59305c5b55b F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a9b95ae9807e17f9b0734ebe97d68032141c3f95286bb64593cb73b206f043cf F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 -F autosetup/sqlite-config.tcl d2c6467c557ec0437f2115e94fbe7a77af2d3e6d34b98b8ad85212f5cb890332 +F autosetup/sqlite-config.tcl 6bff327462d34d2d9fe45738b0be70b80cf709de91b8c3b8a921cbdc2f05f6ff F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 0e3695222412c9388d8e7db612249cd0cd02722c62a16c48be7c77a7639628a8 +F main.mk 7c9df07a41c406a5fbe4e7e4021f29fa4f18821d61354721fd0435fc24f95321 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2209,9 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1f554610ba5d9d474ec4570bb7ca09125fd2cdfb4976530a4227cc6ebdf3a962 -Q +012b308b04e6a9e3acbb842317b01b4b91ac165b925918cf20c1f52d045a6ec0 -R 808b1c99ce5bd703201eda0df9bba093 +P 55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005 +R e1eadfc29a299ad14b7e6250e28c0f67 U stephan -Z 6ac45fbba274f684a5ae3627af8e6a38 +Z 4dcc7ba8a1a116665e01ae1e0e3cb31a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f2651eae98..474bb40f6f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005 +6092b0b86bf93a3d58a83774b6d07ef9735e6c8a0f2ac2d0a6d263c2e9f1e3ca From 79d0aa6f56dfdbe2acdc682ba9ebe1deb87fe438 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 05:30:47 +0000 Subject: [PATCH 24/72] Apply [6092b0b8] to autoconf/Makefile.in. FossilOrigin-Name: 9ae245cff49716e4c0bbd3fbb3f82276e5fb54d595d1e1d9a452edef45d7740f --- autoconf/Makefile.in | 6 ++++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index b41c03e76c..1677c751ee 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -126,8 +126,10 @@ OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded -LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ -# os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 +LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@ +# os-specific: see +# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 +# - https://sqlite.org/forum/forumpost/0c7fc097b2 LDFLAGS.libsqlite3 = \ $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ diff --git a/manifest b/manifest index ea5197a572..1a5a36f8ee 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure:\sif\sthe\slinker\ssupports\s--out-implib,\sgenerate\slibsqlite3.X.a,\swhere\sX\sis\sthe\splatform's\sDLL\sfile\sextension.\sDiscussion\sin/around\s[forum:0c7fc097b2|forum\spost\s0c7fc097b2]. -D 2025-02-09T04:38:56.042 +C Apply\s[6092b0b8]\sto\sautoconf/Makefile.in. +D 2025-02-09T05:30:47.201 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in ee765abbb5de7281932f8ea14123cd5a854a05cab692f39626af89a371bee81f +F autoconf/Makefile.in 916e354c3d3b1169daff2053c299f38e41cf4205abfbbd432a9bd544d1f9ca31 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 55e01365946b3432e93da5c08200e476e2a134c98b963b4170e4dfae8408a005 -R e1eadfc29a299ad14b7e6250e28c0f67 +P 6092b0b86bf93a3d58a83774b6d07ef9735e6c8a0f2ac2d0a6d263c2e9f1e3ca +R 8546c978240013284036f5addd99955c U stephan -Z 4dcc7ba8a1a116665e01ae1e0e3cb31a +Z bd5a02db20f1b0dda736d80da15a42fa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 474bb40f6f..0491610ca3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6092b0b86bf93a3d58a83774b6d07ef9735e6c8a0f2ac2d0a6d263c2e9f1e3ca +9ae245cff49716e4c0bbd3fbb3f82276e5fb54d595d1e1d9a452edef45d7740f From b85b7f257dc760768172c30d5b8d442737d7dec9 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 05:37:25 +0000 Subject: [PATCH 25/72] Update the 'clean' rules for autoconf/Makefile.in to account for [6092b0b8]. FossilOrigin-Name: f3a35fdc9113ad5f1fed6a2f474aee670e1793d355475a7971d376bf33823cc4 --- autoconf/Makefile.in | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 1677c751ee..16e60879ea 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -221,7 +221,7 @@ install: install-man1 clean: rm -f *.o sqlite3$(T.exe) - rm -f $(libsqlite3.LIB) $(libsqlite3.SO) + rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a distclean: clean rm -f jimsh0$(T.exe) config.* sqlite3.pc diff --git a/manifest b/manifest index 1a5a36f8ee..da0b642c00 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Apply\s[6092b0b8]\sto\sautoconf/Makefile.in. -D 2025-02-09T05:30:47.201 +C Update\sthe\s'clean'\srules\sfor\sautoconf/Makefile.in\sto\saccount\sfor\s[6092b0b8]. +D 2025-02-09T05:37:25.111 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 916e354c3d3b1169daff2053c299f38e41cf4205abfbbd432a9bd544d1f9ca31 +F autoconf/Makefile.in f706b48abb13553ecc5034d5fc296d424fd36d73c222285b7590004dec508925 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6092b0b86bf93a3d58a83774b6d07ef9735e6c8a0f2ac2d0a6d263c2e9f1e3ca -R 8546c978240013284036f5addd99955c +P 9ae245cff49716e4c0bbd3fbb3f82276e5fb54d595d1e1d9a452edef45d7740f +R cdceaad430550f7ec94e5d96f00f7ab4 U stephan -Z bd5a02db20f1b0dda736d80da15a42fa +Z 4725199d04d2eeff317384520a0a53f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0491610ca3..f76b8288c0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ae245cff49716e4c0bbd3fbb3f82276e5fb54d595d1e1d9a452edef45d7740f +f3a35fdc9113ad5f1fed6a2f474aee670e1793d355475a7971d376bf33823cc4 From 3bdebaeabb4266be82ad1ab06fd5e901f5dcba72 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 9 Feb 2025 19:49:46 +0000 Subject: [PATCH 26/72] Performance and size optimization for the sqlite3ColumnIndex() routine. FossilOrigin-Name: a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/build.c | 3 +-- src/select.c | 25 +++++++++++++------------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index da0b642c00..4b5d165af9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\s'clean'\srules\sfor\sautoconf/Makefile.in\sto\saccount\sfor\s[6092b0b8]. -D 2025-02-09T05:37:25.111 +C Performance\sand\ssize\soptimization\sfor\sthe\ssqlite3ColumnIndex()\sroutine. +D 2025-02-09T19:49:46.297 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -722,7 +722,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 83c43ddb517a15673d1dc17f88ea8cd1db06e0d277e6dc666ac8985017a99ac5 +F src/build.c 602fc45ea6301a3dc03ec20a9f9b294c492b7e1766ae96651f2ba8044dc445a6 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b @@ -780,7 +780,7 @@ F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 5c8ac3f0b7dd72745719f0137119a6f9016a9c2633a7351ef11c00a43b4c0944 +F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ae245cff49716e4c0bbd3fbb3f82276e5fb54d595d1e1d9a452edef45d7740f -R cdceaad430550f7ec94e5d96f00f7ab4 -U stephan -Z 4725199d04d2eeff317384520a0a53f5 +P f3a35fdc9113ad5f1fed6a2f474aee670e1793d355475a7971d376bf33823cc4 +R 07cb4b330390fc770f5d5e73fded3930 +U drh +Z 8439106cb5dd02e83a92bb726a395093 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f76b8288c0..bd2f91ec8d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3a35fdc9113ad5f1fed6a2f474aee670e1793d355475a7971d376bf33823cc4 +a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9 diff --git a/src/build.c b/src/build.c index 7b80425291..8f64d5ec30 100644 --- a/src/build.c +++ b/src/build.c @@ -1526,8 +1526,7 @@ void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ memcpy(z, sName.z, sName.n); z[sName.n] = 0; sqlite3Dequote(z); - i = sqlite3ColumnIndex(p, z); - if( i>=0 ){ + if( p->nCol && sqlite3ColumnIndex(p, z)>=0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); sqlite3DbFree(db, z); return; diff --git a/src/select.c b/src/select.c index e848c46a39..e47a9b6be2 100644 --- a/src/select.c +++ b/src/select.c @@ -320,31 +320,32 @@ int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ int sqlite3ColumnIndex(Table *pTab, const char *zCol){ int i; u8 h; - Column *pCol; + const Column *aCol; + int nCol; - if( pTab->nCol==0 ){ - return -1; - } h = sqlite3StrIHash(zCol); + aCol = pTab->aCol; + nCol = pTab->nCol; + /* See if the aHx gives us a lucky match */ i = pTab->aHx[h % sizeof(pTab->aHx)]; - assert( inCol ); - if( pTab->aCol[i].hName==h - && sqlite3StrICmp(pTab->aCol[i].zCnName, zCol)==0 + assert( iaCol; + + /* No lucky match from the hash table. Do a full search. */ i = 0; while( 1 /*exit-by-break*/ ){ - if( pCol->hName==h - && sqlite3StrICmp(pCol->zCnName, zCol)==0 + if( aCol[i].hName==h + && sqlite3StrICmp(aCol[i].zCnName, zCol)==0 ){ return i; } i++; - if( i>=pTab->nCol ) break; - pCol++; + if( i>=nCol ) break; } return -1; } From 3efac4aa782fa58857de1018152305e3d7a7c3eb Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 9 Feb 2025 20:23:29 +0000 Subject: [PATCH 27/72] Performance optimization to the substr() SQL function. FossilOrigin-Name: ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/func.c | 25 ++++++++++++------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 4b5d165af9..98df1c108a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\sand\ssize\soptimization\sfor\sthe\ssqlite3ColumnIndex()\sroutine. -D 2025-02-09T19:49:46.297 +C Performance\soptimization\sto\sthe\ssubstr()\sSQL\sfunction. +D 2025-02-09T20:23:29.902 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -733,7 +733,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 F src/expr.c 15fabfb67261e298a39fe61457f3cfa24148d9ca8d02f4dff385feb5cf523ea7 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f -F src/func.c 0712a5b03fdfc8af0cda6d076bfe231b66388d3d5a28b46dc1a94b90d41cac6a +F src/func.c b2fb33139972d7d65640b27ea962a49f1616265428001090cab39fcf270228e1 F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f3a35fdc9113ad5f1fed6a2f474aee670e1793d355475a7971d376bf33823cc4 -R 07cb4b330390fc770f5d5e73fded3930 +P a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9 +R 6458c5e9c4d2d7940a949acd5df2c6a3 U drh -Z 8439106cb5dd02e83a92bb726a395093 +Z 384512ae3dd3c9dcc3fa9d0daadac731 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bd2f91ec8d..468eacb582 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9 +ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b diff --git a/src/func.c b/src/func.c index e8cd174e42..52462b4682 100644 --- a/src/func.c +++ b/src/func.c @@ -356,11 +356,6 @@ static void substrFunc( i64 p1, p2; assert( argc==3 || argc==2 ); - if( sqlite3_value_type(argv[1])==SQLITE_NULL - || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) - ){ - return; - } p0type = sqlite3_value_type(argv[0]); p1 = sqlite3_value_int64(argv[1]); if( p0type==SQLITE_BLOB ){ @@ -378,19 +373,23 @@ static void substrFunc( } } } -#ifdef SQLITE_SUBSTR_COMPATIBILITY - /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as - ** as substr(X,1,N) - it returns the first N characters of X. This - ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8] - ** from 2009-02-02 for compatibility of applications that exploited the - ** old buggy behavior. */ - if( p1==0 ) p1 = 1; /* */ -#endif if( argc==3 ){ p2 = sqlite3_value_int64(argv[2]); + if( p2==0 && sqlite3_value_type(argv[2])==SQLITE_NULL ) return; }else{ p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH]; } + if( p1==0 ){ +#ifdef SQLITE_SUBSTR_COMPATIBILITY + /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as + ** as substr(X,1,N) - it returns the first N characters of X. This + ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8] + ** from 2009-02-02 for compatibility of applications that exploited the + ** old buggy behavior. */ + p1 = 1; /* */ +#endif + if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return; + } if( p1<0 ){ p1 += len; if( p1<0 ){ From 93df8109fc188b35968fa3a4d51400866399fd7c Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 00:20:50 +0000 Subject: [PATCH 28/72] Small performance increase in jsonTranslateBlobToText(). FossilOrigin-Name: 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/json.c | 9 ++++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 98df1c108a..ac641f9971 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\soptimization\sto\sthe\ssubstr()\sSQL\sfunction. -D 2025-02-09T20:23:29.902 +C Small\sperformance\sincrease\sin\sjsonTranslateBlobToText(). +D 2025-02-10T00:20:50.032 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -740,7 +740,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 -F src/json.c 68a98c020c22127f2d65f08855f7fc7460ff352a6ce0b543d8931dde83319c22 +F src/json.c 50d0032812673d304b66fa7c2dbc86207e7e78505c69d85521c762f52ac37329 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c b99d15d843f7a86adbec855de77b1656dde07359722ef63a9d9393678dbb58d1 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9 -R 6458c5e9c4d2d7940a949acd5df2c6a3 +P ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b +R 121930a1cd26bde82bd8ad52b6e51587 U drh -Z 384512ae3dd3c9dcc3fa9d0daadac731 +Z f5ec5ef9a94161cf3474a090fcd2095c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 468eacb582..afadd4872d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b +3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe diff --git a/src/json.c b/src/json.c index a0a075e66c..2517f6c31c 100644 --- a/src/json.c +++ b/src/json.c @@ -2199,9 +2199,12 @@ static u32 jsonTranslateBlobToText( } case JSONB_TEXT: case JSONB_TEXTJ: { - jsonAppendChar(pOut, '"'); - jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz); - jsonAppendChar(pOut, '"'); + if( pOut->nUsed+sz+2<=pOut->nAlloc || jsonStringGrow(pOut, sz+2)==0 ){ + pOut->zBuf[pOut->nUsed] = '"'; + memcpy(pOut->zBuf+pOut->nUsed+1,(const char*)&pParse->aBlob[i+n],sz); + pOut->zBuf[pOut->nUsed+sz+1] = '"'; + pOut->nUsed += sz+2; + } break; } case JSONB_TEXT5: { From a0d35d44e4382e761943b263b9183234d44f1f0b Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 11:16:37 +0000 Subject: [PATCH 29/72] Convert some expensive NEVER() and ASSERT() macros into assert()s. FossilOrigin-Name: 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/json.c | 9 +++------ src/util.c | 6 +++++- src/vdbemem.c | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index ac641f9971..7ca924c8b2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Small\sperformance\sincrease\sin\sjsonTranslateBlobToText(). -D 2025-02-10T00:20:50.032 +C Convert\ssome\sexpensive\sNEVER()\sand\sASSERT()\smacros\sinto\sassert()s. +D 2025-02-10T11:16:37.391 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -740,7 +740,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 -F src/json.c 50d0032812673d304b66fa7c2dbc86207e7e78505c69d85521c762f52ac37329 +F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c b99d15d843f7a86adbec855de77b1656dde07359722ef63a9d9393678dbb58d1 @@ -847,7 +847,7 @@ F src/trigger.c da3c25786870d8bf97cd46b493374c2375d1abaf20a9b0f5f8629a3f2f2ce383 F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba -F src/util.c e5f6a5eeaa26b69054a43bbd0048cfe3d2851f6961052b35aed8f695df922850 +F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 @@ -855,7 +855,7 @@ F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b F src/vdbeblob.c 9166b6eb7054e5da82e35255892fb1ed551355a4716452539e8e3ac14f25fbe3 -F src/vdbemem.c 977438546df236c6a3e7d8b4fe86c0643c13b89b00235db1f11c3a91a4796d30 +F src/vdbemem.c 4af21a948820259ced96e3d46d70f9af347afa2deb7cb60a8b3981d5748e4279 F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b -R 121930a1cd26bde82bd8ad52b6e51587 +P 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe +R 47d7be136c4f4c146dd38f56c85a1064 U drh -Z f5ec5ef9a94161cf3474a090fcd2095c +Z 9dd82a4bb1074323ccd62faaa22b0ea3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index afadd4872d..7692f2ba23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe +4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 diff --git a/src/json.c b/src/json.c index 2517f6c31c..47a9c875e7 100644 --- a/src/json.c +++ b/src/json.c @@ -2054,10 +2054,7 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){ u8 x; u32 sz; u32 n; - if( NEVER(i>pParse->nBlob) ){ - *pSz = 0; - return 0; - } + assert( i<=pParse->nBlob ); x = pParse->aBlob[i]>>4; if( x<=11 ){ sz = x; @@ -2101,8 +2098,8 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){ if( (i64)i+sz+n > pParse->nBlob && (i64)i+sz+n > pParse->nBlob-pParse->delta ){ - sz = 0; - n = 0; + *pSz = 0; + return 0; } *pSz = sz; return n; diff --git a/src/util.c b/src/util.c index ecce460e01..703ef0a23a 100644 --- a/src/util.c +++ b/src/util.c @@ -1130,7 +1130,11 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){ } p->z = &p->zBuf[i+1]; assert( i+p->n < sizeof(p->zBuf) ); - while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; } + assert( p->n>0 ); + while( p->z[p->n-1]=='0' ){ + p->n--; + assert( p->n>0 ); + } } /* diff --git a/src/vdbemem.c b/src/vdbemem.c index 38ba5abe80..61298d10ff 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -327,7 +327,7 @@ void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){ return; } if( pMem->enc!=SQLITE_UTF8 ) return; - if( NEVER(pMem->z==0) ) return; + assert( pMem->z!=0 ); if( pMem->flags & MEM_Dyn ){ if( pMem->xDel==sqlite3_free && sqlite3_msize(pMem->z) >= (u64)(pMem->n+1) From 3ea05b5b4f219a0cadb5d573bf73c0818cee02cf Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 10 Feb 2025 15:01:14 +0000 Subject: [PATCH 30/72] configure: when dlopen() is not found, only fail fatally if --enable-loadable-module is explicitly provided, else warn instead. Based on discussion around [forum:2efe9c33bd9021ca|forum post 2efe9c33bd9021ca]. Update proj-indented-notice to behave like its docs say it should when the -error flag is used. FossilOrigin-Name: f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc --- autosetup/proj.tcl | 7 ++++-- autosetup/sqlite-config.tcl | 47 +++++++++++++++++++++++++++++++------ manifest | 16 ++++++------- manifest.uuid | 2 +- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 5eeec0afb9..6a1960f603 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -114,11 +114,13 @@ proc proj-bold {str} { # # If the -notice flag it used then it emits using [user-notice], which # means its rendering will (A) go to stderr and (B) be delayed until -# the next time autosetup goes to output a message. If -notice -# is not used, it will send the message to stdout without delay. +# the next time autosetup goes to output a message. # # If the -error flag is provided then it renders the message # immediately to stderr and then exits. +# +# If neither -notice nor -error are used, the message will be sent to +# stdout without delay. proc proj-indented-notice {args} { set fErr "" set outFunc "puts" @@ -126,6 +128,7 @@ proc proj-indented-notice {args} { switch -exact -- [lindex $args 0] { -error { set args [lassign $args fErr] + set outFunc "user-notice" } -notice { set args [lassign $args -] diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index f1888084e4..904c439e0b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -855,20 +855,53 @@ proc sqlite-handle-icu {} { ######################################################################## -# Handles the --enable-load-extension flag. +# Handles the --enable-load-extension flag. Returns 1 if the support +# is enabled, else 0. If support for that feature is not found, a +# fatal error is triggered if --enable-load-extension is explicitly +# provided, else a loud warning is instead emited. If +# --disable-load-extension is used, no check is performed. +# +# Makes the following environment changes: +# +# - defines LDFLAGS_DLOPEN to any linker flags needed for this +# feature. It may legally be empty on some systems where dlopen() +# is in libc. +# +# - If the feature is not available, adds +# -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list. proc sqlite-handle-load-extension {} { + define LDFLAGS_DLOPEN "" + set found 0 proj-if-opt-truthy load-extension { - if {[proj-check-function-in-lib dlopen dl]} { + set found [proj-check-function-in-lib dlopen dl] + if {$found} { define LDFLAGS_DLOPEN [get-define lib_dlopen] undefine lib_dlopen } else { - user-error "dlopen() not found. Use --disable-load-extension to bypass this check." + if {[proj-opt-was-provided load-extension]} { + # Explicit --enable-load-extension: fail if not found + proj-indented-notice -error { + --enable-load-extension was provided but dlopen() + not found. Use --disable-load-extension to bypass this + check. + } + } else { + # It was implicitly enabled: warn if not found + proj-indented-notice { + WARNING: dlopen() not found, so loadable module support will + be disabled. Use --disable-load-extension to bypass this + check. + } + } } - } { - define LDFLAGS_DLOPEN "" - sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1} - msg-result "Disabling loadable extensions." } + if {$found} { + msg-result "Loadable extension support enabled." + } else { + msg-result "Disabling loadable extension support. Use --enable-load-extensions to enable them." + sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1} + } + return $found } ######################################################################## diff --git a/manifest b/manifest index 7ca924c8b2..3221103887 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Convert\ssome\sexpensive\sNEVER()\sand\sASSERT()\smacros\sinto\sassert()s. -D 2025-02-10T11:16:37.391 +C configure:\swhen\sdlopen()\sis\snot\sfound,\sonly\sfail\sfatally\sif\s--enable-loadable-module\sis\sexplicitly\sprovided,\selse\swarn\sinstead.\sBased\son\sdiscussion\saround\s[forum:2efe9c33bd9021ca|forum\spost\s2efe9c33bd9021ca].\sUpdate\sproj-indented-notice\sto\sbehave\slike\sits\sdocs\ssay\sit\sshould\swhen\sthe\s-error\sflag\sis\sused. +D 2025-02-10T15:01:14.412 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 -F autosetup/sqlite-config.tcl 6bff327462d34d2d9fe45738b0be70b80cf709de91b8c3b8a921cbdc2f05f6ff +F autosetup/proj.tcl 42119a2e899e319b92f3159952b7ef7219c82cb45eeb636aaf8d909def8150f8 +F autosetup/sqlite-config.tcl 341c2751f42c6c8eeeae50bec13d2bb28db73ca2c8b9b97598332aed02e0a71b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe -R 47d7be136c4f4c146dd38f56c85a1064 -U drh -Z 9dd82a4bb1074323ccd62faaa22b0ea3 +P 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 +R 0e46282cf2ae1fcf5877508517bc3bb3 +U stephan +Z 8b12a9b798d6d21e89b61eb16ecc7324 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7692f2ba23..94b9a5b26c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 +f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc From 9dfc2c61ec7125898dfdceab43fc5a83b87ebc7a Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 10 Feb 2025 15:58:22 +0000 Subject: [PATCH 31/72] Add jimsh.exe and jimsh0.exe to the clean rules in Makefile.msc so that stale builds of those files from msys2 and friends do not cause mysterious build errors. FossilOrigin-Name: 44b4e4db321815c6fc0327ed7b97df868833654411e882b70f54ad3f6d212987 --- Makefile.msc | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index c1a8f88b6e..93b0935b1e 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -2846,4 +2846,5 @@ clean: del /Q fts5.* fts5parse.* 2>NUL del /Q lsm.h lsm1.c 2>NUL del /q src-verify.exe 2>NUL + del /q jimsh.exe jimsh0.exe 2>NUL # <> diff --git a/manifest b/manifest index 3221103887..356f131170 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C configure:\swhen\sdlopen()\sis\snot\sfound,\sonly\sfail\sfatally\sif\s--enable-loadable-module\sis\sexplicitly\sprovided,\selse\swarn\sinstead.\sBased\son\sdiscussion\saround\s[forum:2efe9c33bd9021ca|forum\spost\s2efe9c33bd9021ca].\sUpdate\sproj-indented-notice\sto\sbehave\slike\sits\sdocs\ssay\sit\sshould\swhen\sthe\s-error\sflag\sis\sused. -D 2025-02-10T15:01:14.412 +C Add\sjimsh.exe\sand\sjimsh0.exe\sto\sthe\sclean\srules\sin\sMakefile.msc\sso\sthat\sstale\sbuilds\sof\sthose\sfiles\sfrom\smsys2\sand\sfriends\sdo\snot\scause\smysterious\sbuild\serrors. +D 2025-02-10T15:58:22.800 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F Makefile.in 63c4d6e535dac4b7f6a6ffa566c96e3d68fa7f244799c38ee1e3d59305c5b55b F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc a9b95ae9807e17f9b0734ebe97d68032141c3f95286bb64593cb73b206f043cf +F Makefile.msc 990e4ea94a417135d1b2fd35550997c3f40fc1758bd7546bd17c0f4312f0babc F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 -R 0e46282cf2ae1fcf5877508517bc3bb3 +P f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc +R 9884f4a919e7e313dc0ab42868810e5c U stephan -Z 8b12a9b798d6d21e89b61eb16ecc7324 +Z 6aa92bc3b567c51b695c0a3eafdd20c2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 94b9a5b26c..024fc6f4cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc +44b4e4db321815c6fc0327ed7b97df868833654411e882b70f54ad3f6d212987 From dadd0b4085fc6d76b0100f60c50d5fe95850aa77 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 16:13:56 +0000 Subject: [PATCH 32/72] Enhance speedtest1 with a new testset that calls sqlite3_open() and uses the connection many times. FossilOrigin-Name: ce307addb0c7cf72e4cca066521df6e15d1220bce303a3796a794a2ae5fa95b3 --- manifest | 14 +- manifest.uuid | 2 +- test/speedtest1.c | 481 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 474 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 356f131170..8a2dd3ba43 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sjimsh.exe\sand\sjimsh0.exe\sto\sthe\sclean\srules\sin\sMakefile.msc\sso\sthat\sstale\sbuilds\sof\sthose\sfiles\sfrom\smsys2\sand\sfriends\sdo\snot\scause\smysterious\sbuild\serrors. -D 2025-02-10T15:58:22.800 +C Enhance\sspeedtest1\swith\sa\snew\stestset\sthat\scalls\ssqlite3_open()\sand\suses\sthe\nconnection\smany\stimes. +D 2025-02-10T16:13:56.580 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1681,7 +1681,7 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x -F test/speedtest1.c ef340d391366afc875d11fc59332601c470154352b0db836b2cba813999a8fb4 +F test/speedtest1.c abcce434642f8f1e1be530d25d8e7d7862360236d7a8e4f626521bc3263bd38c F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc -R 9884f4a919e7e313dc0ab42868810e5c -U stephan -Z 6aa92bc3b567c51b695c0a3eafdd20c2 +P 44b4e4db321815c6fc0327ed7b97df868833654411e882b70f54ad3f6d212987 +R 6770e3052628a73d65a1abe270e15306 +U drh +Z b145be6a514a8b9ab22ab7f6982431ae # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 024fc6f4cf..2351f8f438 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -44b4e4db321815c6fc0327ed7b97df868833654411e882b70f54ad3f6d212987 +ce307addb0c7cf72e4cca066521df6e15d1220bce303a3796a794a2ae5fa95b3 diff --git a/test/speedtest1.c b/test/speedtest1.c index c6d5fd4a10..a03bdbb73b 100644 --- a/test/speedtest1.c +++ b/test/speedtest1.c @@ -65,8 +65,8 @@ static const char zHelp[] = " --stmtscanstatus Activate SQLITE_DBCONFIG_STMT_SCANSTATUS\n" " --temp N N from 0 to 9. 0: no temp table. 9: all temp tables\n" " --testset T Run test-set T (main, cte, rtree, orm, fp, json,\n" - " star, debug). Can be a comma-separated list of\n" - " values, with /SCALE suffixes or macro \"mix1\"\n" + " star, app, debug). Can be a comma-separated list\n" + " of values, with /SCALE suffixes or macro \"mix1\"\n" " --trace Turn on SQL tracing\n" " --threads N Use up to N threads for sorting\n" " --utf16be Set text encoding to UTF-16BE\n" @@ -112,6 +112,8 @@ struct HashContext { /* All global state is held in this structure */ static struct Global { sqlite3 *db; /* The open database connection */ + const char *zDbName; /* Name of the database file */ + const char *zVfs; /* --vfs NAME */ sqlite3_stmt *pStmt; /* Current SQL statement */ sqlite3_int64 iStart; /* Start-time for the current test */ sqlite3_int64 iTotal; /* Total time */ @@ -1565,6 +1567,453 @@ void testset_star(void){ speedtest1_end_test(); } +/* +** Tests that simulate an application opening and closing an SQLite database +** frequently. Fossil is used as the model. The focus here is on rapidly +** parsing the database schema and rapidly generating prepared statements, +** in other words, rapid start-up of Fossil-like applications. +** +** The same database has no data, so the performance of sqlite3_step() is +** not significant to this testset. +*/ +static void testset_app(void){ + int i, n; + speedtest1_begin_test(100, "Generate a Fossil-like database schema"); + speedtest1_exec( + "BEGIN;" + "CREATE TABLE blob(\n" + " rid INTEGER PRIMARY KEY,\n" + " rcvid INTEGER,\n" + " size INTEGER,\n" + " uuid TEXT UNIQUE NOT NULL,\n" + " content BLOB,\n" + " CHECK( length(uuid)>=40 AND rid>0 )\n" + ");\n" + "CREATE TABLE delta(\n" + " rid INTEGER PRIMARY KEY,\n" + " srcid INTEGER NOT NULL REFERENCES blob\n" + ");\n" + "CREATE TABLE rcvfrom(\n" + " rcvid INTEGER PRIMARY KEY,\n" + " uid INTEGER REFERENCES user,\n" + " mtime DATETIME,\n" + " nonce TEXT UNIQUE,\n" + " ipaddr TEXT\n" + ");\n" + "CREATE TABLE private(rid INTEGER PRIMARY KEY);\n" + "CREATE TABLE accesslog(\n" + " uname TEXT,\n" + " ipaddr TEXT,\n" + " success BOOLEAN,\n" + " mtime TIMESTAMP\n" + ");\n" + "CREATE TABLE user(\n" + " uid INTEGER PRIMARY KEY,\n" + " login TEXT UNIQUE,\n" + " pw TEXT,\n" + " cap TEXT,\n" + " cookie TEXT,\n" + " ipaddr TEXT,\n" + " cexpire DATETIME,\n" + " info TEXT,\n" + " mtime DATE,\n" + " photo BLOB\n" + ", jx TEXT DEFAULT '{}');\n" + "CREATE TABLE reportfmt(\n" + " rn INTEGER PRIMARY KEY,\n" + " owner TEXT,\n" + " title TEXT UNIQUE,\n" + " mtime INTEGER,\n" + " cols TEXT,\n" + " sqlcode TEXT\n" + ", jx TEXT DEFAULT '{}');\n" + "CREATE TABLE config(\n" + " name TEXT PRIMARY KEY NOT NULL,\n" + " value CLOB, mtime INTEGER,\n" + " CHECK( typeof(name)='text' AND length(name)>=1 )\n" + ") WITHOUT ROWID;\n" + "CREATE TABLE shun(uuid PRIMARY KEY, mtime INTEGER, scom TEXT)\n" + " WITHOUT ROWID;\n" + "CREATE TABLE concealed(\n" + " hash TEXT PRIMARY KEY,\n" + " content TEXT\n" + ", mtime INTEGER) WITHOUT ROWID;\n" + "CREATE TABLE admin_log(\n" + " id INTEGER PRIMARY KEY,\n" + " time INTEGER, -- Seconds since 1970\n" + " page TEXT, -- path of page\n" + " who TEXT, -- User who made the change\n" + " what TEXT -- What changed\n" + ");\n" + "CREATE TABLE unversioned(\n" + " name TEXT PRIMARY KEY,\n" + " rcvid INTEGER,\n" + " mtime DATETIME,\n" + " hash TEXT,\n" + " sz INTEGER,\n" + " encoding INT,\n" + " content BLOB\n" + ") WITHOUT ROWID;\n" + "CREATE TABLE subscriber(\n" + " subscriberId INTEGER PRIMARY KEY,\n" + " subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE,\n" + " semail TEXT UNIQUE COLLATE nocase,\n" + " suname TEXT,\n" + " sverified BOOLEAN DEFAULT true,\n" + " sdonotcall BOOLEAN,\n" + " sdigest BOOLEAN,\n" + " ssub TEXT,\n" + " sctime INTDATE,\n" + " mtime INTDATE,\n" + " smip TEXT\n" + ", lastContact INT);\n" + "CREATE TABLE pending_alert(\n" + " eventid TEXT PRIMARY KEY,\n" + " sentSep BOOLEAN DEFAULT false,\n" + " sentDigest BOOLEAN DEFAULT false\n" + ", sentMod BOOLEAN DEFAULT false) WITHOUT ROWID;\n" + "CREATE TABLE filename(\n" + " fnid INTEGER PRIMARY KEY,\n" + " name TEXT UNIQUE\n" + ") STRICT;\n" + "CREATE TABLE mlink(\n" + " mid INTEGER,\n" + " fid INTEGER,\n" + " pmid INTEGER,\n" + " pid INTEGER,\n" + " fnid INTEGER REFERENCES filename,\n" + " pfnid INTEGER,\n" + " mperm INTEGER,\n" + " isaux INT DEFAULT 0\n" + ") STRICT;\n" + "CREATE TABLE plink(\n" + " pid INTEGER REFERENCES blob,\n" + " cid INTEGER REFERENCES blob,\n" + " isprim INT,\n" + " mtime REAL,\n" + " baseid INTEGER REFERENCES blob,\n" + " UNIQUE(pid, cid)\n" + ") STRICT;\n" + "CREATE TABLE leaf(rid INTEGER PRIMARY KEY);\n" + "CREATE TABLE event(\n" + " type TEXT,\n" + " mtime REAL,\n" + " objid INTEGER PRIMARY KEY,\n" + " tagid INTEGER,\n" + " uid INTEGER REFERENCES user,\n" + " bgcolor TEXT,\n" + " euser TEXT,\n" + " user TEXT,\n" + " ecomment TEXT,\n" + " comment TEXT,\n" + " brief TEXT,\n" + " omtime REAL\n" + ") STRICT;\n" + "CREATE TABLE phantom(\n" + " rid INTEGER PRIMARY KEY\n" + ");\n" + "CREATE TABLE orphan(\n" + " rid INTEGER PRIMARY KEY,\n" + " baseline INTEGER\n" + ") STRICT;\n" + "CREATE TABLE unclustered(\n" + " rid INTEGER PRIMARY KEY\n" + ");\n" + "CREATE TABLE unsent(\n" + " rid INTEGER PRIMARY KEY\n" + ");\n" + "CREATE TABLE tag(\n" + " tagid INTEGER PRIMARY KEY,\n" + " tagname TEXT UNIQUE\n" + ") STRICT;\n" + "CREATE TABLE tagxref(\n" + " tagid INTEGER REFERENCES tag,\n" + " tagtype INTEGER,\n" + " srcid INTEGER REFERENCES blob,\n" + " origid INTEGER REFERENCES blob,\n" + " value TEXT,\n" + " mtime REAL,\n" + " rid INTEGER REFERENCES blob,\n" + " UNIQUE(rid, tagid)\n" + ") STRICT;\n" + "CREATE TABLE backlink(\n" + " target TEXT,\n" + " srctype INT,\n" + " srcid INT,\n" + " mtime REAL,\n" + " UNIQUE(target, srctype, srcid)\n" + ") STRICT;\n" + "CREATE TABLE attachment(\n" + " attachid INTEGER PRIMARY KEY,\n" + " isLatest INT DEFAULT 0,\n" + " mtime REAL,\n" + " src TEXT,\n" + " target TEXT,\n" + " filename TEXT,\n" + " comment TEXT,\n" + " user TEXT\n" + ") STRICT;\n" + "CREATE TABLE cherrypick(\n" + " parentid INT,\n" + " childid INT,\n" + " isExclude INT DEFAULT false,\n" + " PRIMARY KEY(parentid, childid)\n" + ") WITHOUT ROWID, STRICT;\n" + "CREATE TABLE vcache(\n" + " vid INTEGER, -- check-in ID\n" + " fname TEXT, -- filename\n" + " rid INTEGER, -- artifact ID\n" + " PRIMARY KEY(vid,fname)\n" + ") WITHOUT ROWID;\n" + "CREATE TABLE synclog(\n" + " sfrom TEXT,\n" + " sto TEXT,\n" + " stime INT NOT NULL,\n" + " stype TEXT,\n" + " PRIMARY KEY(sfrom,sto)\n" + ") WITHOUT ROWID;\n" + "CREATE TABLE chat(\n" + " msgid INTEGER PRIMARY KEY AUTOINCREMENT,\n" + " mtime JULIANDAY,\n" + " lmtime TEXT,\n" + " xfrom TEXT,\n" + " xmsg TEXT,\n" + " fname TEXT,\n" + " fmime TEXT,\n" + " mdel INT,\n" + " file BLOB\n" + ");\n" + "CREATE TABLE ftsdocs(\n" + " rowid INTEGER PRIMARY KEY,\n" + " type CHAR(1),\n" + " rid INTEGER,\n" + " name TEXT,\n" + " idxed BOOLEAN,\n" + " label TEXT,\n" + " url TEXT,\n" + " mtime DATE,\n" + " bx TEXT,\n" + " UNIQUE(type,rid)\n" + ");\n" + "CREATE TABLE ticket(\n" + " -- Do not change any column that begins with tkt_\n" + " tkt_id INTEGER PRIMARY KEY,\n" + " tkt_uuid TEXT UNIQUE,\n" + " tkt_mtime DATE,\n" + " tkt_ctime DATE,\n" + " -- Add as many fields as required below this line\n" + " type TEXT,\n" + " status TEXT,\n" + " subsystem TEXT,\n" + " priority TEXT,\n" + " severity TEXT,\n" + " foundin TEXT,\n" + " private_contact TEXT,\n" + " resolution TEXT,\n" + " title TEXT,\n" + " comment TEXT\n" + ");\n" + "CREATE TABLE ticketchng(\n" + " -- Do not change any column that begins with tkt_\n" + " tkt_id INTEGER REFERENCES ticket,\n" + " tkt_rid INTEGER REFERENCES blob,\n" + " tkt_mtime DATE,\n" + " tkt_user TEXT,\n" + " -- Add as many fields as required below this line\n" + " login TEXT,\n" + " username TEXT,\n" + " mimetype TEXT,\n" + " icomment TEXT\n" + ");\n" + "CREATE TABLE forumpost(\n" + " fpid INTEGER PRIMARY KEY,\n" + " froot INT,\n" + " fprev INT,\n" + " firt INT,\n" + " fmtime REAL\n" + ");\n" + "CREATE INDEX delta_i1 ON delta(srcid);\n" + "CREATE INDEX blob_rcvid ON blob(rcvid);\n" + "CREATE INDEX subscriberUname\n" + " ON subscriber(suname) WHERE suname IS NOT NULL;\n" + "CREATE INDEX mlink_i1 ON mlink(mid);\n" + "CREATE INDEX mlink_i2 ON mlink(fnid);\n" + "CREATE INDEX mlink_i3 ON mlink(fid);\n" + "CREATE INDEX mlink_i4 ON mlink(pid);\n" + "CREATE INDEX plink_i2 ON plink(cid,pid);\n" + "CREATE INDEX event_i1 ON event(mtime);\n" + "CREATE INDEX orphan_baseline ON orphan(baseline);\n" + "CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);\n" + "CREATE INDEX backlink_src ON backlink(srcid, srctype);\n" + "CREATE INDEX attachment_idx1 ON attachment(target, filename, mtime);\n" + "CREATE INDEX attachment_idx2 ON attachment(src);\n" + "CREATE INDEX cherrypick_cid ON cherrypick(childid);\n" + "CREATE INDEX ftsdocIdxed ON ftsdocs(type,rid,name) WHERE idxed==0;\n" + "CREATE INDEX ftsdocName ON ftsdocs(name) WHERE type='w';\n" + "CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);\n" + "CREATE INDEX forumthread ON forumpost(froot,fmtime);\n" + "CREATE VIEW artifact(rid,rcvid,size,atype,srcid,hash,content) AS\n" + " SELECT blob.rid,rcvid,size,1,srcid,uuid,content\n" + " FROM blob LEFT JOIN delta ON (blob.rid=delta.rid);\n" + "CREATE VIEW ftscontent AS\n" + " SELECT rowid, type, rid, name, idxed, label, url, mtime,\n" + " title(type,rid,name) AS 'title', body(type,rid,name) AS 'body'\n" + " FROM ftsdocs;\n" + ); + if( sqlite3_compileoption_used("ENABLE_FTS5") ){ + speedtest1_exec( + "CREATE VIRTUAL TABLE ftsidx\n" + " USING fts5(content=\"ftscontent\", title, body);\n" + "CREATE VIRTUAL TABLE chatfts1 USING fts5(\n" + " xmsg, content=chat, content_rowid=msgid,tokenize=porter);\n" + ); + }else{ + speedtest1_exec( + "CREATE TABLE ftsidx_data(id INTEGER PRIMARY KEY, block BLOB);\n" + "CREATE TABLE ftsidx_idx(segid, term, pgno, PRIMARY KEY(segid, term))\n" + " WITHOUT ROWID;\n" + "CREATE TABLE ftsidx_docsize(id INTEGER PRIMARY KEY, sz BLOB);\n" + "CREATE TABLE ftsidx_config(k PRIMARY KEY, v) WITHOUT ROWID;\n" + "CREATE TABLE chatfts1_data(id INTEGER PRIMARY KEY, block BLOB);\n" + "CREATE TABLE chatfts1_idx(segid, term, pgno, PRIMARY KEY(segid, term))\n" + " WITHOUT ROWID;\n" + "CREATE TABLE chatfts1_docsize(id INTEGER PRIMARY KEY, sz BLOB);\n" + "CREATE TABLE chatfts1_config(k PRIMARY KEY, v) WITHOUT ROWID;\n" + ); + } + speedtest1_exec( + "ANALYZE sqlite_schema;\n" + "INSERT INTO sqlite_stat1(tbl,idx,stat) VALUES\n" + " ('ftsidx_config','ftsidx_config','1 1'),\n" + " ('ftsidx_idx','ftsidx_idx','4215 401 1'),\n" + " ('user','sqlite_autoindex_user_1','25 1'),\n" + " ('phantom',NULL,'26'),\n" + " ('reportfmt','sqlite_autoindex_reportfmt_1','9 1'),\n" + " ('rcvfrom','sqlite_autoindex_rcvfrom_1','18445 401'),\n" + " ('private',NULL,'99'),\n" + " ('mlink','mlink_i4','116678 401'),\n" + " ('mlink','mlink_i3','121212 2'),\n" + " ('mlink','mlink_i2','106372 401'),\n" + " ('mlink','mlink_i1','99298 5'),\n" + " ('ftsidx_data',NULL,'3795'),\n" + " ('leaf',NULL,'1559'),\n" + " ('delta','delta_i1','66340 1'),\n" + " ('unversioned','unversioned','3 1'),\n" + " ('pending_alert','pending_alert','3 1'),\n" + " ('cherrypick','cherrypick_cid','680 2'),\n" + " ('cherrypick','cherrypick','628 1 1'),\n" + " ('config','config','128 1'),\n" + " ('ftsidx_docsize',NULL,'33848'),\n" + " ('event','event_i1','36096 1'),\n" + " ('plink','plink_i2','38236 1 1'),\n" + " ('plink','sqlite_autoindex_plink_1','38357 1 1'),\n" + " ('shun','shun','10 1'),\n" + " ('concealed','concealed','110 1'),\n" + " ('vcache','vcache','1888 401 1'),\n" + " ('ftsdocs','ftsdocName','19 1'),\n" + " ('ftsdocs','ftsdocIdxed','168 84 1 1'),\n" + " ('ftsdocs','sqlite_autoindex_ftsdocs_1','37312 401 1'),\n" + " ('subscriber','subscriberUname','5 1'),\n" + " ('subscriber','sqlite_autoindex_subscriber_2','37 1'),\n" + " ('subscriber','sqlite_autoindex_subscriber_1','37 1'),\n" + " ('tag','sqlite_autoindex_tag_1','2990 1'),\n" + " ('filename','sqlite_autoindex_filename_1','3168 1'),\n" + " ('chat',NULL,'56124'),\n" + " ('tagxref','tagxref_i1','40992 401 2'),\n" + " ('tagxref','sqlite_autoindex_tagxref_1','79233 3 1'),\n" + " ('attachment','attachment_idx2','11 1'),\n" + " ('attachment','attachment_idx1','11 2 2 1'),\n" + " ('blob','blob_rcvid','128240 201'),\n" + " ('blob','sqlite_autoindex_blob_1','126480 1'),\n" + " ('synclog','synclog','12 3 1'),\n" + " ('backlink','backlink_src','2160 2 2'),\n" + " ('backlink','sqlite_autoindex_backlink_1','2340 2 2 1'),\n" + " ('accesslog',NULL,'38'),\n" + " ('chatfts1_config','chatfts1_config','1 1'),\n" + " ('chatfts1_idx','chatfts1_idx','688 230 1'),\n" + " ('ticket','sqlite_autoindex_ticket_1','794 1'),\n" + " ('ticketchng','ticketchng_idx1','2089 3 1'),\n" + " ('forumpost','forumthread','4 4 1'),\n" + " ('unclustered',NULL,'12');\n" + "COMMIT;" + ); + speedtest1_end_test(); + + n = g.szTest*3; + speedtest1_begin_test(110, "Open and use the database %d times", n); + for(i=0; i=$date OR parent.pid=$pid)\n" + " ORDER BY mtime DESC LIMIT 10\n" + " )\n" + " INSERT OR IGNORE INTO ok SELECT rid FROM ancestor;" + ); + sqlite3_close(dbAux); + g.db = dbMain; + } + speedtest1_end_test(); +} + #ifdef SQLITE_ENABLE_RTREE /* Generate two numbers between 1 and mx. The first number is less than ** the second. Usually the numbers are near each other but can sometimes @@ -2512,10 +2961,8 @@ int main(int argc, char **argv){ int openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE ; /* SQLITE_OPEN_xxx flags. */ char *zTSet = "main"; /* Which --testset torun */ - const char * zVfs = 0; /* --vfs NAME */ int doTrace = 0; /* True for --trace */ const char *zEncoding = 0; /* --utf16be or --utf16le */ - const char *zDbName = 0; /* Name of the test database */ void *pHeap = 0; /* Allocated heap space */ void *pLook = 0; /* Allocated lookaside space */ @@ -2542,6 +2989,8 @@ int main(int argc, char **argv){ sqlite3_libversion(), sqlite3_sourceid()); /* Process command-line arguments */ + g.zDbName = 0; + g.zVfs = 0; g.zWR = ""; g.zNN = ""; g.zPK = "UNIQUE"; @@ -2668,7 +3117,7 @@ int main(int argc, char **argv){ g.eTemp = argv[i][0] - '0'; }else if( strcmp(z,"testset")==0 ){ static char zMix1Tests[] = - "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star"; + "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star,app"; ARGC_VALUE_CHECK(1); zTSet = argv[++i]; if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests; @@ -2688,7 +3137,7 @@ int main(int argc, char **argv){ #endif }else if( strcmp(z,"vfs")==0 ){ ARGC_VALUE_CHECK(1); - zVfs = argv[++i]; + g.zVfs = argv[++i]; }else if( strcmp(z,"reserve")==0 ){ ARGC_VALUE_CHECK(1); g.nReserve = atoi(argv[++i]); @@ -2718,8 +3167,8 @@ int main(int argc, char **argv){ fatal_error("unknown option: %s\nUse \"%s -?\" for help\n", argv[i], argv[0]); } - }else if( zDbName==0 ){ - zDbName = argv[i]; + }else if( g.zDbName==0 ){ + g.zDbName = argv[i]; }else{ fatal_error("surplus argument: %s\nUse \"%s -?\" for help\n", argv[i], argv[0]); @@ -2748,8 +3197,8 @@ int main(int argc, char **argv){ #endif sqlite3_initialize(); - if( zDbName!=0 ){ - sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs); + if( g.zDbName!=0 ){ + sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfs); /* For some VFSes, e.g. opfs, unlink() is not sufficient. Use the ** selected (or default) VFS's xDelete method to delete the ** database. This is specifically important for the "opfs" VFS @@ -2757,15 +3206,15 @@ int main(int argc, char **argv){ ** can be cleaned up properly. For historical compatibility, we'll ** also simply unlink(). */ if( pVfs!=0 ){ - pVfs->xDelete(pVfs, zDbName, 1); + pVfs->xDelete(pVfs, g.zDbName, 1); } - unlink(zDbName); + unlink(g.zDbName); } /* Open the database and the input file */ - if( sqlite3_open_v2(memDb ? ":memory:" : zDbName, &g.db, - openFlags, zVfs) ){ - fatal_error("Cannot open database file: %s\n", zDbName); + if( sqlite3_open_v2(memDb ? ":memory:" : g.zDbName, &g.db, + openFlags, g.zVfs) ){ + fatal_error("Cannot open database file: %s\n", g.zDbName); } #if SQLITE_VERSION_NUMBER>=3006001 if( nLook>0 && szLook>0 ){ @@ -2859,6 +3308,8 @@ int main(int argc, char **argv){ testset_cte(); }else if( strcmp(zThisTest,"star")==0 ){ testset_star(); + }else if( strcmp(zThisTest,"app")==0 ){ + testset_app(); }else if( strcmp(zThisTest,"fp")==0 ){ testset_fp(); }else if( strcmp(zThisTest,"json")==0 ){ From 8f79342f6aeb47bfb59b17e82423587378593a66 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 16:34:30 +0000 Subject: [PATCH 33/72] Make the "mix1" testset the default for speedtest1. FossilOrigin-Name: 7a0c3d0e14984dd49a7c1e824b9e50564094ad57c43182bfec7624a55815f961 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/speedtest1.c | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 8a2dd3ba43..f647110054 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sspeedtest1\swith\sa\snew\stestset\sthat\scalls\ssqlite3_open()\sand\suses\sthe\nconnection\smany\stimes. -D 2025-02-10T16:13:56.580 +C Make\sthe\s"mix1"\stestset\sthe\sdefault\sfor\sspeedtest1. +D 2025-02-10T16:34:30.128 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1681,7 +1681,7 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x -F test/speedtest1.c abcce434642f8f1e1be530d25d8e7d7862360236d7a8e4f626521bc3263bd38c +F test/speedtest1.c 132cd5ba064f48910bb4b68337442b0ef419218c8de9e9855f66d98015286ddb F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 44b4e4db321815c6fc0327ed7b97df868833654411e882b70f54ad3f6d212987 -R 6770e3052628a73d65a1abe270e15306 +P ce307addb0c7cf72e4cca066521df6e15d1220bce303a3796a794a2ae5fa95b3 +R 7ff52f027efda91f136a0ad19e93519e U drh -Z b145be6a514a8b9ab22ab7f6982431ae +Z 3d75c6193c4df011902dd598934d5c2c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2351f8f438..be6b3b23b4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce307addb0c7cf72e4cca066521df6e15d1220bce303a3796a794a2ae5fa95b3 +7a0c3d0e14984dd49a7c1e824b9e50564094ad57c43182bfec7624a55815f961 diff --git a/test/speedtest1.c b/test/speedtest1.c index a03bdbb73b..b49c70098f 100644 --- a/test/speedtest1.c +++ b/test/speedtest1.c @@ -2960,7 +2960,7 @@ int main(int argc, char **argv){ int memDb = 0; /* --memdb. Use an in-memory database */ int openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE ; /* SQLITE_OPEN_xxx flags. */ - char *zTSet = "main"; /* Which --testset torun */ + char *zTSet = "mix1"; /* Which --testset torun */ int doTrace = 0; /* True for --trace */ const char *zEncoding = 0; /* --utf16be or --utf16le */ @@ -2971,6 +2971,10 @@ int main(int argc, char **argv){ int i; /* Loop counter */ int rc; /* API return code */ + /* "mix1" is a macro testset: */ + static char zMix1Tests[] = + "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star,app"; + #ifdef SQLITE_SPEEDTEST1_WASM /* Resetting all state is important for the WASM build, which may ** call main() multiple times. */ @@ -3116,11 +3120,8 @@ int main(int argc, char **argv){ } g.eTemp = argv[i][0] - '0'; }else if( strcmp(z,"testset")==0 ){ - static char zMix1Tests[] = - "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star,app"; ARGC_VALUE_CHECK(1); zTSet = argv[++i]; - if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests; }else if( strcmp(z,"trace")==0 ){ doTrace = 1; }else if( strcmp(z,"threads")==0 ){ @@ -3272,6 +3273,7 @@ int main(int argc, char **argv){ } if( g.bExplain ) printf(".explain\n.echo on\n"); + if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests; do{ char *zThisTest = zTSet; char *zSep; From b2972b8c6f864c99659ff469055a16db3ec34dd3 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 10 Feb 2025 18:41:46 +0000 Subject: [PATCH 34/72] Minor autosetup doc tweaks. FossilOrigin-Name: bb53beb267ee5f5836020a58f32f1bed8deb587890eef9a6e034dad53f8c3f42 --- autosetup/proj.tcl | 6 +++--- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 6a1960f603..fdfbf3a5ed 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -184,8 +184,8 @@ proc proj-lshift_ {listVar {count 1}} { ######################################################################## # Expects to receive string input, which it splits on newlines, strips -# out any lines which begin with an number of whitespace followed by a -# '#', and returns a value containing the [append]ed results of each +# out any lines which begin with any number of whitespace followed by +# a '#', and returns a value containing the [append]ed results of each # remaining line with a \n between each. proc proj-strip-hash-comments {val} { set x {} @@ -203,7 +203,7 @@ proc proj-strip-hash-comments {val} { # A proxy for cc-check-function-in-lib which does not make any global # changes to the LIBS define. Returns the result of # cc-check-function-in-lib (i.e. true or false). The resulting linker -# flags are stored in ${lib_${function}}. +# flags are stored in the [define] named lib_${function}. proc proj-check-function-in-lib {function libs {otherlibs {}}} { set found 0 define-push {LIBS} { diff --git a/manifest b/manifest index f647110054..42a7ffe1d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\s"mix1"\stestset\sthe\sdefault\sfor\sspeedtest1. -D 2025-02-10T16:34:30.128 +C Minor\sautosetup\sdoc\stweaks. +D 2025-02-10T18:41:46.630 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 42119a2e899e319b92f3159952b7ef7219c82cb45eeb636aaf8d909def8150f8 +F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f F autosetup/sqlite-config.tcl 341c2751f42c6c8eeeae50bec13d2bb28db73ca2c8b9b97598332aed02e0a71b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ce307addb0c7cf72e4cca066521df6e15d1220bce303a3796a794a2ae5fa95b3 -R 7ff52f027efda91f136a0ad19e93519e -U drh -Z 3d75c6193c4df011902dd598934d5c2c +P 7a0c3d0e14984dd49a7c1e824b9e50564094ad57c43182bfec7624a55815f961 +R d2d2e8c6e583d1621c49ccc900539cec +U stephan +Z 67e48a24ab45c6698c52d6bd11ee89d3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index be6b3b23b4..f29a5355c0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a0c3d0e14984dd49a7c1e824b9e50564094ad57c43182bfec7624a55815f961 +bb53beb267ee5f5836020a58f32f1bed8deb587890eef9a6e034dad53f8c3f42 From 6cc36dfb16fcf101ec7e1f7dcebe4731233c96ea Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 19:12:18 +0000 Subject: [PATCH 35/72] Add the --size option to the test/speedtest.tcl script. FossilOrigin-Name: 6b9007cb30257ca97de74dec1df47f46f238f034083517a51c24334e4bd30663 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/speedtest.tcl | 9 +++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 42a7ffe1d2..b4d216617b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\sautosetup\sdoc\stweaks. -D 2025-02-10T18:41:46.630 +C Add\sthe\s--size\soption\sto\sthe\stest/speedtest.tcl\sscript. +D 2025-02-10T19:12:18.297 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1680,7 +1680,7 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad -F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x +F test/speedtest.tcl 926d1e168f4a14e6fb68c5dc174de743536b547f365264bd5bac533b3621a4a0 x F test/speedtest1.c 132cd5ba064f48910bb4b68337442b0ef419218c8de9e9855f66d98015286ddb F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7a0c3d0e14984dd49a7c1e824b9e50564094ad57c43182bfec7624a55815f961 -R d2d2e8c6e583d1621c49ccc900539cec -U stephan -Z 67e48a24ab45c6698c52d6bd11ee89d3 +P bb53beb267ee5f5836020a58f32f1bed8deb587890eef9a6e034dad53f8c3f42 +R 00ccd32b91c1afa4d9f2520464e4c3e9 +U drh +Z c42977e3dfb38afa1042e7b43c0552ba # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f29a5355c0..35a3e68b45 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bb53beb267ee5f5836020a58f32f1bed8deb587890eef9a6e034dad53f8c3f42 +6b9007cb30257ca97de74dec1df47f46f238f034083517a51c24334e4bd30663 diff --git a/test/speedtest.tcl b/test/speedtest.tcl index d201297158..1ad92d9ab0 100755 --- a/test/speedtest.tcl +++ b/test/speedtest.tcl @@ -27,6 +27,7 @@ Other options include: --lookaside N SZ Lookahead uses N slots of SZ bytes each. --pagesize N Use N as the page size. --quiet | -q "Quite". Put results in file but don't pop up editor + --size N Change the test size. 100 means 100%. Default: 5. --testset TEST Specify the specific testset to use. The default is "mix1". Other options include: "main", "json", "cte", "orm", "fp", "rtree". @@ -78,6 +79,14 @@ for {set i 0} {$i<[llength $argv]} {incr i} { incr i set testset [lindex $argv $i] } + -size - + --size { + incr i + set newsize [lindex $argv $i] + if {$newsize<1} {set newsize 1} + set speedtestflags \ + [regsub {.-size \d+} $speedtestflags "-size $newsize"] + } -n - -dryrun - --dryrun { From 0a4af54a7e67e3cf87a7cec44d80870f5df260cf Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 10 Feb 2025 19:48:13 +0000 Subject: [PATCH 36/72] Remove a pointless line of code. FossilOrigin-Name: 57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b4d216617b..68312e890c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s--size\soption\sto\sthe\stest/speedtest.tcl\sscript. -D 2025-02-10T19:12:18.297 +C Remove\sa\spointless\sline\sof\scode. +D 2025-02-10T19:48:13.176 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -730,7 +730,7 @@ F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c 15fabfb67261e298a39fe61457f3cfa24148d9ca8d02f4dff385feb5cf523ea7 +F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c b2fb33139972d7d65640b27ea962a49f1616265428001090cab39fcf270228e1 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bb53beb267ee5f5836020a58f32f1bed8deb587890eef9a6e034dad53f8c3f42 -R 00ccd32b91c1afa4d9f2520464e4c3e9 +P 6b9007cb30257ca97de74dec1df47f46f238f034083517a51c24334e4bd30663 +R 6d33e5e79434d78cc0854681af5e3875 U drh -Z c42977e3dfb38afa1042e7b43c0552ba +Z 4cd996db652c357ad0cb2f7e1b69e405 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 35a3e68b45..862aaf2925 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6b9007cb30257ca97de74dec1df47f46f238f034083517a51c24334e4bd30663 +57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0 diff --git a/src/expr.c b/src/expr.c index df47e34593..3011fcd9ad 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1849,7 +1849,6 @@ ExprList *sqlite3ExprListDup(sqlite3 *db, const ExprList *p, int flags){ } pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName); pItem->fg = pOldItem->fg; - pItem->fg.done = 0; pItem->u = pOldItem->u; } return pNew; From df9b89932f39a84da9f88603d80b5a1fa9f0e771 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 13:00:40 +0000 Subject: [PATCH 37/72] Adapt [https://fossil-scm.org/home/info/3bff7b92d6d|Fossil SCM patch 3bff7b92d6d], applying -lrt for platforms which need it for one of {fdatasync, nanosleep}. FossilOrigin-Name: 1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 --- Makefile.in | 1 + autoconf/Makefile.in | 3 ++- autosetup/sqlite-config.tcl | 12 +++++++++--- main.mk | 3 ++- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Makefile.in b/Makefile.in index b932f56e20..59a62d0618 100644 --- a/Makefile.in +++ b/Makefile.in @@ -118,6 +118,7 @@ LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ LDFLAGS.readline = @LDFLAGS_READLINE@ CFLAGS.readline = @CFLAGS_READLINE@ LDFLAGS.icu = @LDFLAGS_ICU@ +LDFLAGS.rt = @LDFLAGS_RT@ CFLAGS.icu = @CFLAGS_ICU@ LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 16e60879ea..8e09b9c610 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -67,6 +67,7 @@ LDFLAGS.pthread = @LDFLAGS_PTHREAD@ LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ LDFLAGS.readline = @LDFLAGS_READLINE@ CFLAGS.readline = @CFLAGS_READLINE@ +LDFLAGS.rt = @LDFLAGS_RT@ LDFLAGS.icu = @LDFLAGS_ICU@ CFLAGS.icu = @CFLAGS_ICU@ @@ -135,7 +136,7 @@ LDFLAGS.libsqlite3 = \ $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ $(LDFLAGS.math) $(LDFLAGS.dlopen) \ $(LDFLAGS.zlib) $(LDFLAGS.icu) \ - $(LDFLAGS.configure) + $(LDFLAGS.rt) $(LDFLAGS.configure) CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS) sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 904c439e0b..040d8d8b2d 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -187,9 +187,15 @@ proc sqlite-check-common-system-deps {} { cc-check-functions gmtime_r isnan localtime_r localtime_s \ malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64 - proj-check-function-in-lib fdatasync rt - define LDFLAGS_FDATASYNC [get-define lib_fdatasync] - undefine lib_fdatasync + set ldrt "" + # Collapse funcs from librt into LDFLAGS_RT. + # Some systems (ex: SunOS) require -lrt in order to use nanosleep + foreach func {fdatasync nanosleep} { + if {[proj-check-function-in-lib $func rt]} { + lappend ldrt [get-define lib_${func}] + } + } + define LDFLAGS_RT [join [lsort -unique $ldrt] ""] # # Check for needed/wanted headers diff --git a/main.mk b/main.mk index f5d8185f71..9eec5495ee 100644 --- a/main.mk +++ b/main.mk @@ -163,6 +163,7 @@ LDFLAGS.rpath ?= -Wl,-rpath -Wl,$(prefix)/lib LDFLAGS.pthread ?= -lpthread LDFLAGS.dlopen ?= -ldl LDFLAGS.shlib ?= -shared +LDFLAGS.rt ?= # nanosleep on some platforms LDFLAGS.icu ?= # -licui18n -licuuc -licudata CFLAGS.icu ?= LDFLAGS.libsqlite3.soname ?= # see https://sqlite.org/src/forumpost/5a3b44f510df8ded @@ -413,7 +414,7 @@ LDFLAGS.libsqlite3 = \ $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ $(LDFLAGS.math) $(LDFLAGS.dlopen) \ $(LDFLAGS.zlib) $(LDFLAGS.icu) \ - $(LDFLAGS.configure) + $(LDFLAGS.rt) $(LDFLAGS.configure) # # $(install-dir.XYZ) = dirs for installation. diff --git a/manifest b/manifest index 68312e890c..f9ac5ccf3a 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Remove\sa\spointless\sline\sof\scode. -D 2025-02-10T19:48:13.176 +C Adapt\s[https://fossil-scm.org/home/info/3bff7b92d6d|Fossil\sSCM\spatch\s3bff7b92d6d],\sapplying\s-lrt\sfor\splatforms\swhich\sneed\sit\sfor\sone\sof\s{fdatasync,\snanosleep}. +D 2025-02-11T13:00:40.707 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 63c4d6e535dac4b7f6a6ffa566c96e3d68fa7f244799c38ee1e3d59305c5b55b +F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc 990e4ea94a417135d1b2fd35550997c3f40fc1758bd7546bd17c0f4312f0babc F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in f706b48abb13553ecc5034d5fc296d424fd36d73c222285b7590004dec508925 +F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 341c2751f42c6c8eeeae50bec13d2bb28db73ca2c8b9b97598332aed02e0a71b +F autosetup/sqlite-config.tcl 9b3ae79286705077003f0b54bb9d2cd388f9bef5017707cc73f0f90ba56ce865 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 7c9df07a41c406a5fbe4e7e4021f29fa4f18821d61354721fd0435fc24f95321 +F main.mk c85055d36c36c188cee94cabe2e252cd912d10d1a9d62af477e855533b9531b2 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6b9007cb30257ca97de74dec1df47f46f238f034083517a51c24334e4bd30663 -R 6d33e5e79434d78cc0854681af5e3875 -U drh -Z 4cd996db652c357ad0cb2f7e1b69e405 +P 57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0 +R 914d530882ce85285895c4ba17cd5bb4 +U stephan +Z 452df3b98ff1feca6a8fd2421b0c5ff6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 862aaf2925..834fa7d6b4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0 +1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 From 62e1d44846baa68cdfcdcbdd58fcb4483cc5de47 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 13:13:46 +0000 Subject: [PATCH 38/72] Make the --out-implib support ([6092b0b86bf93a3d]) specifically opt-in because the feature check for it passes on some platforms where it is not recognized at link-time. FossilOrigin-Name: 75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c --- auto.def | 8 ++++++-- autoconf/auto.def | 4 ++++ autosetup/sqlite-config.tcl | 19 +++++++++++++------ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/auto.def b/auto.def index 3a5a2f64c1..6274d79b68 100644 --- a/auto.def +++ b/auto.def @@ -198,6 +198,9 @@ set flags { gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} + # + # soname:=legacy => # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded {SONAME for libsqlite3.so. "none", or not using this flag, sets no @@ -207,8 +210,9 @@ set flags { suffix which gets applied to "libsqlite3.so.", e.g. --soname=9.10 equates to "libsqlite3.so.9.10". } - dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} - # + out-implib=0 => + {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + # } if {"" ne $::sqliteConfig(dump-defines-json)} { lappend flags \ diff --git a/autoconf/auto.def b/autoconf/auto.def index 72f50094b8..42af1b459b 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -66,6 +66,7 @@ options { performance-critical loops. Never use --debug for production builds.} # + # soname:=legacy => # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded {SONAME for libsqlite3.so. "none", or not using this flag, sets no @@ -75,6 +76,9 @@ options { suffix which gets applied to "libsqlite3.so.", e.g. --soname=9.10 equates to "libsqlite3.so.9.10". } + out-implib=0 => + {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + # } sqlite-post-options-init diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 040d8d8b2d..1aaa8af374 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -965,16 +965,23 @@ proc sqlite-check-mac-cversion {} { # used for building an "import library .dll.a" file on some platforms # (e.g. mingw). Returns 1 if supported, else 0. # +# If the configure flag --out-implib is not used then this is a no-op. +# The feature is specifically opt-in because on some platforms the +# feature test will pass but using that flag will fail at link-time +# (e.g. OpenBSD). +# # Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2 proc sqlite-check-out-implib {} { define LDFLAGS_OUT_IMPLIB "" set rc 0 - cc-with {} { - set dll "libsqlite3[get-define TARGET_DLLEXT]" - set flags "-Wl,--out-implib,${dll}.a" - if {[cc-check-flags $flags]} { - define LDFLAGS_OUT_IMPLIB $flags - set rc 1 + if {[proj-opt-was-provided out-implib]} { + cc-with {} { + set dll "libsqlite3[get-define TARGET_DLLEXT]" + set flags "-Wl,--out-implib,${dll}.a" + if {[cc-check-flags $flags]} { + define LDFLAGS_OUT_IMPLIB $flags + set rc 1 + } } } return $rc diff --git a/manifest b/manifest index f9ac5ccf3a..77a1282113 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adapt\s[https://fossil-scm.org/home/info/3bff7b92d6d|Fossil\sSCM\spatch\s3bff7b92d6d],\sapplying\s-lrt\sfor\splatforms\swhich\sneed\sit\sfor\sone\sof\s{fdatasync,\snanosleep}. -D 2025-02-11T13:00:40.707 +C Make\sthe\s--out-implib\ssupport\s([6092b0b86bf93a3d])\sspecifically\sopt-in\sbecause\sthe\sfeature\scheck\sfor\sit\spasses\son\ssome\splatforms\swhere\sit\sis\snot\srecognized\sat\slink-time. +D 2025-02-11T13:13:46.626 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def fdd6965e06bce02a8b9f9ed57a52d05bcbec4b56e4bef2174866bb5713c65fda +F auto.def ccf74471ec89edfd5bf942fd6d60fc8ce09f7aa7527d668a1ac44d1bbbcb412d F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 71dde17158afcd6fb097b66853371991bb6ca5517b034e2efa9f0c47a2e730f2 +F autoconf/auto.def f468a32e6f57c52390e0fe2466974d0afaa1b0fc1d51cbacb4cb3950bd089f67 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 9b3ae79286705077003f0b54bb9d2cd388f9bef5017707cc73f0f90ba56ce865 +F autosetup/sqlite-config.tcl 62fd6e8782ecfb9f8e54cf2860e590ce9d8692218f03cfa8b25e87ff6b1d0b9b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0 -R 914d530882ce85285895c4ba17cd5bb4 +P 1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 +R fdc42f738677b90118628cf2f1a344a1 U stephan -Z 452df3b98ff1feca6a8fd2421b0c5ff6 +Z 712b8acba7b833aec2f3ddadc507080f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 834fa7d6b4..d8bcef0a58 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 +75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c From ba8e3ca139f65c7cae79bcf905032705ddd765f7 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 17:10:10 +0000 Subject: [PATCH 39/72] Move the configure flags definition and handling into autosetup/sqlite-config.tcl to avoid duplication between auto.def and autoconf/auto.def while still giving us a way to filter the canonical-tree-only flags out of the autoconf build. FossilOrigin-Name: 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 --- auto.def | 212 +----------------------------- autoconf/auto.def | 75 +---------- autosetup/sqlite-config.tcl | 251 ++++++++++++++++++++++++++++++++++-- manifest | 16 +-- manifest.uuid | 2 +- 5 files changed, 250 insertions(+), 306 deletions(-) diff --git a/auto.def b/auto.def index 6274d79b68..d9fa7018a3 100644 --- a/auto.def +++ b/auto.def @@ -12,217 +12,9 @@ # # JimTCL: https://jim.tcl.tk # + use sqlite-config - -if {[string first " " $autosetup(srcdir)] != -1} { - user-error "The pathname of the source tree\ - may not contain space characters" -} -if {[string first " " $autosetup(builddir)] != -1} { - user-error "The pathname of the build directory\ - may not contain space characters" -} - - -######################################################################## -# Regarding flag compatibility with the historical autotool configure -# script: -# -# A very long story made short, autosetup's --flag handling has -# some behaviors which make it impossible to implement 100% identical -# flags compared to the historical autotools build. The differences -# are documented here: -# -# 1) --debug is used by autosetup itself, but we patch it because -# decades of muscle memory expect --debug to apply to this code, -# not the configure script (details are in autosetup/README.md). -# -# 2) In autosetup, all flags starting with (--enable, --disable) are -# forced to be booleans and receive special handling in how they're -# resolved. Because of that we have to rename: -# -# 2.1) --enable-tempstore[=no] to --with-tempstore[=no], noting that -# it has four legal values, not two. -# -######################################################################## -# A gentle introduction to flags handling in autosetup -# -# Reference: https://msteveb.github.io/autosetup/developer/ -# -# All configure flags must be described in an 'options' call, which -# must appear very early on in this script. The general syntax is: -# -# FLAG => {Help text} -# -# Where FLAG can have any of the following formats: -# -# boolopt => "a boolean option which defaults to disabled" -# boolopt2=1 => "a boolean option which defaults to enabled" -# stringopt: => "an option which takes an argument, e.g. --stringopt=value" -# stringopt2:=value => "an option where the argument is optional and defaults to 'value'" -# optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help" -# -# Autosetup does no small amount of specialized handling for flags, -# especially booleans. Each bool-type --FLAG implicitly gets -# --enable-FLAG and --disable-FLAG forms. e.g. we define a flag -# "readline", which will be interpreted in one of two ways, depending -# on how it's invoked and how its default is defined: -# -# --enable-readline ==> boolean true -# --disable-readline ==> boolean false -# -# Passing --readline or --readline=1 is equivalent to passing -# --enable-readline, and --readline=0 is equivalent to -# --disable-readline. -# -# The behavior described above can lead lead to some confusion when -# writing help text. For example: -# -# options { json=1 {Disable JSON functions} } -# -# The reason the help text says "disable" is because a boolean option -# which defaults to true is, in the --help text, rendered as: -# -# --disable-json Disable JSON functions -# -# Whereas a bool flag which defaults to false will instead render as: -# -# --enable-FLAG -# -# Non-boolean flags, in contrast, use the names specifically given to -# them in the [options] invocation. e.g. "with-tcl" is the --with-tcl -# flag. -# -# Fetching values for flags: -# -# booleans: use one of: -# - [opt-bool FLAG] is autosetup's built-in command for this, but we -# have some convenience variants: -# - [proj-opt-truthy FLAG] -# - [proj-opt-if-truthy FLAG {THEN} {ELSE}] -# -# Non-boolean (i.e. string) flags: -# - [opt-val FLAG ?default?] -# - [opt-str ...] - see the docs in ./autosetup/autosetup -# -######################################################################## -set flags { - # When writing {help text blocks}, be aware that autosetup formats - # them differently (left-aligned, directly under the --flag) if the - # block starts with a newline. It does NOT expand vars and commands, - # but we use a [subst] call below which will replace (only) var - # refs. - - # - shared=1 => {Disable build of shared libary} - static=1 => {Disable build of static library (mostly)} - amalgamation=1 => {Disable the amalgamation and instead build all files separately.} - # - # - threadsafe=1 => {Disable mutexing} - with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - largefile=1 => {Disable large file support} - load-extension=1 => {Disable loading of external extensions} - math=1 => {Disable math functions} - json=1 => {Disable JSON functions} - memsys5 => {Enable MEMSYS5} - memsys3 => {Enable MEMSYS3} - fts3 => {Enable the FTS3 extension} - fts4 => {Enable the FTS4 extension} - fts5 => {Enable the FTS5 extension} - update-limit => {Enable the UPDATE/DELETE LIMIT clause} - geopoly => {Enable the GEOPOLY extension} - rtree => {Enable the RTREE extension} - session => {Enable the SESSION extension} - all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} - # - # - with-tcl:DIR => - {Directory containing tclConfig.sh or a directory one level up from - that, from which we can derive a directory containing tclConfig.sh. - A dir name of "prefix" is equivalent to the directory specified by - the --prefix flag.} - with-tclsh:PATH => - {Full pathname of tclsh to use. It is used for (A) trying to find - tclConfig.sh and (B) all TCL-based code generation. Warning: if - its containing dir has multiple tclsh versions, it may select the - wrong tclConfig.sh!} - tcl=1 => - {Disable components which require TCL, including all tests. - This tree requires TCL for code generation but can use the in-tree - copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the - test code require a canonical tclsh.} - # - # - readline=1 => {Disable readline support} - # --with-readline-lib is a backwards-compatible alias for - # --with-readline-ldflags - with-readline-lib: - with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} - # --with-readline-inc is a backwards-compatible alias for - # --with-readline-cflags. - with-readline-inc: - with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} - with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} - # - # - with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} - with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} - # - # - with-wasi-sdk:=/opt/wasi-sdk - => {Top-most dir of the wasi-sdk for a WASI build} - with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} - # - # - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. - with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} - dev => {Enable dev-mode build: automatically enables certain other flags} - test-status => {Enable status of tests} - gcov=0 => {Enable coverage testing using gcov} - linemacros => {Enable #line macros in the amalgamation} - dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} - dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} - # - # - soname:=legacy => - # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} - # -} -if {"" ne $::sqliteConfig(dump-defines-json)} { - lappend flags \ - defines-json-include-lowercase=0 \ - => {Include lower-case defines (primarily system paths) in $::sqliteConfig(dump-defines-json)} -} - -options [subst -nobackslashes -nocommands $flags] -unset flags -sqlite-post-options-init +sqlite-config-bootstrap canonical sqlite-setup-default-cflags proj-if-opt-truthy dev { diff --git a/autoconf/auto.def b/autoconf/auto.def index 42af1b459b..8732f74137 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,80 +8,7 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config - -options { - # - static=1 => {Disable build of static library} - shared=1 => {Disable build of shared library} - # - # - threadsafe=1 => {Disable mutexing} - with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - load-extension=1 => {Disable loading of external extensions} - math=1 => {Disable math functions} - json=1 => {Disable JSON functions} - memsys5 => {Enable MEMSYS5} - memsys3 => {Enable MEMSYS3} - fts3 => {Enable the FTS3 extension} - fts4 => {Enable the FTS4 extension} - fts5 => {Enable the FTS5 extension} - update-limit => {Enable the UPDATE/DELETE LIMIT clause} - geopoly => {Enable the GEOPOLY extension} - rtree => {Enable the RTREE extension} - session => {Enable the SESSION extension} - all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} - # - # - readline=1 => {Disable readline support} - # --with-readline-lib is a backwards-compatible alias for - # --with-readline-ldflags - with-readline-lib: - with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} - # --with-readline-inc is a backwards-compatible alias for - # --with-readline-cflags. - with-readline-inc: - with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} - with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} - # - # - with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} - with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} - # - # - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. - with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - # - # - soname:=legacy => - # --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} - # -} - -sqlite-post-options-init +sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1aaa8af374..f474fe7b82 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -3,6 +3,15 @@ # that they can be reused in the TEA sub-tree. This file requires # functions from proj.tcl. +if {[string first " " $autosetup(srcdir)] != -1} { + user-error "The pathname of the source tree\ + may not contain space characters" +} +if {[string first " " $autosetup(builddir)] != -1} { + user-error "The pathname of the build directory\ + may not contain space characters" +} + use cc cc-db cc-shared cc-lib pkg-config proj # @@ -22,15 +31,6 @@ array set sqliteConfig [proj-strip-hash-comments { # Output file for --dump-defines. Intended only for build debugging # and not part of the public build interface. dump-defines-txt ./config.defines.txt - # - # Output file for --dump-defines-json. This is the autosetup - # counterpart of the historical "DEFS" var which was generated by - # the autotools in the pre-processed autotools builds (but not in - # the canonical tree). Generation of this file is disabled (via an - # empty file name) until/unless someone voices a specific interest - # in it. The original motivating use case is handled fine by - # sqlite_cfg.h. - dump-defines-json "" }] # @@ -41,6 +41,231 @@ array set sqliteConfig [proj-strip-hash-comments { # set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] +######################################################################## +# Processes all configure --flags for this build $buildMode must be +# either "canonical" or "autoconf", and others may be added in the +# future. +proc sqlite-config-bootstrap {buildMode} { + if {$buildMode ni {canonical autoconf}} { + user-error "Invalid build mode: $buildMode. Expecting one of: canonical, autoconf" + } + ######################################################################## + # A gentle introduction to flags handling in autosetup + # + # Reference: https://msteveb.github.io/autosetup/developer/ + # + # All configure flags must be described in an 'options' call. The + # general syntax is: + # + # FLAG => {Help text} + # + # Where FLAG can have any of the following formats: + # + # boolopt => "a boolean option which defaults to disabled" + # boolopt2=1 => "a boolean option which defaults to enabled" + # stringopt: => "an option which takes an argument, e.g. --stringopt=value" + # stringopt2:=value => "an option where the argument is optional and defaults to 'value'" + # optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help" + # + # Autosetup does no small amount of specialized handling for flags, + # especially booleans. Each bool-type --FLAG implicitly gets + # --enable-FLAG and --disable-FLAG forms. That can lead lead to some + # confusion when writing help text. For example: + # + # options { json=1 {Disable JSON functions} } + # + # The reason the help text says "disable" is because a boolean option + # which defaults to true is, in the --help text, rendered as: + # + # --disable-json Disable JSON functions + # + # Whereas a bool flag which defaults to false will instead render as: + # + # --enable-FLAG + # + # Non-boolean flags, in contrast, use the names specifically given to + # them in the [options] invocation. e.g. "with-tcl" is the --with-tcl + # flag. + # + # Fetching values for flags: + # + # booleans: use one of: + # - [opt-bool FLAG] is autosetup's built-in command for this, but we + # have some convenience variants: + # - [proj-opt-truthy FLAG] + # - [proj-opt-if-truthy FLAG {THEN} {ELSE}] + # + # Non-boolean (i.e. string) flags: + # - [opt-val FLAG ?default?] + # - [opt-str ...] - see the docs in ./autosetup/autosetup + # + # [proj-opt-was-provided] can be used to determine whether a flag was + # explicitly provided, which is often useful for distinguishing from + # the case of a default value. + ######################################################################## + set allFlags { + # Structure: a list of M {Z}, where M is a descriptive option + # group name and Z is a list of X Y pairs. X is a list of + # $buildMode name(s) to which these flags apply, or {*} to apply + # to all builds. Y is a {block} in the form expected by + # autosetup's [options] command. Each block which is applicable + # to $buildMode is appended to a new list before that list is + # passed on to [options]. The order of each Y and sub-Y is + # retained, which is significant for rendering of --help. + + # When writing {help text blocks}, be aware that autosetup formats + # them differently (left-aligned, directly under the --flag) if the + # block starts with a newline. It does NOT expand vars and commands, + # but we use a [subst] call below which will replace (only) var + # refs. + + build-modes { + {*} { + shared=1 => {Disable build of shared libary} + static=1 => {Disable build of static library (mostly)} + } + {canonical} { + amalgamation=1 => {Disable the amalgamation and instead build all files separately.} + } + } + + lib-features { + {*} { + threadsafe=1 => {Disable mutexing} + with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} + largefile=1 => {Disable large file support} + load-extension=1 => {Disable loading of external extensions} + math=1 => {Disable math functions} + json=1 => {Disable JSON functions} + memsys5 => {Enable MEMSYS5} + memsys3 => {Enable MEMSYS3} + fts3 => {Enable the FTS3 extension} + fts4 => {Enable the FTS4 extension} + fts5 => {Enable the FTS5 extension} + update-limit => {Enable the UPDATE/DELETE LIMIT clause} + geopoly => {Enable the GEOPOLY extension} + rtree => {Enable the RTREE extension} + session => {Enable the SESSION extension} + all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} + } + } + + tcl { + {canonical} { + with-tcl:DIR => + {Directory containing tclConfig.sh or a directory one level up from + that, from which we can derive a directory containing tclConfig.sh. + A dir name of "prefix" is equivalent to the directory specified by + the --prefix flag.} + with-tclsh:PATH => + {Full pathname of tclsh to use. It is used for (A) trying to find + tclConfig.sh and (B) all TCL-based code generation. Warning: if + its containing dir has multiple tclsh versions, it may select the + wrong tclConfig.sh!} + tcl=1 => + {Disable components which require TCL, including all tests. + This tree requires TCL for code generation but can use the in-tree + copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the + test code require a canonical tclsh.} + } + } + + line-editing { + {*} { + readline=1 => {Disable readline support} + # --with-readline-lib is a backwards-compatible alias for + # --with-readline-ldflags + with-readline-lib: + with-readline-ldflags:=auto + => {Readline LDFLAGS, e.g. -lreadline -lncurses} + # --with-readline-inc is a backwards-compatible alias for + # --with-readline-cflags. + with-readline-inc: + with-readline-cflags:=auto + => {Readline CFLAGS, e.g. -I/path/to/includes} + with-readline-header:PATH + => {Full path to readline.h, from which --with-readline-cflags will be derived} + with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} + editline=0 => {Enable BSD editline support} + } + } + + icu { + {*} { + with-icu-ldflags:LDFLAGS + => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} + with-icu-cflags:CFLAGS + => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} + with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} + icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} + } + } + + alternative-builds { + {canonical} { + with-wasi-sdk:=/opt/wasi-sdk + => {Top-most dir of the wasi-sdk for a WASI build} + with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} + } + } + + # Note that using the --debug/--enable-debug flag here requires patching + # autosetup/autosetup to rename the --debug to --autosetup-debug. + developer { + {*} { + with-debug=0 + debug=0 => + {Enable debug build flags. This option will impact performance by + as much as 4x, as it includes large numbers of assert()s in + performance-critical loops. Never use --debug for production + builds.} + scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} + } + {canonical} { + dev => {Enable dev-mode build: automatically enables certain other flags} + test-status => {Enable status of tests} + gcov=0 => {Enable coverage testing using gcov} + linemacros => {Enable #line macros in the amalgamation} + dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + } + {*} { + dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} + } + } + + packaging { + {*} { + # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded + soname:=legacy => + {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10". + } + out-implib=0 => + {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + } + } + }; # $allOpts + + set opts {} + foreach {group XY} [subst -nobackslashes -nocommands [proj-strip-hash-comments $allFlags]] { + foreach {X Y} $XY { + if { $buildMode in $X || "*" in $X } { + foreach y $Y { + lappend opts $y + } + } + } + } + #puts "options = $opts" + #exit 0 + options $opts + sqlite-post-options-init +}; # sqlite-config-bootstrap + ######################################################################## # Runs some common initialization which must happen immediately after # autosetup's [options] function is called. This is also a convenient @@ -1472,10 +1697,10 @@ proc sqlite-dump-defines {} { -array {*.list} -auto {OPT_* PACKAGE_* HAVE_*} } - if {[opt-bool defines-json-include-lowercase]} { - lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends - lappend dumpDefsOpt -auto {[a-z]*} - } +# if {$::sqliteConfig(dump-defines-json-include-lowercase)} { +# lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends +# lappend dumpDefsOpt -auto {[a-z]*} +# } lappend dumpDefsOpt -none * proj-dump-defs-json $::sqliteConfig(dump-defines-json) {*}$dumpDefsOpt undefine OPT_FEATURE_FLAGS.list diff --git a/manifest b/manifest index 77a1282113..4248868afc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\s--out-implib\ssupport\s([6092b0b86bf93a3d])\sspecifically\sopt-in\sbecause\sthe\sfeature\scheck\sfor\sit\spasses\son\ssome\splatforms\swhere\sit\sis\snot\srecognized\sat\slink-time. -D 2025-02-11T13:13:46.626 +C Move\sthe\sconfigure\sflags\sdefinition\sand\shandling\sinto\sautosetup/sqlite-config.tcl\sto\savoid\sduplication\sbetween\sauto.def\sand\sautoconf/auto.def\swhile\sstill\sgiving\sus\sa\sway\sto\sfilter\sthe\scanonical-tree-only\sflags\sout\sof\sthe\sautoconf\sbuild. +D 2025-02-11T17:10:10.238 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def ccf74471ec89edfd5bf942fd6d60fc8ce09f7aa7527d668a1ac44d1bbbcb412d +F auto.def d06ef819324fc157e231413ad55d1cb26ad4d83bfafa14a1daa3b9d97e33e771 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def f468a32e6f57c52390e0fe2466974d0afaa1b0fc1d51cbacb4cb3950bd089f67 +F autoconf/auto.def db6c33338294a8b10e205a9081c540b90620b12d916c2fd728a8939fb6fdd97b F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 62fd6e8782ecfb9f8e54cf2860e590ce9d8692218f03cfa8b25e87ff6b1d0b9b +F autosetup/sqlite-config.tcl 297f5b10a46b46d0dd417a937595916d3868c5fe70af59d7c52516d0b31d6956 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1768de6e9e2c6ff3a9ee29fa6f488fb3d23a3599195ac7d1b09e61c02b7d18b3 -R fdc42f738677b90118628cf2f1a344a1 +P 75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c +R b6935973a927dd6f6aec058ecd42249d U stephan -Z 712b8acba7b833aec2f3ddadc507080f +Z 9498d37db1e807d01c315ee284e7bf43 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8bcef0a58..0f5e4505b2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c +9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 From db253d086235cab3912cf5ae534e7e90dc2b2531 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 11 Feb 2025 17:20:12 +0000 Subject: [PATCH 40/72] Rename a configure-internal function and fix handling of --dump-defines for the autoconf bundle. FossilOrigin-Name: 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f --- auto.def | 3 +-- autoconf/auto.def | 2 +- autosetup/sqlite-config.tcl | 8 +++++++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/auto.def b/auto.def index d9fa7018a3..981b455954 100644 --- a/auto.def +++ b/auto.def @@ -71,5 +71,4 @@ sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu sqlite-handle-emsdk -sqlite-common-late-stage-config -sqlite-dump-defines +sqlite-config-finalize diff --git a/autoconf/auto.def b/autoconf/auto.def index 8732f74137..c2e02fe3d8 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -25,4 +25,4 @@ sqlite-handle-icu define ENABLE_LIB_SHARED [opt-bool shared] define ENABLE_LIB_STATIC [opt-bool static] -sqlite-common-late-stage-config +sqlite-config-finalize diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index f474fe7b82..3d3f892bf0 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -31,6 +31,11 @@ array set sqliteConfig [proj-strip-hash-comments { # Output file for --dump-defines. Intended only for build debugging # and not part of the public build interface. dump-defines-txt ./config.defines.txt + # + # If not empty then --dump-defines will dump not only + # (dump-defines-txt) but also a JSON file named after this option's + # value. + dump-defines-json "" }] # @@ -1215,11 +1220,12 @@ proc sqlite-check-out-implib {} { ######################################################################## # Performs late-stage config steps common to both the canonical and # autoconf bundle builds. -proc sqlite-common-late-stage-config {} { +proc sqlite-config-finalize {} { sqlite-check-mac-cversion sqlite-check-out-implib sqlite-process-dot-in-files sqlite-post-config-validation + sqlite-dump-defines } ######################################################################## diff --git a/manifest b/manifest index 4248868afc..615d5d04e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sthe\sconfigure\sflags\sdefinition\sand\shandling\sinto\sautosetup/sqlite-config.tcl\sto\savoid\sduplication\sbetween\sauto.def\sand\sautoconf/auto.def\swhile\sstill\sgiving\sus\sa\sway\sto\sfilter\sthe\scanonical-tree-only\sflags\sout\sof\sthe\sautoconf\sbuild. -D 2025-02-11T17:10:10.238 +C Rename\sa\sconfigure-internal\sfunction\sand\sfix\shandling\sof\s--dump-defines\sfor\sthe\sautoconf\sbundle. +D 2025-02-11T17:20:12.606 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def d06ef819324fc157e231413ad55d1cb26ad4d83bfafa14a1daa3b9d97e33e771 +F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def db6c33338294a8b10e205a9081c540b90620b12d916c2fd728a8939fb6fdd97b +F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 297f5b10a46b46d0dd417a937595916d3868c5fe70af59d7c52516d0b31d6956 +F autosetup/sqlite-config.tcl 40107b6a75a2ee367359b2adeb2221e118f5dfa6f10b0a0c0f237fc59fbedef3 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 75535f2355b3b2e83dd57f4c30340af98c8dbcfe6ff1e9be17d23bd30d7d766c -R b6935973a927dd6f6aec058ecd42249d +P 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 +R 76e33179af2e988165dad18e5266ff58 U stephan -Z 9498d37db1e807d01c315ee284e7bf43 +Z 2f25ba1e1af4da40884b8449b6a5c47c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0f5e4505b2..37bfe81875 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 +6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f From 374c6a451e09bc6c14ef7e671bf4c788bfdfefef Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 11 Feb 2025 19:40:19 +0000 Subject: [PATCH 41/72] Omit the src/ctime.c source file, since it is automatically generated by a TCL script. Instead, add rules to the various makefiles to generate ctime.c on demand. FossilOrigin-Name: 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 --- Makefile.msc | 11 +- main.mk | 12 +- manifest | 21 +- manifest.uuid | 2 +- src/ctime.c | 796 ----------------------------------------- tool/mkctimec.tcl | 10 +- tool/srctree-check.tcl | 17 - 7 files changed, 31 insertions(+), 838 deletions(-) delete mode 100644 src/ctime.c diff --git a/Makefile.msc b/Makefile.msc index 93b0935b1e..3618ae0bcc 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1396,7 +1396,7 @@ SRC00 = \ $(TOP)\src\build.c \ $(TOP)\src\callback.c \ $(TOP)\src\complete.c \ - $(TOP)\src\ctime.c \ + ctime.c \ $(TOP)\src\date.c \ $(TOP)\src\dbpage.c \ $(TOP)\src\dbstat.c \ @@ -2099,8 +2099,11 @@ callback.lo: $(TOP)\src\callback.c $(HDR) complete.lo: $(TOP)\src\complete.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c -ctime.lo: $(TOP)\src\ctime.c $(HDR) - $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c +ctime.c: $(TOP)\tool\mkctimec.tcl $(JIM_TCLSH) + $(JIM_TCLSH) $(TOP)\tool\mkctimec.tcl + +ctime.lo: ctime.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c ctime.c date.lo: $(TOP)\src\date.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c @@ -2812,7 +2815,7 @@ moreclean: clean clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL # <> del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL diff --git a/main.mk b/main.mk index 9eec5495ee..82f44a0306 100644 --- a/main.mk +++ b/main.mk @@ -548,7 +548,7 @@ SRC = \ $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/complete.c \ - $(TOP)/src/ctime.c \ + ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ @@ -792,7 +792,7 @@ TESTSRC2 = \ $(TOP)/src/bitvec.c \ $(TOP)/src/btree.c \ $(TOP)/src/build.c \ - $(TOP)/src/ctime.c \ + ctime.c \ $(TOP)/src/date.c \ $(TOP)/src/dbpage.c \ $(TOP)/src/dbstat.c \ @@ -1137,8 +1137,11 @@ callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON) complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/complete.c -ctime.o: $(TOP)/src/ctime.c $(DEPS_OBJ_COMMON) - $(T.cc.sqlite) -c $(TOP)/src/ctime.c +ctime.c: $(TOP)/tool/mkctimec.tcl + $(TCLSH_CMD) $(TOP)/tool/mkctimec.tcl + +ctime.o: ctime.c $(DEPS_OBJ_COMMON) + $(T.cc.sqlite) -c ctime.c date.o: $(TOP)/src/date.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/date.c @@ -2353,6 +2356,7 @@ tidy: tidy-. rm -f src-verify$(B.exe) rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh) rm -f sqlite3rc.h sqlite3.def + rm -f ctime.c # # Removes build products and test logs. Retains ./configure outputs. diff --git a/manifest b/manifest index 615d5d04e7..9c05778077 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Rename\sa\sconfigure-internal\sfunction\sand\sfix\shandling\sof\s--dump-defines\sfor\sthe\sautoconf\sbundle. -D 2025-02-11T17:20:12.606 +C Omit\sthe\ssrc/ctime.c\ssource\sfile,\ssince\sit\sis\sautomatically\sgenerated\sby\sa\sTCL\nscript.\s\sInstead,\sadd\srules\sto\sthe\svarious\smakefiles\sto\sgenerate\sctime.c\son\ndemand. +D 2025-02-11T19:40:19.136 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc 990e4ea94a417135d1b2fd35550997c3f40fc1758bd7546bd17c0f4312f0babc +F Makefile.msc 3715ce0974666c8cafe391e2383a902956b983aa08bfea1cd57e98ddd27a35bb F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk c85055d36c36c188cee94cabe2e252cd912d10d1a9d62af477e855533b9531b2 +F main.mk b7d36efaac04a13a85008c694762bf7b58de748dc1565c70a4dd797a944c9f9b F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -725,7 +725,6 @@ F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b F src/build.c 602fc45ea6301a3dc03ec20a9f9b294c492b7e1766ae96651f2ba8044dc445a6 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e -F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c @@ -2146,7 +2145,7 @@ F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a19 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a F tool/mkautoconfamal.sh 14d2144043c6455958012f92324f4ce7c90a261b5daa2f2c7509498468475f8d F tool/mkccode.tcl 210159febe0ef0ecbc53c79833500663ceaba0115b2b374405818dc835b5f84b x -F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x +F tool/mkctimec.tcl b57ab5c43cf6a46ba4030027da1cc73d7839e7b78da3b328545bc941bb62360b x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef @@ -2195,7 +2194,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 1f1f505835a4beca64c1751a7ebec5c41a1ddf22b1e80481345b95059eef6583 +F tool/srctree-check.tcl 5e40c7beaca50c3f29cd9c3aa8d6c9256359690ea0989174f097ace92d6390c2 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2209,8 +2208,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9978c87139b7b04208fd1f62121fc4e1e2080723fde69a2bbdca88769f4baf22 -R 76e33179af2e988165dad18e5266ff58 -U stephan -Z 2f25ba1e1af4da40884b8449b6a5c47c +P 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f +R e691176b85b17541b0449680ba0ba564 +U drh +Z 88df15dbb3e7e15a4c35762ecebc556a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 37bfe81875..25b7683b02 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f +958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 diff --git a/src/ctime.c b/src/ctime.c deleted file mode 100644 index 9f358bd27f..0000000000 --- a/src/ctime.c +++ /dev/null @@ -1,796 +0,0 @@ -/* DO NOT EDIT! -** This file is automatically generated by the script in the canonical -** SQLite source tree at tool/mkctimec.tcl. -** -** To modify this header, edit any of the various lists in that script -** which specify categories of generated conditionals in this file. -*/ - -/* -** 2010 February 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements routines used to report what compile-time options -** SQLite was built with. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ - -/* -** Include the configuration header output by 'configure' if we're using the -** autoconf-based build -*/ -#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "sqlite_cfg.h" -#define SQLITECONFIG_H 1 -#endif - -/* These macros are provided to "stringify" the value of the define -** for those options in which the value is meaningful. */ -#define CTIMEOPT_VAL_(opt) #opt -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) - -/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This -** option requires a separate macro because legal values contain a single -** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */ -#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2 -#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt) -#include "sqliteInt.h" - -/* -** An array of names of all compile-time options. This array should -** be sorted A-Z. -** -** This array looks large, but in a typical installation actually uses -** only a handful of compile-time options, so most times this array is usually -** rather short and uses little memory space. -*/ -static const char * const sqlite3azCompileOpt[] = { - -#ifdef SQLITE_32BIT_ROWID - "32BIT_ROWID", -#endif -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC - "4_BYTE_ALIGNED_MALLOC", -#endif -#ifdef SQLITE_ALLOW_COVERING_INDEX_SCAN -# if SQLITE_ALLOW_COVERING_INDEX_SCAN != 1 - "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), -# endif -#endif -#ifdef SQLITE_ALLOW_ROWID_IN_VIEW - "ALLOW_ROWID_IN_VIEW", -#endif -#ifdef SQLITE_ALLOW_URI_AUTHORITY - "ALLOW_URI_AUTHORITY", -#endif -#ifdef SQLITE_ATOMIC_INTRINSICS - "ATOMIC_INTRINSICS=" CTIMEOPT_VAL(SQLITE_ATOMIC_INTRINSICS), -#endif -#ifdef SQLITE_BITMASK_TYPE - "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE), -#endif -#ifdef SQLITE_BUG_COMPATIBLE_20160819 - "BUG_COMPATIBLE_20160819", -#endif -#ifdef SQLITE_CASE_SENSITIVE_LIKE - "CASE_SENSITIVE_LIKE", -#endif -#ifdef SQLITE_CHECK_PAGES - "CHECK_PAGES", -#endif -#if defined(__clang__) && defined(__clang_major__) - "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." - CTIMEOPT_VAL(__clang_minor__) "." - CTIMEOPT_VAL(__clang_patchlevel__), -#elif defined(_MSC_VER) - "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), -#elif defined(__GNUC__) && defined(__VERSION__) - "COMPILER=gcc-" __VERSION__, -#endif -#ifdef SQLITE_COVERAGE_TEST - "COVERAGE_TEST", -#endif -#ifdef SQLITE_DEBUG - "DEBUG", -#endif -#ifdef SQLITE_DEFAULT_AUTOMATIC_INDEX - "DEFAULT_AUTOMATIC_INDEX", -#endif -#ifdef SQLITE_DEFAULT_AUTOVACUUM - "DEFAULT_AUTOVACUUM", -#endif -#ifdef SQLITE_DEFAULT_CACHE_SIZE - "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE), -#endif -#ifdef SQLITE_DEFAULT_CKPTFULLFSYNC - "DEFAULT_CKPTFULLFSYNC", -#endif -#ifdef SQLITE_DEFAULT_FILE_FORMAT - "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT), -#endif -#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS - "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS), -#endif -#ifdef SQLITE_DEFAULT_FOREIGN_KEYS - "DEFAULT_FOREIGN_KEYS", -#endif -#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT - "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT), -#endif -#ifdef SQLITE_DEFAULT_LOCKING_MODE - "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), -#endif -#ifdef SQLITE_DEFAULT_LOOKASIDE - "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE), -#endif -#ifdef SQLITE_DEFAULT_MEMSTATUS -# if SQLITE_DEFAULT_MEMSTATUS != 1 - "DEFAULT_MEMSTATUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_MEMSTATUS), -# endif -#endif -#ifdef SQLITE_DEFAULT_MMAP_SIZE - "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PAGE_SIZE - "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PCACHE_INITSZ - "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ), -#endif -#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS - "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS), -#endif -#ifdef SQLITE_DEFAULT_RECURSIVE_TRIGGERS - "DEFAULT_RECURSIVE_TRIGGERS", -#endif -#ifdef SQLITE_DEFAULT_ROWEST - "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST), -#endif -#ifdef SQLITE_DEFAULT_SECTOR_SIZE - "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE), -#endif -#ifdef SQLITE_DEFAULT_SYNCHRONOUS - "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT - "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT), -#endif -#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS - "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WORKER_THREADS - "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS), -#endif -#ifdef SQLITE_DIRECT_OVERFLOW_READ - "DIRECT_OVERFLOW_READ", -#endif -#ifdef SQLITE_DISABLE_DIRSYNC - "DISABLE_DIRSYNC", -#endif -#ifdef SQLITE_DISABLE_FTS3_UNICODE - "DISABLE_FTS3_UNICODE", -#endif -#ifdef SQLITE_DISABLE_FTS4_DEFERRED - "DISABLE_FTS4_DEFERRED", -#endif -#ifdef SQLITE_DISABLE_INTRINSIC - "DISABLE_INTRINSIC", -#endif -#ifdef SQLITE_DISABLE_LFS - "DISABLE_LFS", -#endif -#ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS - "DISABLE_PAGECACHE_OVERFLOW_STATS", -#endif -#ifdef SQLITE_DISABLE_SKIPAHEAD_DISTINCT - "DISABLE_SKIPAHEAD_DISTINCT", -#endif -#ifdef SQLITE_DQS - "DQS=" CTIMEOPT_VAL(SQLITE_DQS), -#endif -#ifdef SQLITE_ENABLE_8_3_NAMES - "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), -#endif -#ifdef SQLITE_ENABLE_API_ARMOR - "ENABLE_API_ARMOR", -#endif -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - "ENABLE_ATOMIC_WRITE", -#endif -#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE - "ENABLE_BATCH_ATOMIC_WRITE", -#endif -#ifdef SQLITE_ENABLE_BYTECODE_VTAB - "ENABLE_BYTECODE_VTAB", -#endif -#ifdef SQLITE_ENABLE_CEROD - "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD), -#endif -#ifdef SQLITE_ENABLE_COLUMN_METADATA - "ENABLE_COLUMN_METADATA", -#endif -#ifdef SQLITE_ENABLE_COLUMN_USED_MASK - "ENABLE_COLUMN_USED_MASK", -#endif -#ifdef SQLITE_ENABLE_COSTMULT - "ENABLE_COSTMULT", -#endif -#ifdef SQLITE_ENABLE_CURSOR_HINTS - "ENABLE_CURSOR_HINTS", -#endif -#ifdef SQLITE_ENABLE_DBPAGE_VTAB - "ENABLE_DBPAGE_VTAB", -#endif -#ifdef SQLITE_ENABLE_DBSTAT_VTAB - "ENABLE_DBSTAT_VTAB", -#endif -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - "ENABLE_EXPENSIVE_ASSERT", -#endif -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - "ENABLE_EXPLAIN_COMMENTS", -#endif -#ifdef SQLITE_ENABLE_FTS3 - "ENABLE_FTS3", -#endif -#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS - "ENABLE_FTS3_PARENTHESIS", -#endif -#ifdef SQLITE_ENABLE_FTS3_TOKENIZER - "ENABLE_FTS3_TOKENIZER", -#endif -#ifdef SQLITE_ENABLE_FTS4 - "ENABLE_FTS4", -#endif -#ifdef SQLITE_ENABLE_FTS5 - "ENABLE_FTS5", -#endif -#ifdef SQLITE_ENABLE_GEOPOLY - "ENABLE_GEOPOLY", -#endif -#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS - "ENABLE_HIDDEN_COLUMNS", -#endif -#ifdef SQLITE_ENABLE_ICU - "ENABLE_ICU", -#endif -#ifdef SQLITE_ENABLE_IOTRACE - "ENABLE_IOTRACE", -#endif -#ifdef SQLITE_ENABLE_LOAD_EXTENSION - "ENABLE_LOAD_EXTENSION", -#endif -#ifdef SQLITE_ENABLE_LOCKING_STYLE - "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), -#endif -#ifdef SQLITE_ENABLE_MATH_FUNCTIONS - "ENABLE_MATH_FUNCTIONS", -#endif -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - "ENABLE_MEMORY_MANAGEMENT", -#endif -#ifdef SQLITE_ENABLE_MEMSYS3 - "ENABLE_MEMSYS3", -#endif -#ifdef SQLITE_ENABLE_MEMSYS5 - "ENABLE_MEMSYS5", -#endif -#ifdef SQLITE_ENABLE_MULTIPLEX - "ENABLE_MULTIPLEX", -#endif -#ifdef SQLITE_ENABLE_NORMALIZE - "ENABLE_NORMALIZE", -#endif -#ifdef SQLITE_ENABLE_NULL_TRIM - "ENABLE_NULL_TRIM", -#endif -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - "ENABLE_OFFSET_SQL_FUNC", -#endif -#ifdef SQLITE_ENABLE_ORDERED_SET_AGGREGATES - "ENABLE_ORDERED_SET_AGGREGATES", -#endif -#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK - "ENABLE_OVERSIZE_CELL_CHECK", -#endif -#ifdef SQLITE_ENABLE_PREUPDATE_HOOK - "ENABLE_PREUPDATE_HOOK", -#endif -#ifdef SQLITE_ENABLE_QPSG - "ENABLE_QPSG", -#endif -#ifdef SQLITE_ENABLE_RBU - "ENABLE_RBU", -#endif -#ifdef SQLITE_ENABLE_RTREE - "ENABLE_RTREE", -#endif -#ifdef SQLITE_ENABLE_SESSION - "ENABLE_SESSION", -#endif -#ifdef SQLITE_ENABLE_SNAPSHOT - "ENABLE_SNAPSHOT", -#endif -#ifdef SQLITE_ENABLE_SORTER_REFERENCES - "ENABLE_SORTER_REFERENCES", -#endif -#ifdef SQLITE_ENABLE_SQLLOG - "ENABLE_SQLLOG", -#endif -#ifdef SQLITE_ENABLE_STAT4 - "ENABLE_STAT4", -#endif -#ifdef SQLITE_ENABLE_STMTVTAB - "ENABLE_STMTVTAB", -#endif -#ifdef SQLITE_ENABLE_STMT_SCANSTATUS - "ENABLE_STMT_SCANSTATUS", -#endif -#ifdef SQLITE_ENABLE_TREETRACE - "ENABLE_TREETRACE", -#endif -#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - "ENABLE_UNKNOWN_SQL_FUNCTION", -#endif -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - "ENABLE_UNLOCK_NOTIFY", -#endif -#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT - "ENABLE_UPDATE_DELETE_LIMIT", -#endif -#ifdef SQLITE_ENABLE_URI_00_ERROR - "ENABLE_URI_00_ERROR", -#endif -#ifdef SQLITE_ENABLE_VFSTRACE - "ENABLE_VFSTRACE", -#endif -#ifdef SQLITE_ENABLE_WHERETRACE - "ENABLE_WHERETRACE", -#endif -#ifdef SQLITE_ENABLE_ZIPVFS - "ENABLE_ZIPVFS", -#endif -#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS - "EXPLAIN_ESTIMATED_ROWS", -#endif -#ifdef SQLITE_EXTRA_AUTOEXT - "EXTRA_AUTOEXT=" CTIMEOPT_VAL(SQLITE_EXTRA_AUTOEXT), -#endif -#ifdef SQLITE_EXTRA_IFNULLROW - "EXTRA_IFNULLROW", -#endif -#ifdef SQLITE_EXTRA_INIT - "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT), -#endif -#ifdef SQLITE_EXTRA_SHUTDOWN - "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN), -#endif -#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH - "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH), -#endif -#ifdef SQLITE_FTS5_ENABLE_TEST_MI - "FTS5_ENABLE_TEST_MI", -#endif -#ifdef SQLITE_FTS5_NO_WITHOUT_ROWID - "FTS5_NO_WITHOUT_ROWID", -#endif -#if HAVE_ISNAN || SQLITE_HAVE_ISNAN - "HAVE_ISNAN", -#endif -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX -# if SQLITE_HOMEGROWN_RECURSIVE_MUTEX != 1 - "HOMEGROWN_RECURSIVE_MUTEX=" CTIMEOPT_VAL(SQLITE_HOMEGROWN_RECURSIVE_MUTEX), -# endif -#endif -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS - "IGNORE_AFP_LOCK_ERRORS", -#endif -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - "IGNORE_FLOCK_LOCK_ERRORS", -#endif -#ifdef SQLITE_INLINE_MEMCPY - "INLINE_MEMCPY", -#endif -#ifdef SQLITE_INT64_TYPE - "INT64_TYPE", -#endif -#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX - "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX), -#endif -#ifdef SQLITE_LEGACY_JSON_VALID - "LEGACY_JSON_VALID", -#endif -#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS - "LIKE_DOESNT_MATCH_BLOBS", -#endif -#ifdef SQLITE_LOCK_TRACE - "LOCK_TRACE", -#endif -#ifdef SQLITE_LOG_CACHE_SPILL - "LOG_CACHE_SPILL", -#endif -#ifdef SQLITE_MALLOC_SOFT_LIMIT - "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT), -#endif -#ifdef SQLITE_MAX_ATTACHED - "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED), -#endif -#ifdef SQLITE_MAX_COLUMN - "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN), -#endif -#ifdef SQLITE_MAX_COMPOUND_SELECT - "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT), -#endif -#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE - "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_EXPR_DEPTH - "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH), -#endif -#ifdef SQLITE_MAX_FUNCTION_ARG - "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG), -#endif -#ifdef SQLITE_MAX_LENGTH - "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH), -#endif -#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH - "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH), -#endif -#ifdef SQLITE_MAX_MEMORY - "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE - "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE_ - "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_), -#endif -#ifdef SQLITE_MAX_PAGE_COUNT - "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT), -#endif -#ifdef SQLITE_MAX_PAGE_SIZE - "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_SCHEMA_RETRY - "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), -#endif -#ifdef SQLITE_MAX_SQL_LENGTH - "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH), -#endif -#ifdef SQLITE_MAX_TRIGGER_DEPTH - "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH), -#endif -#ifdef SQLITE_MAX_VARIABLE_NUMBER - "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER), -#endif -#ifdef SQLITE_MAX_VDBE_OP - "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP), -#endif -#ifdef SQLITE_MAX_WORKER_THREADS - "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS), -#endif -#ifdef SQLITE_MEMDEBUG - "MEMDEBUG", -#endif -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT - "MIXED_ENDIAN_64BIT_FLOAT", -#endif -#ifdef SQLITE_MMAP_READWRITE - "MMAP_READWRITE", -#endif -#ifdef SQLITE_MUTEX_NOOP - "MUTEX_NOOP", -#endif -#ifdef SQLITE_MUTEX_OMIT - "MUTEX_OMIT", -#endif -#ifdef SQLITE_MUTEX_PTHREADS - "MUTEX_PTHREADS", -#endif -#ifdef SQLITE_MUTEX_W32 - "MUTEX_W32", -#endif -#ifdef SQLITE_NEED_ERR_NAME - "NEED_ERR_NAME", -#endif -#ifdef SQLITE_NO_SYNC - "NO_SYNC", -#endif -#ifdef SQLITE_OMIT_ALTERTABLE - "OMIT_ALTERTABLE", -#endif -#ifdef SQLITE_OMIT_ANALYZE - "OMIT_ANALYZE", -#endif -#ifdef SQLITE_OMIT_ATTACH - "OMIT_ATTACH", -#endif -#ifdef SQLITE_OMIT_AUTHORIZATION - "OMIT_AUTHORIZATION", -#endif -#ifdef SQLITE_OMIT_AUTOINCREMENT - "OMIT_AUTOINCREMENT", -#endif -#ifdef SQLITE_OMIT_AUTOINIT - "OMIT_AUTOINIT", -#endif -#ifdef SQLITE_OMIT_AUTOMATIC_INDEX - "OMIT_AUTOMATIC_INDEX", -#endif -#ifdef SQLITE_OMIT_AUTORESET - "OMIT_AUTORESET", -#endif -#ifdef SQLITE_OMIT_AUTOVACUUM - "OMIT_AUTOVACUUM", -#endif -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION - "OMIT_BETWEEN_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_BLOB_LITERAL - "OMIT_BLOB_LITERAL", -#endif -#ifdef SQLITE_OMIT_CAST - "OMIT_CAST", -#endif -#ifdef SQLITE_OMIT_CHECK - "OMIT_CHECK", -#endif -#ifdef SQLITE_OMIT_COMPLETE - "OMIT_COMPLETE", -#endif -#ifdef SQLITE_OMIT_COMPOUND_SELECT - "OMIT_COMPOUND_SELECT", -#endif -#ifdef SQLITE_OMIT_CONFLICT_CLAUSE - "OMIT_CONFLICT_CLAUSE", -#endif -#ifdef SQLITE_OMIT_CTE - "OMIT_CTE", -#endif -#if defined(SQLITE_OMIT_DATETIME_FUNCS) || defined(SQLITE_OMIT_FLOATING_POINT) - "OMIT_DATETIME_FUNCS", -#endif -#ifdef SQLITE_OMIT_DECLTYPE - "OMIT_DECLTYPE", -#endif -#ifdef SQLITE_OMIT_DEPRECATED - "OMIT_DEPRECATED", -#endif -#ifdef SQLITE_OMIT_DESERIALIZE - "OMIT_DESERIALIZE", -#endif -#ifdef SQLITE_OMIT_DISKIO - "OMIT_DISKIO", -#endif -#ifdef SQLITE_OMIT_EXPLAIN - "OMIT_EXPLAIN", -#endif -#ifdef SQLITE_OMIT_FLAG_PRAGMAS - "OMIT_FLAG_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_FLOATING_POINT - "OMIT_FLOATING_POINT", -#endif -#ifdef SQLITE_OMIT_FOREIGN_KEY - "OMIT_FOREIGN_KEY", -#endif -#ifdef SQLITE_OMIT_GET_TABLE - "OMIT_GET_TABLE", -#endif -#ifdef SQLITE_OMIT_HEX_INTEGER - "OMIT_HEX_INTEGER", -#endif -#ifdef SQLITE_OMIT_INCRBLOB - "OMIT_INCRBLOB", -#endif -#ifdef SQLITE_OMIT_INTEGRITY_CHECK - "OMIT_INTEGRITY_CHECK", -#endif -#ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS - "OMIT_INTROSPECTION_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_JSON - "OMIT_JSON", -#endif -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION - "OMIT_LIKE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_LOAD_EXTENSION - "OMIT_LOAD_EXTENSION", -#endif -#ifdef SQLITE_OMIT_LOCALTIME - "OMIT_LOCALTIME", -#endif -#ifdef SQLITE_OMIT_LOOKASIDE - "OMIT_LOOKASIDE", -#endif -#ifdef SQLITE_OMIT_MEMORYDB - "OMIT_MEMORYDB", -#endif -#ifdef SQLITE_OMIT_OR_OPTIMIZATION - "OMIT_OR_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_PAGER_PRAGMAS - "OMIT_PAGER_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_PARSER_TRACE - "OMIT_PARSER_TRACE", -#endif -#ifdef SQLITE_OMIT_POPEN - "OMIT_POPEN", -#endif -#ifdef SQLITE_OMIT_PRAGMA - "OMIT_PRAGMA", -#endif -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK - "OMIT_PROGRESS_CALLBACK", -#endif -#ifdef SQLITE_OMIT_QUICKBALANCE - "OMIT_QUICKBALANCE", -#endif -#ifdef SQLITE_OMIT_REINDEX - "OMIT_REINDEX", -#endif -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS - "OMIT_SCHEMA_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - "OMIT_SCHEMA_VERSION_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SEH - "OMIT_SEH", -#endif -#ifdef SQLITE_OMIT_SHARED_CACHE - "OMIT_SHARED_CACHE", -#endif -#ifdef SQLITE_OMIT_SHUTDOWN_DIRECTORIES - "OMIT_SHUTDOWN_DIRECTORIES", -#endif -#ifdef SQLITE_OMIT_SUBQUERY - "OMIT_SUBQUERY", -#endif -#ifdef SQLITE_OMIT_TCL_VARIABLE - "OMIT_TCL_VARIABLE", -#endif -#ifdef SQLITE_OMIT_TEMPDB - "OMIT_TEMPDB", -#endif -#ifdef SQLITE_OMIT_TEST_CONTROL - "OMIT_TEST_CONTROL", -#endif -#ifdef SQLITE_OMIT_TRACE -# if SQLITE_OMIT_TRACE != 1 - "OMIT_TRACE=" CTIMEOPT_VAL(SQLITE_OMIT_TRACE), -# endif -#endif -#ifdef SQLITE_OMIT_TRIGGER - "OMIT_TRIGGER", -#endif -#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION - "OMIT_TRUNCATE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_UTF16 - "OMIT_UTF16", -#endif -#ifdef SQLITE_OMIT_VACUUM - "OMIT_VACUUM", -#endif -#ifdef SQLITE_OMIT_VIEW - "OMIT_VIEW", -#endif -#ifdef SQLITE_OMIT_VIRTUALTABLE - "OMIT_VIRTUALTABLE", -#endif -#ifdef SQLITE_OMIT_WAL - "OMIT_WAL", -#endif -#ifdef SQLITE_OMIT_WSD - "OMIT_WSD", -#endif -#ifdef SQLITE_OMIT_XFER_OPT - "OMIT_XFER_OPT", -#endif -#ifdef SQLITE_PERFORMANCE_TRACE - "PERFORMANCE_TRACE", -#endif -#ifdef SQLITE_POWERSAFE_OVERWRITE -# if SQLITE_POWERSAFE_OVERWRITE != 1 - "POWERSAFE_OVERWRITE=" CTIMEOPT_VAL(SQLITE_POWERSAFE_OVERWRITE), -# endif -#endif -#ifdef SQLITE_PREFER_PROXY_LOCKING - "PREFER_PROXY_LOCKING", -#endif -#ifdef SQLITE_PROXY_DEBUG - "PROXY_DEBUG", -#endif -#ifdef SQLITE_REVERSE_UNORDERED_SELECTS - "REVERSE_UNORDERED_SELECTS", -#endif -#ifdef SQLITE_RTREE_INT_ONLY - "RTREE_INT_ONLY", -#endif -#ifdef SQLITE_SECURE_DELETE - "SECURE_DELETE", -#endif -#ifdef SQLITE_SMALL_STACK - "SMALL_STACK", -#endif -#ifdef SQLITE_SORTER_PMASZ - "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ), -#endif -#ifdef SQLITE_SOUNDEX - "SOUNDEX", -#endif -#ifdef SQLITE_STAT4_SAMPLES - "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES), -#endif -#ifdef SQLITE_STMTJRNL_SPILL - "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL), -#endif -#ifdef SQLITE_SUBSTR_COMPATIBILITY - "SUBSTR_COMPATIBILITY", -#endif -#if (!defined(SQLITE_WIN32_MALLOC) \ - && !defined(SQLITE_ZERO_MALLOC) \ - && !defined(SQLITE_MEMDEBUG) \ - ) || defined(SQLITE_SYSTEM_MALLOC) - "SYSTEM_MALLOC", -#endif -#ifdef SQLITE_TCL - "TCL", -#endif -#ifdef SQLITE_TEMP_STORE - "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), -#endif -#ifdef SQLITE_TEST - "TEST", -#endif -#if defined(SQLITE_THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), -#elif defined(THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE), -#else - "THREADSAFE=1", -#endif -#ifdef SQLITE_UNLINK_AFTER_CLOSE - "UNLINK_AFTER_CLOSE", -#endif -#ifdef SQLITE_UNTESTABLE - "UNTESTABLE", -#endif -#ifdef SQLITE_USE_ALLOCA - "USE_ALLOCA", -#endif -#ifdef SQLITE_USE_FCNTL_TRACE - "USE_FCNTL_TRACE", -#endif -#ifdef SQLITE_USE_URI - "USE_URI", -#endif -#ifdef SQLITE_VDBE_COVERAGE - "VDBE_COVERAGE", -#endif -#ifdef SQLITE_WIN32_MALLOC - "WIN32_MALLOC", -#endif -#ifdef SQLITE_ZERO_MALLOC - "ZERO_MALLOC", -#endif - -} ; - -const char **sqlite3CompileOptions(int *pnOpt){ - *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); - return (const char**)sqlite3azCompileOpt; -} - -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl index 69d25c678e..1a845b00bf 100755 --- a/tool/mkctimec.tcl +++ b/tool/mkctimec.tcl @@ -4,13 +4,13 @@ # # const char **azCompileOpt[] # -# definition used in src/ctime.c, run this script from -# the checkout root. It generates src/ctime.c . +# definition used in ctime.c, run this script from +# the checkout root. It generates ctime.c . # -# Results are normally written into src/ctime.c. But if an argument is +# Results are normally written into ctime.c. But if an argument is # provided, results are written there instead. Examples: # -# tclsh tool/mkctimec.tcl ;# <-- results to src/ctime.c +# tclsh tool/mkctimec.tcl ;# <-- ctime.c # # tclsh tool/mkctimec.tcl /dev/tty ;# <-- results to the terminal # @@ -440,7 +440,7 @@ foreach v $value2_options { if {$argc>0} { set destfile [lindex $argv 0] } else { - set destfile "[file dir [file dir [file normal $argv0]]]/src/ctime.c" + set destfile ctime.c puts "Overwriting $destfile..." } diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index b65e223db9..918f12a9d6 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -4,7 +4,6 @@ # various aspects of the source tree are up-to-date. Items checked include: # # * Makefile.msc and autoconf/Makefile.msc agree -# * src/ctime.tcl is consistent with tool/mkctimec.tcl # * VERSION agrees with autoconf/tea/configure.ac # * src/pragma.h agrees with tool/mkpragmatab.tcl # @@ -74,19 +73,3 @@ if {$f1 != $f2} { puts "...... Fix: tclsh tool/mkpragmatab.tcl" incr NERR } - -######################### src/ctime.c ######################################## - -set f1 [readfile $ROOT/src/ctime.c] -exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt -set f2 [readfile tmp3.txt] -file delete tmp3.txt -if {$f1 != $f2} { - puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl" - puts "..... Fix: tclsh tool/mkctimec.tcl" - incr NERR -} - -# If any errors are seen, exit 1 so that the build will fail. -# -if {$NERR>0} {exit 1} From cd56ad4ccb42b598f3422f2c554a6feaa5c10951 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 11 Feb 2025 19:54:13 +0000 Subject: [PATCH 42/72] Omit the src/pragma.h file. It is generated by the tool/mkpragmatab.tcl script. The makefiles now know how to build this file for themselves. FossilOrigin-Name: 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e --- Makefile.msc | 9 +- autoconf/Makefile.msc | 2 +- main.mk | 13 +- manifest | 21 +- manifest.uuid | 2 +- src/pragma.h | 660 ----------------------------------------- tool/mkpragmatab.tcl | 8 +- tool/srctree-check.tcl | 13 - 8 files changed, 30 insertions(+), 698 deletions(-) delete mode 100644 src/pragma.h diff --git a/Makefile.msc b/Makefile.msc index 3618ae0bcc..05fff146bc 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1495,7 +1495,7 @@ SRC04 = \ SRC05 = \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ - $(TOP)\src\pragma.h \ + pragma.h \ $(TOP)\src\sqlite.h.in \ $(TOP)\src\sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ @@ -1698,7 +1698,7 @@ HDR = \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ parse.h \ - $(TOP)\src\pragma.h \ + pragma.h \ $(SQLITE3H) \ sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ @@ -2336,6 +2336,9 @@ parse.c: $(TOP)\src\parse.y lemon.exe copy /B parse.y +,, .\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) -S parse.y +pragma.h: $(TOP)\tool\mkpragmatab.tcl $(JIM_TCLSH) + $(JIM_TCLSH) $(TOP)\tool\mkpragmatab.tcl + $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest mksourceid.exe $(TOP)\VERSION $(JIM_TCLSH) $(JIM_TCLSH) $(TOP)\tool\mksqlite3h.tcl "$(TOP:\=/)" -o $(SQLITE3H) $(MKSQLITE3H_ARGS) @@ -2815,7 +2818,7 @@ moreclean: clean clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL # <> del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 47e0a83af8..f891036a14 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -1088,5 +1088,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL diff --git a/main.mk b/main.mk index 82f44a0306..615dc97fb5 100644 --- a/main.mk +++ b/main.mk @@ -596,7 +596,7 @@ SRC = \ $(TOP)/src/pcache.h \ $(TOP)/src/pcache1.c \ $(TOP)/src/pragma.c \ - $(TOP)/src/pragma.h \ + pragma.h \ $(TOP)/src/prepare.c \ $(TOP)/src/printf.c \ $(TOP)/src/random.c \ @@ -857,7 +857,7 @@ HDR = \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ parse.h \ - $(TOP)/src/pragma.h \ + pragma.h \ sqlite3.h \ $(TOP)/src/sqlite3ext.h \ $(TOP)/src/sqliteInt.h \ @@ -1137,8 +1137,8 @@ callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON) complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c $(TOP)/src/complete.c -ctime.c: $(TOP)/tool/mkctimec.tcl - $(TCLSH_CMD) $(TOP)/tool/mkctimec.tcl +ctime.c: $(TOP)/tool/mkctimec.tcl $(B.tclsh) + $(B.tclsh) $(TOP)/tool/mkctimec.tcl ctime.o: ctime.c $(DEPS_OBJ_COMMON) $(T.cc.sqlite) -c ctime.c @@ -1385,6 +1385,9 @@ parse.c: $(TOP)/src/parse.y lemon$(B.exe) cp $(TOP)/src/parse.y . ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y +pragma.h: $(TOP)/tool/mkpragmatab.tcl $(B.tclsh) + $(B.tclsh) $(TOP)/tool/mkpragmatab.tcl + sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION $(B.tclsh) echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ @@ -2356,7 +2359,7 @@ tidy: tidy-. rm -f src-verify$(B.exe) rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh) rm -f sqlite3rc.h sqlite3.def - rm -f ctime.c + rm -f ctime.c pragma.h # # Removes build products and test logs. Retains ./configure outputs. diff --git a/manifest b/manifest index 9c05778077..e71a53be0b 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Omit\sthe\ssrc/ctime.c\ssource\sfile,\ssince\sit\sis\sautomatically\sgenerated\sby\sa\sTCL\nscript.\s\sInstead,\sadd\srules\sto\sthe\svarious\smakefiles\sto\sgenerate\sctime.c\son\ndemand. -D 2025-02-11T19:40:19.136 +C Omit\sthe\ssrc/pragma.h\sfile.\s\sIt\sis\sgenerated\sby\sthe\stool/mkpragmatab.tcl\sscript.\nThe\smakefiles\snow\sknow\show\sto\sbuild\sthis\sfile\sfor\sthemselves. +D 2025-02-11T19:54:13.594 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 -F Makefile.msc 3715ce0974666c8cafe391e2383a902956b983aa08bfea1cd57e98ddd27a35bb +F Makefile.msc 50c656e096ae49ccf9e5e88b4995f0a155f231ebae5b6d185cc64ce99d728a83 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 @@ -17,7 +17,7 @@ F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821 F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 -F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 +F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk b7d36efaac04a13a85008c694762bf7b58de748dc1565c70a4dd797a944c9f9b +F main.mk ecf4b449c742eaa3a872a5cd0e8e5c19e2dccfe3b5b0ccafd0c926dc1030c661 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -773,7 +773,6 @@ F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 F src/pragma.c ce1182217aa540e034c6da2f17515e3706bf52c837e8222361be9ccd7a9d495a -F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c @@ -2151,7 +2150,7 @@ F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14 F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef F tool/mkopcodeh.tcl 2b4e6967a670ef21bf53a164964c35c6163277d002a4c6f56fa231d68c88d023 F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa -F tool/mkpragmatab.tcl 32e359ccb21011958a821955254bd7a5fa7915d01a8c16fed91ffc8b40cb4adf +F tool/mkpragmatab.tcl 365ff4c0367b2fa686fdb20a1a03e36c697959c1ca854fc82af42b9056170893 F tool/mkshellc.tcl 9ce74de0fa904a2c56a96f8d8b5261246bacb0eaa8d7e184f9e18ff94145ebbc F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 @@ -2194,7 +2193,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 5e40c7beaca50c3f29cd9c3aa8d6c9256359690ea0989174f097ace92d6390c2 +F tool/srctree-check.tcl 4e635aed7dd8198d2b212353823d4b10b380211bf9a8287921ec6b2b773ca097 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2208,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6aa54cc180e034a10d8fc8f8b0c13d7bc0c94509b4240ac855121d501853768f -R e691176b85b17541b0449680ba0ba564 +P 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 +R c612f3371ab876eff4ecd15f96d1d3bd U drh -Z 88df15dbb3e7e15a4c35762ecebc556a +Z d8718e46243e2a0107a59b8d9076cbbd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 25b7683b02..3c2620d3c5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 +9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e diff --git a/src/pragma.h b/src/pragma.h deleted file mode 100644 index 7270db1db4..0000000000 --- a/src/pragma.h +++ /dev/null @@ -1,660 +0,0 @@ -/* DO NOT EDIT! -** This file is automatically generated by the script at -** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit -** that script and rerun it. -*/ - -/* The various pragma types */ -#define PragTyp_ACTIVATE_EXTENSIONS 0 -#define PragTyp_ANALYSIS_LIMIT 1 -#define PragTyp_HEADER_VALUE 2 -#define PragTyp_AUTO_VACUUM 3 -#define PragTyp_FLAG 4 -#define PragTyp_BUSY_TIMEOUT 5 -#define PragTyp_CACHE_SIZE 6 -#define PragTyp_CACHE_SPILL 7 -#define PragTyp_CASE_SENSITIVE_LIKE 8 -#define PragTyp_COLLATION_LIST 9 -#define PragTyp_COMPILE_OPTIONS 10 -#define PragTyp_DATA_STORE_DIRECTORY 11 -#define PragTyp_DATABASE_LIST 12 -#define PragTyp_DEFAULT_CACHE_SIZE 13 -#define PragTyp_ENCODING 14 -#define PragTyp_FOREIGN_KEY_CHECK 15 -#define PragTyp_FOREIGN_KEY_LIST 16 -#define PragTyp_FUNCTION_LIST 17 -#define PragTyp_HARD_HEAP_LIMIT 18 -#define PragTyp_INCREMENTAL_VACUUM 19 -#define PragTyp_INDEX_INFO 20 -#define PragTyp_INDEX_LIST 21 -#define PragTyp_INTEGRITY_CHECK 22 -#define PragTyp_JOURNAL_MODE 23 -#define PragTyp_JOURNAL_SIZE_LIMIT 24 -#define PragTyp_LOCK_PROXY_FILE 25 -#define PragTyp_LOCKING_MODE 26 -#define PragTyp_PAGE_COUNT 27 -#define PragTyp_MMAP_SIZE 28 -#define PragTyp_MODULE_LIST 29 -#define PragTyp_OPTIMIZE 30 -#define PragTyp_PAGE_SIZE 31 -#define PragTyp_PRAGMA_LIST 32 -#define PragTyp_SECURE_DELETE 33 -#define PragTyp_SHRINK_MEMORY 34 -#define PragTyp_SOFT_HEAP_LIMIT 35 -#define PragTyp_SYNCHRONOUS 36 -#define PragTyp_TABLE_INFO 37 -#define PragTyp_TABLE_LIST 38 -#define PragTyp_TEMP_STORE 39 -#define PragTyp_TEMP_STORE_DIRECTORY 40 -#define PragTyp_THREADS 41 -#define PragTyp_WAL_AUTOCHECKPOINT 42 -#define PragTyp_WAL_CHECKPOINT 43 -#define PragTyp_LOCK_STATUS 44 -#define PragTyp_STATS 45 - -/* Property flags associated with various pragma. */ -#define PragFlg_NeedSchema 0x01 /* Force schema load before running */ -#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */ -#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */ -#define PragFlg_ReadOnly 0x08 /* Read-only HEADER_VALUE */ -#define PragFlg_Result0 0x10 /* Acts as query when no argument */ -#define PragFlg_Result1 0x20 /* Acts as query when has one argument */ -#define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */ -#define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */ - -/* Names of columns for pragmas that return multi-column result -** or that return single-column results where the name of the -** result column is different from the name of the pragma -*/ -static const char *const pragCName[] = { - /* 0 */ "id", /* Used by: foreign_key_list */ - /* 1 */ "seq", - /* 2 */ "table", - /* 3 */ "from", - /* 4 */ "to", - /* 5 */ "on_update", - /* 6 */ "on_delete", - /* 7 */ "match", - /* 8 */ "cid", /* Used by: table_xinfo */ - /* 9 */ "name", - /* 10 */ "type", - /* 11 */ "notnull", - /* 12 */ "dflt_value", - /* 13 */ "pk", - /* 14 */ "hidden", - /* table_info reuses 8 */ - /* 15 */ "schema", /* Used by: table_list */ - /* 16 */ "name", - /* 17 */ "type", - /* 18 */ "ncol", - /* 19 */ "wr", - /* 20 */ "strict", - /* 21 */ "seqno", /* Used by: index_xinfo */ - /* 22 */ "cid", - /* 23 */ "name", - /* 24 */ "desc", - /* 25 */ "coll", - /* 26 */ "key", - /* 27 */ "name", /* Used by: function_list */ - /* 28 */ "builtin", - /* 29 */ "type", - /* 30 */ "enc", - /* 31 */ "narg", - /* 32 */ "flags", - /* 33 */ "tbl", /* Used by: stats */ - /* 34 */ "idx", - /* 35 */ "wdth", - /* 36 */ "hght", - /* 37 */ "flgs", - /* 38 */ "seq", /* Used by: index_list */ - /* 39 */ "name", - /* 40 */ "unique", - /* 41 */ "origin", - /* 42 */ "partial", - /* 43 */ "table", /* Used by: foreign_key_check */ - /* 44 */ "rowid", - /* 45 */ "parent", - /* 46 */ "fkid", - /* index_info reuses 21 */ - /* 47 */ "seq", /* Used by: database_list */ - /* 48 */ "name", - /* 49 */ "file", - /* 50 */ "busy", /* Used by: wal_checkpoint */ - /* 51 */ "log", - /* 52 */ "checkpointed", - /* collation_list reuses 38 */ - /* 53 */ "database", /* Used by: lock_status */ - /* 54 */ "status", - /* 55 */ "cache_size", /* Used by: default_cache_size */ - /* module_list pragma_list reuses 9 */ - /* 56 */ "timeout", /* Used by: busy_timeout */ -}; - -/* Definitions of all built-in pragmas */ -typedef struct PragmaName { - const char *const zName; /* Name of pragma */ - u8 ePragTyp; /* PragTyp_XXX value */ - u8 mPragFlg; /* Zero or more PragFlg_XXX values */ - u8 iPragCName; /* Start of column names in pragCName[] */ - u8 nPragCName; /* Num of col names. 0 means use pragma name */ - u64 iArg; /* Extra argument */ -} PragmaName; -static const PragmaName aPragmaName[] = { -#if defined(SQLITE_ENABLE_CEROD) - {/* zName: */ "activate_extensions", - /* ePragTyp: */ PragTyp_ACTIVATE_EXTENSIONS, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "analysis_limit", - /* ePragTyp: */ PragTyp_ANALYSIS_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "application_id", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_APPLICATION_ID }, -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - {/* zName: */ "auto_vacuum", - /* ePragTyp: */ PragTyp_AUTO_VACUUM, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX) - {/* zName: */ "automatic_index", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_AutoIndex }, -#endif -#endif - {/* zName: */ "busy_timeout", - /* ePragTyp: */ PragTyp_BUSY_TIMEOUT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 56, 1, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "cache_size", - /* ePragTyp: */ PragTyp_CACHE_SIZE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "cache_spill", - /* ePragTyp: */ PragTyp_CACHE_SPILL, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA) - {/* zName: */ "case_sensitive_like", - /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE, - /* ePragFlg: */ PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "cell_size_check", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CellSizeCk }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "checkpoint_fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CkptFullFSync }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "collation_list", - /* ePragTyp: */ PragTyp_COLLATION_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 38, 2, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) - {/* zName: */ "compile_options", - /* ePragTyp: */ PragTyp_COMPILE_OPTIONS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "count_changes", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_CountRows }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN - {/* zName: */ "data_store_directory", - /* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "data_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_DATA_VERSION }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "database_list", - /* ePragTyp: */ PragTyp_DATABASE_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 47, 3, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) - {/* zName: */ "default_cache_size", - /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 55, 1, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "defer_foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_DeferFKs }, -#endif -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "empty_result_callbacks", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_NullCallback }, -#endif -#if !defined(SQLITE_OMIT_UTF16) - {/* zName: */ "encoding", - /* ePragTyp: */ PragTyp_ENCODING, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "foreign_key_check", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 43, 4, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) - {/* zName: */ "foreign_key_list", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 8, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - {/* zName: */ "foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ForeignKeys }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "freelist_count", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_ReadOnly|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_FREE_PAGE_COUNT }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "full_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_FullColNames }, - {/* zName: */ "fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_FullFSync }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "function_list", - /* ePragTyp: */ PragTyp_FUNCTION_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 27, 6, - /* iArg: */ 0 }, -#endif -#endif - {/* zName: */ "hard_heap_limit", - /* ePragTyp: */ PragTyp_HARD_HEAP_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_CHECK) - {/* zName: */ "ignore_check_constraints", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_IgnoreChecks }, -#endif -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - {/* zName: */ "incremental_vacuum", - /* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "index_info", - /* ePragTyp: */ PragTyp_INDEX_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 21, 3, - /* iArg: */ 0 }, - {/* zName: */ "index_list", - /* ePragTyp: */ PragTyp_INDEX_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 38, 5, - /* iArg: */ 0 }, - {/* zName: */ "index_xinfo", - /* ePragTyp: */ PragTyp_INDEX_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 21, 6, - /* iArg: */ 1 }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - {/* zName: */ "integrity_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "journal_mode", - /* ePragTyp: */ PragTyp_JOURNAL_MODE, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "journal_size_limit", - /* ePragTyp: */ PragTyp_JOURNAL_SIZE_LIMIT, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "legacy_alter_table", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_LegacyAlter }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE - {/* zName: */ "lock_proxy_file", - /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - {/* zName: */ "lock_status", - /* ePragTyp: */ PragTyp_LOCK_STATUS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 53, 2, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "locking_mode", - /* ePragTyp: */ PragTyp_LOCKING_MODE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "max_page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "mmap_size", - /* ePragTyp: */ PragTyp_MMAP_SIZE, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) -#if !defined(SQLITE_OMIT_VIRTUALTABLE) -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "module_list", - /* ePragTyp: */ PragTyp_MODULE_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 9, 1, - /* iArg: */ 0 }, -#endif -#endif -#endif - {/* zName: */ "optimize", - /* ePragTyp: */ PragTyp_OPTIMIZE, - /* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "page_size", - /* ePragTyp: */ PragTyp_PAGE_SIZE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "parser_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ParserTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - {/* zName: */ "pragma_list", - /* ePragTyp: */ PragTyp_PRAGMA_LIST, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 9, 1, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "query_only", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_QueryOnly }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - {/* zName: */ "quick_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "read_uncommitted", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ReadUncommit }, - {/* zName: */ "recursive_triggers", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_RecTriggers }, - {/* zName: */ "reverse_unordered_selects", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ReverseOrder }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "schema_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_SCHEMA_VERSION }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "secure_delete", - /* ePragTyp: */ PragTyp_SECURE_DELETE, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "short_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_ShortColNames }, -#endif - {/* zName: */ "shrink_memory", - /* ePragTyp: */ PragTyp_SHRINK_MEMORY, - /* ePragFlg: */ PragFlg_NoColumns, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "soft_heap_limit", - /* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "sql_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_SqlTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) && defined(SQLITE_DEBUG) - {/* zName: */ "stats", - /* ePragTyp: */ PragTyp_STATS, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 33, 5, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "synchronous", - /* ePragTyp: */ PragTyp_SYNCHRONOUS, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - {/* zName: */ "table_info", - /* ePragTyp: */ PragTyp_TABLE_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 8, 6, - /* iArg: */ 0 }, - {/* zName: */ "table_list", - /* ePragTyp: */ PragTyp_TABLE_LIST, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1, - /* ColNames: */ 15, 6, - /* iArg: */ 0 }, - {/* zName: */ "table_xinfo", - /* ePragTyp: */ PragTyp_TABLE_INFO, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 8, 7, - /* iArg: */ 1 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - {/* zName: */ "temp_store", - /* ePragTyp: */ PragTyp_TEMP_STORE, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "temp_store_directory", - /* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY, - /* ePragFlg: */ PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#endif - {/* zName: */ "threads", - /* ePragTyp: */ PragTyp_THREADS, - /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "trusted_schema", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_TrustedSchema }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - {/* zName: */ "user_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlg: */ PragFlg_NoColumns1|PragFlg_Result0, - /* ColNames: */ 0, 0, - /* iArg: */ BTREE_USER_VERSION }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - {/* zName: */ "vdbe_addoptrace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeAddopTrace }, - {/* zName: */ "vdbe_debug", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace }, - {/* zName: */ "vdbe_eqp", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeEQP }, - {/* zName: */ "vdbe_listing", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeListing }, - {/* zName: */ "vdbe_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_VdbeTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_WAL) - {/* zName: */ "wal_autocheckpoint", - /* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT, - /* ePragFlg: */ 0, - /* ColNames: */ 0, 0, - /* iArg: */ 0 }, - {/* zName: */ "wal_checkpoint", - /* ePragTyp: */ PragTyp_WAL_CHECKPOINT, - /* ePragFlg: */ PragFlg_NeedSchema, - /* ColNames: */ 50, 3, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - {/* zName: */ "writable_schema", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, - /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError }, -#endif -}; -/* Number of pragmas: 68 on by default, 78 total. */ diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 2b5b6fdcdb..81ef0ea002 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -4,16 +4,16 @@ # # To add new pragmas, first add the name and other relevant attributes # of the pragma to the "pragma_def" object below. Then run this script -# to generate the ../src/pragma.h header file that contains macros and +# to generate the pragma.h header file that contains macros and # the lookup table needed for pragma name lookup in the pragma.c module. # Then add the extra "case PragTyp_XXXXX:" and subsequent code for the # new pragma in ../src/pragma.c. # -# The results are normally written into the ../src/pragma.h file. However, +# The results are normally written into the pragma.h file. However, # if an alternative output file name is provided as an argument, then # results are written into the alternative. For example: # -# tclsh tool/mkpragmatab.tcl ;# <--- Results to src/pragma.h +# tclsh tool/mkpragmatab.tcl ;# <--- Results to pragma.h # # tclsh tool/mkpragmatab.tcl /dev/tty ;# <-- results to terminal # @@ -413,7 +413,7 @@ set pragma_def { if {$argc>0} { set destfile [lindex $argv 0] } else { - set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h" + set destfile "pragma.h" puts "Overwriting $destfile with new pragma table..." } set fd [open $destfile wb] diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index 918f12a9d6..b16bd924a0 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -5,7 +5,6 @@ # # * Makefile.msc and autoconf/Makefile.msc agree # * VERSION agrees with autoconf/tea/configure.ac -# * src/pragma.h agrees with tool/mkpragmatab.tcl # # Other tests might be added later. # @@ -61,15 +60,3 @@ if {$f1 != $f2} { puts "...... Fix: tclsh tool/mkmsvcmin.tcl" incr NERR } - -######################### src/pragma.h ######################################## - -set f1 [readfile $ROOT/src/pragma.h] -exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt -set f2 [readfile tmp2.txt] -file delete tmp2.txt -if {$f1 != $f2} { - puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl" - puts "...... Fix: tclsh tool/mkpragmatab.tcl" - incr NERR -} From 56ff8df023aef7b63d755bf5e1fc2841d335f94b Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 12 Feb 2025 14:51:02 +0000 Subject: [PATCH 43/72] Tiny tcl comment tweaks. No functional changes. FossilOrigin-Name: da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b --- auto.def | 2 +- autoconf/auto.def | 2 +- autosetup/sqlite-config.tcl | 2 +- manifest | 18 +++++++++--------- manifest.uuid | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/auto.def b/auto.def index 981b455954..4528293cd7 100644 --- a/auto.def +++ b/auto.def @@ -1,4 +1,4 @@ -#/do/not/tclsh +#!/do/not/tclsh # ^^^ help out editors which guess this file's content type. # # This is the main autosetup-compatible configure script for the diff --git a/autoconf/auto.def b/autoconf/auto.def index c2e02fe3d8..bb8710378f 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -1,4 +1,4 @@ -#/do/not/tclsh +#!/do/not/tclsh # ^^^ help out editors which guess this file's content type. # # This is the main autosetup-compatible configure script for the diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 3d3f892bf0..108edaa1c1 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -130,7 +130,7 @@ proc sqlite-config-bootstrap {buildMode} { static=1 => {Disable build of static library (mostly)} } {canonical} { - amalgamation=1 => {Disable the amalgamation and instead build all files separately.} + amalgamation=1 => {Disable the amalgamation and instead build all files separately} } } diff --git a/manifest b/manifest index e71a53be0b..d99039541a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sthe\ssrc/pragma.h\sfile.\s\sIt\sis\sgenerated\sby\sthe\stool/mkpragmatab.tcl\sscript.\nThe\smakefiles\snow\sknow\show\sto\sbuild\sthis\sfile\sfor\sthemselves. -D 2025-02-11T19:54:13.594 +C Tiny\stcl\scomment\stweaks.\sNo\sfunctional\schanges. +D 2025-02-12T14:51:02.700 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 74ec59fbf7de5038aa9c3d0b1e0fea67e128e432ff9d84472c4016b08ec3d60b +F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 1900a63cfa18e662b16d912c849ea81609a90b5fe00cea54955a41572e2c2cd0 +F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 40107b6a75a2ee367359b2adeb2221e118f5dfa6f10b0a0c0f237fc59fbedef3 +F autosetup/sqlite-config.tcl bdafc3585865ada5d9a0f2b462e21ea735d49d82353fdfb641cf6f841f8eae9e F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9 -R c612f3371ab876eff4ecd15f96d1d3bd -U drh -Z d8718e46243e2a0107a59b8d9076cbbd +P 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e +R 2e6463fde99e2450982f05262b049e36 +U stephan +Z 11dbfcf3ee53aaad351b744d008979f9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3c2620d3c5..fb3fb9c21f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e +da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b From f3e24d08753e6bea3b8a77c097fd3d1a1f138a36 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 12 Feb 2025 15:31:26 +0000 Subject: [PATCH 44/72] Remove old function declaration accidentally left in sqlite3session.h. FossilOrigin-Name: 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 --- ext/session/sqlite3session.h | 13 ------------- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ext/session/sqlite3session.h b/ext/session/sqlite3session.h index f950d419b5..919365b14f 100644 --- a/ext/session/sqlite3session.h +++ b/ext/session/sqlite3session.h @@ -883,19 +883,6 @@ int sqlite3changeset_concat( void **ppOut /* OUT: Buffer containing output changeset */ ); - -/* -** CAPI3REF: Upgrade the Schema of a Changeset/Patchset -*/ -int sqlite3changeset_upgrade( - sqlite3 *db, - const char *zDb, - int nIn, const void *pIn, /* Input changeset */ - int *pnOut, void **ppOut /* OUT: Inverse of input */ -); - - - /* ** CAPI3REF: Changegroup Handle ** diff --git a/manifest b/manifest index d99039541a..716b9c746b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tiny\stcl\scomment\stweaks.\sNo\sfunctional\schanges. -D 2025-02-12T14:51:02.700 +C Remove\sold\sfunction\sdeclaration\saccidentally\sleft\sin\ssqlite3session.h. +D 2025-02-12T15:31:26.463 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -616,7 +616,7 @@ F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63b F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc F ext/session/sqlite3session.c 52a680dbb03c4734748b215d95987fb4d95ab23baaf053a01ac2626610963b58 -F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b +F ext/session/sqlite3session.h aa5de3ec8ef0e5313e9f65dafd69e8ba292d170f07b57da9200c040068dab061 F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/GNUmakefile 06e0556e9840fd3d8870997025c2507ace9ba7bf11195f770295fc7947dfc1b5 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e -R 2e6463fde99e2450982f05262b049e36 -U stephan -Z 11dbfcf3ee53aaad351b744d008979f9 +P da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b +R 6f7f1710621940ea4683c778ed859375 +U dan +Z 8c9d99e3c5ea71beb7debabd9d22f723 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fb3fb9c21f..d19a148ee4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b +0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 From 1be96b44c198a20f8fd567b319ba9fcb82ffa09e Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 12 Feb 2025 16:59:07 +0000 Subject: [PATCH 45/72] configure --help cleanups and eliminate the use of a JS-esque inner function in sqlite-config.tcl. No functional changes. FossilOrigin-Name: 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 --- autosetup/sqlite-config.tcl | 153 +++++++++++++++++++++--------------- manifest | 14 ++-- manifest.uuid | 2 +- 3 files changed, 99 insertions(+), 70 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 108edaa1c1..14cdcf5da1 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -109,21 +109,26 @@ proc sqlite-config-bootstrap {buildMode} { # the case of a default value. ######################################################################## set allFlags { - # Structure: a list of M {Z}, where M is a descriptive option - # group name and Z is a list of X Y pairs. X is a list of - # $buildMode name(s) to which these flags apply, or {*} to apply + # Structure: a list of M {Z} pairs, where M is a descriptive + # option group name and Z is a list of X Y pairs. X is a list of + # $buildMode name(s) to which the Y flags apply, or {*} to apply # to all builds. Y is a {block} in the form expected by # autosetup's [options] command. Each block which is applicable # to $buildMode is appended to a new list before that list is # passed on to [options]. The order of each Y and sub-Y is # retained, which is significant for rendering of --help. - # When writing {help text blocks}, be aware that autosetup formats - # them differently (left-aligned, directly under the --flag) if the - # block starts with a newline. It does NOT expand vars and commands, - # but we use a [subst] call below which will replace (only) var - # refs. + # When writing {help text blocks}, be aware that: + # + # A) autosetup formats them differently if the {block} starts with + # a newline: it starts left-aligned, directly under the --flag, and + # the rest of the block is pasted verbatim rather than + # pretty-printed. + # + # B) Vars and commands are NOT expanded, but we use a [subst] call + # below which will replace (only) var refs. + # Options for how to build the library build-modes { {*} { shared=1 => {Disable build of shared libary} @@ -134,11 +139,14 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Library-level features and defaults lib-features { {*} { threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} largefile=1 => {Disable large file support} + # ^^^ It's not clear that this actually does anything, as + # HAVE_LFS is not checked anywhere in the .c/.h/.in files. load-extension=1 => {Disable loading of external extensions} math=1 => {Disable math functions} json=1 => {Disable JSON functions} @@ -155,108 +163,130 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Options for TCL support tcl { {canonical} { - with-tcl:DIR => - {Directory containing tclConfig.sh or a directory one level up from - that, from which we can derive a directory containing tclConfig.sh. - A dir name of "prefix" is equivalent to the directory specified by - the --prefix flag.} - with-tclsh:PATH => - {Full pathname of tclsh to use. It is used for (A) trying to find - tclConfig.sh and (B) all TCL-based code generation. Warning: if - its containing dir has multiple tclsh versions, it may select the - wrong tclConfig.sh!} - tcl=1 => - {Disable components which require TCL, including all tests. - This tree requires TCL for code generation but can use the in-tree - copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the - test code require a canonical tclsh.} + with-tcl:DIR + => {Directory containing tclConfig.sh or a directory one level up from + that, from which we can derive a directory containing tclConfig.sh. + A dir name of "prefix" is equivalent to the directory specified by + the --prefix flag.} + with-tclsh:PATH + => {Full pathname of tclsh to use. It is used for (A) trying to find + tclConfig.sh and (B) all TCL-based code generation. Warning: if + its containing dir has multiple tclsh versions, it may select the + wrong tclConfig.sh!} + tcl=1 + => {Disable components which require TCL, including all tests. + This tree requires TCL for code generation but can use the in-tree + copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the + test code require a canonical tclsh.} } } + # Options for line-editing modes for the CLI shell line-editing { {*} { - readline=1 => {Disable readline support} + readline=1 + => {Disable readline support} # --with-readline-lib is a backwards-compatible alias for # --with-readline-ldflags with-readline-lib: with-readline-ldflags:=auto - => {Readline LDFLAGS, e.g. -lreadline -lncurses} + => {Readline LDFLAGS, e.g. -lreadline -lncurses} # --with-readline-inc is a backwards-compatible alias for # --with-readline-cflags. with-readline-inc: with-readline-cflags:=auto - => {Readline CFLAGS, e.g. -I/path/to/includes} + => {Readline CFLAGS, e.g. -I/path/to/includes} with-readline-header:PATH - => {Full path to readline.h, from which --with-readline-cflags will be derived} - with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} - editline=0 => {Enable BSD editline support} + => {Full path to readline.h, from which --with-readline-cflags will be derived} + with-linenoise:DIR + => {Source directory for linenoise.c and linenoise.h} + editline=0 + => {Enable BSD editline support} } } + # Options for ICU: International Components for Unicode icu { {*} { with-icu-ldflags:LDFLAGS - => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} + => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the + ICU libraries} with-icu-cflags:CFLAGS - => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} - icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} + => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. + e.g. -I/usr/local/include} + with-icu-config:=auto + => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, + /path/to/icu-config} + icu-collations=0 + => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... + or --with-icu-config} } } + # Options for exotic/alternative build modes alternative-builds { {canonical} { with-wasi-sdk:=/opt/wasi-sdk - => {Top-most dir of the wasi-sdk for a WASI build} - with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} + => {Top-most dir of the wasi-sdk for a WASI build} + with-emsdk:=auto + => {Top-most dir of the Emscripten SDK installation. + Default = EMSDK env var.} } } - # Note that using the --debug/--enable-debug flag here requires patching - # autosetup/autosetup to rename the --debug to --autosetup-debug. + # Options mostly for sqlite's own development developer { {*} { + # Note that using the --debug/--enable-debug flag here + # requires patching autosetup/autosetup to rename the --debug + # to --autosetup-debug. with-debug=0 - debug=0 => - {Enable debug build flags. This option will impact performance by - as much as 4x, as it includes large numbers of assert()s in - performance-critical loops. Never use --debug for production - builds.} - scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} + debug=0 + => {Enable debug build flags. This option will impact performance by + as much as 4x, as it includes large numbers of assert()s in + performance-critical loops. Never use --debug for production + builds.} + scanstatus + => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} } {canonical} { dev => {Enable dev-mode build: automatically enables certain other flags} test-status => {Enable status of tests} gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} - dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} + dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } } + # Options specifically for downstream package maintainers packaging { {*} { # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded - soname:=legacy => - {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10". - } - out-implib=0 => - {Enable use of --out-implib linker flag to generate an "import library" for the DLL} + soname:=legacy + => {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} + # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 + out-implib=0 + => {Enable use of --out-implib linker flag to generate an + "import library" for the DLL} } } }; # $allOpts + # Filter allOpts to create the set of [options] legal for this build set opts {} - foreach {group XY} [subst -nobackslashes -nocommands [proj-strip-hash-comments $allFlags]] { + foreach {group XY} [subst -nobackslashes -nocommands \ + [proj-strip-hash-comments $allFlags]] { foreach {X Y} $XY { if { $buildMode in $X || "*" in $X } { foreach y $Y { @@ -265,8 +295,7 @@ proc sqlite-config-bootstrap {buildMode} { } } } - #puts "options = $opts" - #exit 0 + #puts "options = $opts"; exit 0 options $opts sqlite-post-options-init }; # sqlite-config-bootstrap @@ -334,19 +363,19 @@ proc sqlite-autoreconfig {} { # configure script with the same arguments it was initially invoked # with. This can be used to automatically reconfigure # - proc squote {arg} { + set squote {{arg} { # Wrap $arg in single-quotes if it looks like it might need that # to avoid mis-handling as a shell argument. We assume that $arg # will never contain any single-quote characters. if {[string match {*[ &;$*"]*} $arg]} { return '$arg' } return $arg - } - define-append SQLITE_AUTORECONFIG cd [squote $::autosetup(builddir)] && [squote $::autosetup(srcdir)/configure] + }} + define-append SQLITE_AUTORECONFIG cd [apply $squote $::autosetup(builddir)] \ + && [apply $squote $::autosetup(srcdir)/configure] #{*}$::autosetup(argv) breaks with --flag='val with spaces', so... foreach arg $::autosetup(argv) { - define-append SQLITE_AUTORECONFIG [squote $arg] + define-append SQLITE_AUTORECONFIG [apply $squote $arg] } - rename squote "" } define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags. diff --git a/manifest b/manifest index 716b9c746b..7b764e1e9f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sold\sfunction\sdeclaration\saccidentally\sleft\sin\ssqlite3session.h. -D 2025-02-12T15:31:26.463 +C configure\s--help\scleanups\sand\seliminate\sthe\suse\sof\sa\sJS-esque\sinner\sfunction\sin\ssqlite-config.tcl.\sNo\sfunctional\schanges. +D 2025-02-12T16:59:07.174 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl bdafc3585865ada5d9a0f2b462e21ea735d49d82353fdfb641cf6f841f8eae9e +F autosetup/sqlite-config.tcl ece913b7bb1efbabdd44fd787c0e4d2fd462d3019cc079a5e6bbe43c83d302b3 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b -R 6f7f1710621940ea4683c778ed859375 -U dan -Z 8c9d99e3c5ea71beb7debabd9d22f723 +P 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 +R c7fed59cac15bf384efc445c22702858 +U stephan +Z 6f4cb9af43d8857f0cc800aca12dd8f2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d19a148ee4..0ca67e3513 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 +6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 From 25367c1eb04aa55b47d1e253e5e85cf9e6d7228b Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 12 Feb 2025 20:19:57 +0000 Subject: [PATCH 46/72] Fix a few 32-bit overflow problems in showdb.c. FossilOrigin-Name: 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/showdb.c | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 7b764e1e9f..d046f2682d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure\s--help\scleanups\sand\seliminate\sthe\suse\sof\sa\sJS-esque\sinner\sfunction\sin\ssqlite-config.tcl.\sNo\sfunctional\schanges. -D 2025-02-12T16:59:07.174 +C Fix\sa\sfew\s32-bit\soverflow\sproblems\sin\sshowdb.c. +D 2025-02-12T20:19:57.718 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -2170,7 +2170,7 @@ F tool/replace.tcl 511c61acfe563dfb58675efb4628bb158a13d48ff8322123ac447e9d25a82 F tool/restore_jrnl.tcl 1079ecba47cc82fa82115b81c1f68097ab1f956f357ee8da5fc4b2589af6bd98 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076 -F tool/showdb.c 81b04bfaa9a63665f75945947323aa68b820570aa156b1574f440fc8276092c6 +F tool/showdb.c 3956d71e5193162609a60e8c9edfcf09274c00cfea2b1d221261427adb2b5cca F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7 -R c7fed59cac15bf384efc445c22702858 -U stephan -Z 6f4cb9af43d8857f0cc800aca12dd8f2 +P 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 +R ccf520bbb9a2866ca6aec9263e29fec3 +U dan +Z 06705c2bc45432ef657decbbc71b836f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ca67e3513..84fa86757b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 +9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 diff --git a/tool/showdb.c b/tool/showdb.c index 12c2e271b7..f0bd9737cf 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -27,7 +27,7 @@ typedef sqlite3_uint64 u64; /* unsigned 64-bit */ static struct GlobalData { - u32 pagesize; /* Size of a database page */ + i64 pagesize; /* Size of a database page */ int dbfd; /* File descriptor for reading the DB */ u32 mxPage; /* Last page number */ int perLine; /* HEX elements to print per line */ @@ -1178,7 +1178,7 @@ int main(int argc, char **argv){ if( g.pagesize==0 ) g.pagesize = 1024; sqlite3_free(zPgSz); - printf("Pagesize: %d\n", g.pagesize); + printf("Pagesize: %d\n", (int)g.pagesize); g.mxPage = (u32)((szFile+g.pagesize-1)/g.pagesize); printf("Available pages: 1..%u\n", g.mxPage); @@ -1218,7 +1218,8 @@ int main(int argc, char **argv){ iEnd = strtol(&zLeft[2], 0, 0); checkPageValidity(iEnd); }else if( zLeft && zLeft[0]=='b' ){ - int ofst, nByte, hdrSize; + i64 ofst; + int nByte, hdrSize; unsigned char *a; if( iStart==1 ){ ofst = hdrSize = 100; From 5087eacb18b6e89291abc15c2818832ae99fd3cc Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 13 Feb 2025 14:47:25 +0000 Subject: [PATCH 47/72] Ensure the counts of "deferred FK violations" and "deferred immediate FK violations" are kept separate when "PRAGMA defer_foreign_keys" is used. FossilOrigin-Name: c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pragma.c | 5 ++++- src/vdbe.c | 10 ++++++---- test/fkey6.test | 30 ++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index d046f2682d..ecfcfa1a08 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sfew\s32-bit\soverflow\sproblems\sin\sshowdb.c. -D 2025-02-12T20:19:57.718 +C Ensure\sthe\scounts\sof\s"deferred\sFK\sviolations"\sand\s"deferred\simmediate\sFK\sviolations"\sare\skept\sseparate\swhen\s"PRAGMA\sdefer_foreign_keys"\sis\sused. +D 2025-02-13T14:47:25.229 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -772,7 +772,7 @@ F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 -F src/pragma.c ce1182217aa540e034c6da2f17515e3706bf52c837e8222361be9ccd7a9d495a +F src/pragma.c c7ada272232e1182c4536d9637fa7b955a10bc1bd8d5a87d4dc9309dab827791 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c @@ -847,7 +847,7 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 -F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad +F src/vdbe.c 063763e08f1ad00890b7377fc663dbccec85a47630f5d2bbb13f3fdf77e06f78 F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 @@ -1153,7 +1153,7 @@ F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb30 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421 -F test/fkey6.test ebd11efb00b9c70b57f4c6b6184445145c96e320329bd90a175036570c5b25ca +F test/fkey6.test 1e0874ba15f8ed1e14a1d0a40fc8fb90a9912f4c82ea220a43137d4d9eff4d69 F test/fkey7.test 64fb28da03da5dfe3cdef5967aa7e832c2507bf7fb8f0780cacbca1f2338d031 F test/fkey8.test 51deda7f1a1448bca95875e4a6e1a3a75b4bd7215e924e845bd60de60e4d84bf F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6df859cd18ded3ca64a184e45709503dd9b6a3f65e7611d3352f0bad288400f4 -R ccf520bbb9a2866ca6aec9263e29fec3 +P 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 +R 83e471c75257ae61568ff2a0fb629999 U dan -Z 06705c2bc45432ef657decbbc71b836f +Z e4f9c0246de36460838c8b5d3a4c9bbe # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 84fa86757b..3179d7a518 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 +c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 diff --git a/src/pragma.c b/src/pragma.c index 291ccf7af1..f1a922d1ac 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1153,7 +1153,10 @@ void sqlite3Pragma( } }else{ db->flags &= ~mask; - if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; + if( mask==SQLITE_DeferFKs ){ + db->nDeferredImmCons = 0; + db->nDeferredCons = 0; + } if( (mask & SQLITE_WriteSchema)!=0 && sqlite3_stricmp(zRight, "reset")==0 ){ diff --git a/src/vdbe.c b/src/vdbe.c index ec871c5a6e..6d7769173f 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -7483,12 +7483,14 @@ case OP_Param: { /* out2 */ ** statement counter is incremented (immediate foreign key constraints). */ case OP_FkCounter: { - if( db->flags & SQLITE_DeferFKs ){ - db->nDeferredImmCons += pOp->p2; - }else if( pOp->p1 ){ + if( pOp->p1 ){ db->nDeferredCons += pOp->p2; }else{ - p->nFkConstraint += pOp->p2; + if( db->flags & SQLITE_DeferFKs ){ + db->nDeferredImmCons += pOp->p2; + }else{ + p->nFkConstraint += pOp->p2; + } } break; } diff --git a/test/fkey6.test b/test/fkey6.test index 72de926b52..7cdc8ab0ae 100644 --- a/test/fkey6.test +++ b/test/fkey6.test @@ -267,5 +267,35 @@ do_execsql_test 5.1 { COMMIT; } +#------------------------------------------------------------------------- +# +reset_db + +do_execsql_test 6.1 { + PRAGMA writable_schema = 1; + INSERT INTO sqlite_schema + VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); +} +db close +sqlite3 db test.db +do_execsql_test 6.1 { + PRAGMA foreign_keys = 1; + PRAGMA writable_schema = 1; +} +do_execsql_test 6.2 { + CREATE TABLE t2( + y INTEGER PRIMARY KEY, + z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED + ); +} +do_execsql_test 6.3 { + BEGIN; + INSERT INTO t2 VALUES(1,0),(2,1); + CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); + INSERT INTO t3 VALUES(3,3); + PRAGMA defer_foreign_keys=ON; + DELETE FROM t2; + COMMIT; +} finish_test From e89f31f19ab45dcb939a1ecf0ef5113b27a25868 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 13 Feb 2025 16:20:05 +0000 Subject: [PATCH 48/72] When using the --out-implib build option, install the generated .dll.a file to PREFIX/lib. FossilOrigin-Name: 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 --- autoconf/Makefile.in | 5 ++++- main.mk | 10 +++++++--- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 8e09b9c610..c6cde3c181 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -157,6 +157,9 @@ all: $(libsqlite3.LIB) install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" + @if [ -f $(libsqlite3.SO).a ]; then \ + $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ + fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ cd "$(install-dir.lib)" || exit $$?; \ if [ x.dylib = x$(T.dll) ]; then \ @@ -171,7 +174,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \ + ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ if [ -e $(libsqlite3.SO).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ diff --git a/main.mk b/main.mk index 615dc97fb5..a63fa2a814 100644 --- a/main.mk +++ b/main.mk @@ -1477,6 +1477,9 @@ all: so # install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" + @if [ -f $(libsqlite3.SO).a ]; then \ + $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ + fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ cd "$(install-dir.lib)" || exit $$?; \ if [ x.dylib = x$(T.dll) ]; then \ @@ -1491,7 +1494,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \ + ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ if [ -e $(libsqlite3.SO).0.8.6 ]; then \ echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ @@ -1504,6 +1507,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ls -la $(libsqlite3.SO).0.8.6; \ fi; \ fi + install-so-0 install-so-: install-so: install-so-$(ENABLE_SHARED) install: install-so @@ -2339,7 +2343,7 @@ tidy: tidy-. rm -f lemon$(B.exe) sqlite*.tar.gz rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) rm -f parse.* fts5parse.* - rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) libsqlite3$(T.dll).a + rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) $(libsqlite3.SO).a rm -f tclsqlite3$(T.exe) $(TESTPROGS) rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) @@ -2374,7 +2378,7 @@ distclean: distclean-. clean # Show important variable settings. -show-variables: +show-variables: @echo "CC = $(CC)" @echo "B.cc = $(B.cc)" @echo "T.cc = $(T.cc)" diff --git a/manifest b/manifest index ecfcfa1a08..da6a8bb7bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthe\scounts\sof\s"deferred\sFK\sviolations"\sand\s"deferred\simmediate\sFK\sviolations"\sare\skept\sseparate\swhen\s"PRAGMA\sdefer_foreign_keys"\sis\sused. -D 2025-02-13T14:47:25.229 +C When\susing\sthe\s--out-implib\sbuild\soption,\sinstall\sthe\sgenerated\s.dll.a\sfile\sto\sPREFIX/lib. +D 2025-02-13T16:20:05.290 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 7bd73a4c8cd89025cbc92b4f887c6fd1b8cd8ecbe62c4ac1f36ac84d04043479 +F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk ecf4b449c742eaa3a872a5cd0e8e5c19e2dccfe3b5b0ccafd0c926dc1030c661 +F main.mk a127ee141eb7db341d0c949a743a45d1b068b31ac3f1f09cf3b2870b2f18739f F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9377766647eeaa575d646cf5f66c3163ef7074930aa5c3b11073e6b1e90ce799 -R 83e471c75257ae61568ff2a0fb629999 -U dan -Z e4f9c0246de36460838c8b5d3a4c9bbe +P c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 +R f439c2b5346ac4c6cf58b3b95ae0e844 +U stephan +Z 52b2d5f34b70aec8885831f59cc359bf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3179d7a518..c2065efdfe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 +0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 From f338ab20efd7d06c9b1553a68ca07be31e568d28 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 14 Feb 2025 10:28:28 +0000 Subject: [PATCH 49/72] Fix test cases added for [d7b90d92ffbfc61f] so that they also work when compiling with ICU support. [forum:/forumpost/2ca8a09a7e|Forum post 2ca8a09a7e] FossilOrigin-Name: 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/like3.test | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index da6a8bb7bd..192970f34b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\susing\sthe\s--out-implib\sbuild\soption,\sinstall\sthe\sgenerated\s.dll.a\sfile\sto\sPREFIX/lib. -D 2025-02-13T16:20:05.290 +C Fix\stest\scases\sadded\sfor\s[d7b90d92ffbfc61f]\sso\sthat\sthey\salso\swork\swhen\ncompiling\swith\sICU\ssupport.\n[forum:/forumpost/2ca8a09a7e|Forum\spost\s2ca8a09a7e] +D 2025-02-14T10:28:28.618 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1399,7 +1399,7 @@ F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/lemon-test01.y 70110eff607ab137ccc851edb2bc7e14a6d4f246b5d2d25f82a60b69d87a9ff2 F test/like.test b3ea2ba3558199aa8f25a42ddeb54772e234fab50868c9f066047acdbda8fc58 F test/like2.test d3be15fefee3e02fc88942a9b98f26c5339bbdef7783c90023c092c4955fe3d3 -F test/like3.test b21284df226d6028feeb4dcc56ad9d32673d82c14a63f15f25471292c36491e7 +F test/like3.test 1179fef50a9baa22767a431244aeefbf29f36606f0f854d4ab9e1d2fecf97dd3 F test/limit.test 350f5d03c29e7dff9a2cde016f84f8d368d40bcd02fa2b2a52fa10c4bf3cbfaf F test/limit2.test 9409b033284642a859fafc95f29a5a6a557bd57c1f0d7c3f554bd64ed69df77e F test/literal.test a65dca9fef86e51b8e45544268e37abbd4bb94ba35fd65f6fdcab2f288cd8f79 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2 -R f439c2b5346ac4c6cf58b3b95ae0e844 -U stephan -Z 52b2d5f34b70aec8885831f59cc359bf +P 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 +R 2aa968ae6750fa58cc8b9f9ab1460920 +U drh +Z d2f9f0edcea4c1ead34b1dd8879b3a1a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c2065efdfe..666aafe40e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 +5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 diff --git a/test/like3.test b/test/like3.test index 0b28574376..01d19a54f6 100644 --- a/test/like3.test +++ b/test/like3.test @@ -304,11 +304,19 @@ ifcapable utf16 { #------------------------------------------------------------------------- reset_db +# See forum thread https://sqlite.org/forum/info/d7b90d92ffbfc61f foreach enc { UTF-8 UTF-16le UTF-16be } { + ifcapable icu { + if {$enc=="UTF-8"} { + # The invalid UTF8 used in these tests is incompatible with ICU + # https://sqlite.org/forum/forumpost/2ca8a09a7e + continue + } + } foreach {tn expr} { 1 "CAST (X'FF' AS TEXT)" 2 "CAST (X'FFBF' AS TEXT)" From e3157582bf32324d37078f828509e91008aded2d Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 16:42:37 +0000 Subject: [PATCH 50/72] ICU config support: add more details to error messages and correct a typo which would cause a configure crash if --with-icu-config=X refered to a non-executable X. FossilOrigin-Name: ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 --- autosetup/sqlite-config.tcl | 18 ++++++++++++++---- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 14cdcf5da1..1616b10920 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -213,7 +213,7 @@ proc sqlite-config-bootstrap {buildMode} { {*} { with-icu-ldflags:LDFLAGS => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the - ICU libraries} + ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.} with-icu-cflags:CFLAGS => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} @@ -1062,6 +1062,7 @@ proc sqlite-handle-icu {} { define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]] define CFLAGS_ICU [join [opt-val with-icu-cflags ""]] if {[proj-opt-was-provided with-icu-config]} { + msg-result "Checking for ICU support..." set icuConfigBin [opt-val with-icu-config] set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} { @@ -1085,19 +1086,28 @@ proc sqlite-handle-icu {} { /usr/local/bin/icu-config \ /usr/bin/icu-config] if {"" eq $icuConfigBin} { - proj-fatal "--with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary" + proj-indented-notice -error { + --with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary. + On Ubuntu-like systems try: + --with-icu-ldflags='-licui18n -licuuc -licudata' + } } } if {[file-isexec $icuConfigBin]} { set x [exec $icuConfigBin --ldflags] if {"" eq $x} { - proj-fatal "$icuConfigBin --ldflags returned no data" + proj-indented-notice -error \ + [subst { + $icuConfigBin --ldflags returned no data. + On Ubuntu-like systems try: + --with-icu-ldflags='-licui18n -licuuc -licudata' + }] } define-append LDFLAGS_ICU $x set x [exec $icuConfigBin --cppflags] define-append CFLAGS_ICU $x } else { - proj-fatal "--with-icu-config=$bin does not refer to an executable" + proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable" } } } diff --git a/manifest b/manifest index 192970f34b..9b1a8780b3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stest\scases\sadded\sfor\s[d7b90d92ffbfc61f]\sso\sthat\sthey\salso\swork\swhen\ncompiling\swith\sICU\ssupport.\n[forum:/forumpost/2ca8a09a7e|Forum\spost\s2ca8a09a7e] -D 2025-02-14T10:28:28.618 +C ICU\sconfig\ssupport:\sadd\smore\sdetails\sto\serror\smessages\sand\scorrect\sa\stypo\swhich\swould\scause\sa\sconfigure\scrash\sif\s--with-icu-config=X\srefered\sto\sa\snon-executable\sX. +D 2025-02-14T16:42:37.638 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl ece913b7bb1efbabdd44fd787c0e4d2fd462d3019cc079a5e6bbe43c83d302b3 +F autosetup/sqlite-config.tcl c0a5e95b10d8168eb0f942a9d46b1b6a31a06a19991a294d2eace6b0a9d7e897 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0dadea0ec86b6ac74281915433e41ae66cc20547d9882c4be2933a24c8287927 -R 2aa968ae6750fa58cc8b9f9ab1460920 -U drh -Z d2f9f0edcea4c1ead34b1dd8879b3a1a +P 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 +R 8f2beaf5ac609f50ce863af5a49fb8f4 +U stephan +Z a0a82d139cbfe850e3642558116bae4d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 666aafe40e..ac337f3b52 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 +ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 From a09fd7b91330616b1ec31546c21550449b184661 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 17:21:05 +0000 Subject: [PATCH 51/72] Work around a autosetup --help bug which only(?) triggers on tcl 8.6, introduced by [9978c87139b7b042] and reported upstream as [https://github.com/msteveb/autosetup/issues/73|ticket #73]. Summary: calling 'options' from a proc, instead of the global scope, triggers an error about an invalid use of 'break'. FossilOrigin-Name: 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 --- auto.def | 10 ++++++++-- autoconf/auto.def | 9 ++++++++- autosetup/sqlite-config.tcl | 11 ++++++++--- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/auto.def b/auto.def index 4528293cd7..455b246e09 100644 --- a/auto.def +++ b/auto.def @@ -14,8 +14,14 @@ # use sqlite-config -sqlite-config-bootstrap canonical - +if {0} { + sqlite-config-bootstrap canonical +} else { + set sq3options [sqlite-config-bootstrap canonical] + options $sq3options + unset sq3options + sqlite-post-options-init +} sqlite-setup-default-cflags proj-if-opt-truthy dev { # --enable-dev needs to come early so that the downstream tests diff --git a/autoconf/auto.def b/autoconf/auto.def index bb8710378f..7e154caa32 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,7 +8,14 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config -sqlite-config-bootstrap autoconf +if {0} { + sqlite-config-bootstrap autoconf +} else { + set sq3options [sqlite-config-bootstrap autoconf] + options $sq3options + unset sq3options + sqlite-post-options-init +} sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1616b10920..338eb2408b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -295,9 +295,14 @@ proc sqlite-config-bootstrap {buildMode} { } } } - #puts "options = $opts"; exit 0 - options $opts - sqlite-post-options-init + if {0} { + #puts "options = $opts"; exit 0 + options $opts + sqlite-post-options-init + } else { + # Workaround for https://github.com/msteveb/autosetup/issues/73 + return $opts + } }; # sqlite-config-bootstrap ######################################################################## diff --git a/manifest b/manifest index 9b1a8780b3..ec9077572f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C ICU\sconfig\ssupport:\sadd\smore\sdetails\sto\serror\smessages\sand\scorrect\sa\stypo\swhich\swould\scause\sa\sconfigure\scrash\sif\s--with-icu-config=X\srefered\sto\sa\snon-executable\sX. -D 2025-02-14T16:42:37.638 +C Work\saround\sa\sautosetup\s--help\sbug\swhich\sonly(?)\striggers\son\stcl\s8.6,\sintroduced\sby\s[9978c87139b7b042]\sand\sreported\supstream\sas\s[https://github.com/msteveb/autosetup/issues/73|ticket\s#73].\sSummary:\scalling\s'options'\sfrom\sa\sproc,\sinstead\sof\sthe\sglobal\sscope,\striggers\san\serror\sabout\san\sinvalid\suse\sof\s'break'. +D 2025-02-14T17:21:05.787 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 542572667678019e75e16c3e970bfb9358abed9a6ec70f3715997dd9a04b7fd9 +F auto.def 559f8f904a63950fcbe8d5692141ea4e5bf6b1e38ffb25b89a572d829d8ea648 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb +F autoconf/auto.def ef517ef2bb4445b0df5644ef06ba414538192f6e62ad4c03f56d8041a9a78d88 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl c0a5e95b10d8168eb0f942a9d46b1b6a31a06a19991a294d2eace6b0a9d7e897 +F autosetup/sqlite-config.tcl 6a2f007f7c190a0077b99bd442d5bd41638f3d329c08a045653e096f21c9d16d F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5964616dc9de9323fddfede0ded29ee135498c8760017ce1158461f596fe6914 -R 8f2beaf5ac609f50ce863af5a49fb8f4 +P ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 +R f4836849041855b59c987e999995c2b8 U stephan -Z a0a82d139cbfe850e3642558116bae4d +Z 3d0710da40d3f26ab6ec370f0db703f9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ac337f3b52..67eb80d7f6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 +6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 From b0c987967f9b94eb08c0f1b202fbed079c3f5d42 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 17:52:57 +0000 Subject: [PATCH 52/72] Simplify the --help workaround introduced in [6a21d6a2ed]. FossilOrigin-Name: b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 --- auto.def | 4 +--- autoconf/auto.def | 4 +--- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/auto.def b/auto.def index 455b246e09..8a964ad75c 100644 --- a/auto.def +++ b/auto.def @@ -17,9 +17,7 @@ use sqlite-config if {0} { sqlite-config-bootstrap canonical } else { - set sq3options [sqlite-config-bootstrap canonical] - options $sq3options - unset sq3options + options [sqlite-config-bootstrap canonical] sqlite-post-options-init } sqlite-setup-default-cflags diff --git a/autoconf/auto.def b/autoconf/auto.def index 7e154caa32..ccbaaa89ee 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -11,9 +11,7 @@ use sqlite-config if {0} { sqlite-config-bootstrap autoconf } else { - set sq3options [sqlite-config-bootstrap autoconf] - options $sq3options - unset sq3options + options [sqlite-config-bootstrap autoconf] sqlite-post-options-init } sqlite-check-common-bins diff --git a/manifest b/manifest index ec9077572f..4ae8152a9e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\saround\sa\sautosetup\s--help\sbug\swhich\sonly(?)\striggers\son\stcl\s8.6,\sintroduced\sby\s[9978c87139b7b042]\sand\sreported\supstream\sas\s[https://github.com/msteveb/autosetup/issues/73|ticket\s#73].\sSummary:\scalling\s'options'\sfrom\sa\sproc,\sinstead\sof\sthe\sglobal\sscope,\striggers\san\serror\sabout\san\sinvalid\suse\sof\s'break'. -D 2025-02-14T17:21:05.787 +C Simplify\sthe\s--help\sworkaround\sintroduced\sin\s[6a21d6a2ed]. +D 2025-02-14T17:52:57.730 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 559f8f904a63950fcbe8d5692141ea4e5bf6b1e38ffb25b89a572d829d8ea648 +F auto.def 6120063c2901500ee7ff662dee63f234fe24e546c9c0292c3fcb3beb9c2e59f5 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def ef517ef2bb4445b0df5644ef06ba414538192f6e62ad4c03f56d8041a9a78d88 +F autoconf/auto.def c160516ad490b00fad64235323ff18323a6a6523607d2a9705f2ec38ea2f5c33 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ff508926651d632d86081ccde89d3367c89538dde469e9e925540d634ac8a416 -R f4836849041855b59c987e999995c2b8 +P 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 +R ccbb8a55e81df7376a41b6d85d79a9b1 U stephan -Z 3d0710da40d3f26ab6ec370f0db703f9 +Z 440d189d3f6211449eb539edd8ee3916 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 67eb80d7f6..47d8d4598b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 +b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 From d04782206bbd7f3d6dffee706c23bc45e4a99503 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 18:06:28 +0000 Subject: [PATCH 53/72] Make failure to find pthreads support non-fatal unless --enable-threadsafe is specifically passed in. Build regression reported in [8e0fdb8c0d]. FossilOrigin-Name: 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d --- autosetup/sqlite-config.tcl | 29 ++++++++++++++++------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 338eb2408b..1c0e859042 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -680,29 +680,32 @@ proc sqlite-handle-soname {} { } ######################################################################## -# If --enable-thresafe is set, this adds -DSQLITE_THREADSAFE=1 to +# If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to # OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags -# needed for linking pthread. If --enable-threadsafe is not set, adds -# -DSQLITE_THREADSAFE=0 to OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD -# to an empty string. +# needed for linking pthread (possibly an empty string). If +# --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to +# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string. proc sqlite-handle-threadsafe {} { msg-checking "Support threadsafe operation? " + define LDFLAGS_PTHREAD "" + set enable 0 proj-if-opt-truthy threadsafe { - msg-result yes - sqlite-add-feature-flag -DSQLITE_THREADSAFE=1 - if {![proj-check-function-in-lib pthread_create pthread] - || ![proj-check-function-in-lib pthread_mutexattr_init pthread]} { - user-error "Missing required pthread bits" + if {[proj-check-function-in-lib pthread_create pthread] + && [proj-check-function-in-lib pthread_mutexattr_init pthread]} { + set enable 1 + define LDFLAGS_PTHREAD [get-define lib_pthread_create] + undefine lib_pthread_create + undefine lib_pthread_mutexattr_init + } elseif {[proj-opt-was-provided threadsafe]} { + user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check." } - define LDFLAGS_PTHREAD [get-define lib_pthread_create] - undefine lib_pthread_create # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if # found because it's in -lc on some platforms. } { msg-result no - sqlite-add-feature-flag -DSQLITE_THREADSAFE=0 - define LDFLAGS_PTHREAD "" } + sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} + return $enable } ######################################################################## diff --git a/manifest b/manifest index 4ae8152a9e..ac1e73bf34 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\s--help\sworkaround\sintroduced\sin\s[6a21d6a2ed]. -D 2025-02-14T17:52:57.730 +C Make\sfailure\sto\sfind\spthreads\ssupport\snon-fatal\sunless\s--enable-threadsafe\sis\sspecifically\spassed\sin.\sBuild\sregression\sreported\sin\s[8e0fdb8c0d]. +D 2025-02-14T18:06:28.632 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 6a2f007f7c190a0077b99bd442d5bd41638f3d329c08a045653e096f21c9d16d +F autosetup/sqlite-config.tcl 9d193c15975228021821cb3eed667491c6de340baf26d5b21a2ad861187d4936 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6a21d6a2ed627ba0a864bef85369ed17553b808ae5c19891fa1f70505dfcbe39 -R ccbb8a55e81df7376a41b6d85d79a9b1 +P b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 +R deb7bf34e9c57df9897124263106b638 U stephan -Z 440d189d3f6211449eb539edd8ee3916 +Z 5ed369aff0b10c102cba383c3de65e06 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 47d8d4598b..cc8dc2bf44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 +806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d From 6b5599726b752e72763d857a25897b8af882aed7 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Feb 2025 18:17:31 +0000 Subject: [PATCH 54/72] More informative output for the pthread feature test. FossilOrigin-Name: 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc --- autosetup/sqlite-config.tcl | 5 ++++- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 1c0e859042..d70220723f 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -690,6 +690,7 @@ proc sqlite-handle-threadsafe {} { define LDFLAGS_PTHREAD "" set enable 0 proj-if-opt-truthy threadsafe { + msg-result "Checking for libs..." if {[proj-check-function-in-lib pthread_create pthread] && [proj-check-function-in-lib pthread_mutexattr_init pthread]} { set enable 1 @@ -698,11 +699,13 @@ proc sqlite-handle-threadsafe {} { undefine lib_pthread_mutexattr_init } elseif {[proj-opt-was-provided threadsafe]} { user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check." + } else { + msg-result "pthread support not detected" } # Recall that LDFLAGS_PTHREAD might be empty even if pthreads if # found because it's in -lc on some platforms. } { - msg-result no + msg-result "Disabled using --disable-threadsafe" } sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable} return $enable diff --git a/manifest b/manifest index ac1e73bf34..17137cbb99 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sfailure\sto\sfind\spthreads\ssupport\snon-fatal\sunless\s--enable-threadsafe\sis\sspecifically\spassed\sin.\sBuild\sregression\sreported\sin\s[8e0fdb8c0d]. -D 2025-02-14T18:06:28.632 +C More\sinformative\soutput\sfor\sthe\spthread\sfeature\stest. +D 2025-02-14T18:17:31.710 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 9d193c15975228021821cb3eed667491c6de340baf26d5b21a2ad861187d4936 +F autosetup/sqlite-config.tcl 48c55d221189cda985cadd81a88d5a046d327db6e8c5f7395bfde577040ba59f F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b0928f2043ed2a5d445c65f0d7271431e182f5a6fcd24ddcd57ea1cdcf4bbaa2 -R deb7bf34e9c57df9897124263106b638 +P 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d +R 09a63536408c62281d4a45ffc0125d28 U stephan -Z 5ed369aff0b10c102cba383c3de65e06 +Z fe9efd4025c936400a0447a11687e271 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cc8dc2bf44..d3ca8dc79f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d +01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc From 4e87ddc105c16f6557f041cc4426fbe72e5642ab Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 14:12:24 +0000 Subject: [PATCH 55/72] A cleaner workaround for [6a21d6a2], provided by autosetup's creator. FossilOrigin-Name: 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c --- auto.def | 7 +------ autoconf/auto.def | 7 +------ autosetup/sqlite-config.tcl | 14 +++++++------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/auto.def b/auto.def index 8a964ad75c..9df87f579a 100644 --- a/auto.def +++ b/auto.def @@ -14,12 +14,7 @@ # use sqlite-config -if {0} { - sqlite-config-bootstrap canonical -} else { - options [sqlite-config-bootstrap canonical] - sqlite-post-options-init -} +sqlite-config-bootstrap canonical sqlite-setup-default-cflags proj-if-opt-truthy dev { # --enable-dev needs to come early so that the downstream tests diff --git a/autoconf/auto.def b/autoconf/auto.def index ccbaaa89ee..bb8710378f 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -8,12 +8,7 @@ # included in this source tree as ./autosetup/jimsh0.c. # use sqlite-config -if {0} { - sqlite-config-bootstrap autoconf -} else { - options [sqlite-config-bootstrap autoconf] - sqlite-post-options-init -} +sqlite-config-bootstrap autoconf sqlite-check-common-bins sqlite-check-common-system-deps proj-check-rpath diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index d70220723f..ccb114868c 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -295,14 +295,14 @@ proc sqlite-config-bootstrap {buildMode} { } } } - if {0} { - #puts "options = $opts"; exit 0 - options $opts - sqlite-post-options-init - } else { - # Workaround for https://github.com/msteveb/autosetup/issues/73 - return $opts + #lappend opts "soname:=duplicateEntry => {x}"; #just testing + if {[catch {options $opts}]} { + # Workaround for + # where [options] behaves oddly on _some_ TCL builds when it's + # called from deeper than the global scope. + return -code break } + sqlite-post-options-init }; # sqlite-config-bootstrap ######################################################################## diff --git a/manifest b/manifest index 17137cbb99..60ccc5f65f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sinformative\soutput\sfor\sthe\spthread\sfeature\stest. -D 2025-02-14T18:17:31.710 +C A\scleaner\sworkaround\sfor\s[6a21d6a2],\sprovided\sby\sautosetup's\screator. +D 2025-02-15T14:12:24.766 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 6120063c2901500ee7ff662dee63f234fe24e546c9c0292c3fcb3beb9c2e59f5 +F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def c160516ad490b00fad64235323ff18323a6a6523607d2a9705f2ec38ea2f5c33 +F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 48c55d221189cda985cadd81a88d5a046d327db6e8c5f7395bfde577040ba59f +F autosetup/sqlite-config.tcl 17b5417841c402dcf8f656749be6fcff651f3360c48afcdc01aad375fe414fec F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 806ad1ac173d7c0d6d94bfccd3b961fc5c9541b32773c063a8c4082380d7a90d -R 09a63536408c62281d4a45ffc0125d28 +P 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc +R 4a76560a1c5bc38f5777d5f7ba110253 U stephan -Z fe9efd4025c936400a0447a11687e271 +Z 15f10168d95dbdd3c940ff559a29ad5c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d3ca8dc79f..db6cfe8045 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc +334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c From 984f699ccb04322a5edee5f9ebda7131e2493558 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 16:12:28 +0000 Subject: [PATCH 56/72] DLL installation rules no longer create versioned symlinks on platforms where the DLL extension is '.dll' (cygwin, msys2, etc.), as suggested in [forum:28bb79638844c328|forum post 28bb79638844c328]. FossilOrigin-Name: d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb --- autoconf/Makefile.in | 9 ++++++--- main.mk | 23 ++++++++++++----------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index c6cde3c181..65108ee5d0 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -87,7 +87,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi + @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi # ^^^^ on some platforms, install -d fails if the target already exists. @@ -161,8 +161,10 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ - if [ x.dylib = x$(T.dll) ]; then \ + if [ x.dll = x$(T.dll) ]; then \ + echo "No library symlinks needed on this platform"; \ + elif [ x.dylib = x$(T.dll) ]; then \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ mv $(libsqlite3.SO) $$dllname || exit $$?; \ @@ -170,6 +172,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ else \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ diff --git a/main.mk b/main.mk index a63fa2a814..00e519d216 100644 --- a/main.mk +++ b/main.mk @@ -436,7 +436,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \ $(install-dir.lib) $(install-dir.man1) \ $(install-dir.pkgconfig) $(install-dir.all): - if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi + @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi # ^^^^ on some platforms, install -d fails if the target already exists. # @@ -1427,19 +1427,17 @@ so: $(libsqlite3.SO)-$(ENABLE_SHARED) all: so # -# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION) -# and create symlinks which point to it: +# On most Unix-like platforms, install the $(libsqlite3.SO) as +# $(libsqlite3.SO).$(PACKAGE_VERSION) and create symlinks which point +# to it: # # - libsqlite3.so.$(PACKAGE_VERSION) # - libsqlite3.so.0 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) (see below) # - libsqlite3.so =symlink-> libsqlite3.so.3 # -# N.B. we initially had a link named libsqlite3.so.3 but it's -# unnecessary unless we want to set SONAME to libsqlite3.so.3, which -# is also unnecessary. -# -# N.B. different transformations are applied on systems where $(T.dll) -# is ".dylib" and none of the following docs apply on such systems. +# The symlinks are not added on platforms where $(T.dll) is ".dll", +# and different transformations take place on platforms where $(T.dll) +# is ".dylib". # # The link named libsqlite3.so.0 is provided in an attempt to reduce # downstream disruption when performing upgrades from pre-3.48 to a @@ -1481,8 +1479,10 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ fi @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - cd "$(install-dir.lib)" || exit $$?; \ - if [ x.dylib = x$(T.dll) ]; then \ + if [ x.dll = x$(T.dll) ]; then \ + echo "No library symlinks needed on this platform"; \ + elif [ x.dylib = x$(T.dll) ]; then \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ mv $(libsqlite3.SO) $$dllname || exit $$?; \ @@ -1490,6 +1490,7 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ else \ + cd "$(install-dir.lib)" || exit $$?; \ rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ diff --git a/manifest b/manifest index 60ccc5f65f..9f60cfd2ce 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\scleaner\sworkaround\sfor\s[6a21d6a2],\sprovided\sby\sautosetup's\screator. -D 2025-02-15T14:12:24.766 +C DLL\sinstallation\srules\sno\slonger\screate\sversioned\ssymlinks\son\splatforms\swhere\sthe\sDLL\sextension\sis\s'.dll'\s(cygwin,\smsys2,\setc.),\sas\ssuggested\sin\s[forum:28bb79638844c328|forum\spost\s28bb79638844c328]. +D 2025-02-15T16:12:28.303 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 0c71fcc6b2bd1703799a8e5b8f137ba64aad9bdee43c3cc23598cd0d6ce95715 +F autoconf/Makefile.in 40106236dd97053cbeed7f47880375fb402c89f6dc7b8effe363c791f8ef3ca3 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk a127ee141eb7db341d0c949a743a45d1b068b31ac3f1f09cf3b2870b2f18739f +F main.mk 840f0b3ac055a026930e52eb9d6300753e91ddd9fcbafe30395201908ad35e61 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 01b9ed73ca6e72411dcf5a81f445c15c5bc42fa068fc7eca485ac72635b9d2fc -R 4a76560a1c5bc38f5777d5f7ba110253 +P 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c +R 09a6356f5a88db966518edd4cb1e0940 U stephan -Z 15f10168d95dbdd3c940ff559a29ad5c +Z b289b7542f84beb5087c6c73ca65d385 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index db6cfe8045..5f6eb79423 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c +d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb From 4a1c44eea7d9f3d444f9aa2b743edce2c3c42ad0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 16:24:05 +0000 Subject: [PATCH 57/72] Automate update of the library version number in autoconf/tea/configure.ac as part of the tool/mkautoconfamal.sh process, per /chat discussion. FossilOrigin-Name: be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac --- autoconf/Makefile.in | 1 + autoconf/tea/{configure.ac => configure.ac.in} | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- tool/mkautoconfamal.sh | 14 ++++++++------ 5 files changed, 19 insertions(+), 16 deletions(-) rename autoconf/tea/{configure.ac => configure.ac.in} (99%) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 65108ee5d0..d7cc0e946f 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -249,6 +249,7 @@ dist: rm -fr $(dist_name) mkdir -p $(dist_name) cp -rp $(DIST_FILES) $(dist_name)/. + rm -f $(dist_name)/tea/configure.ac.in tar czf $(dist_tarball) $(dist_name) rm -fr $(dist_name) ls -l $(dist_tarball) diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac.in similarity index 99% rename from autoconf/tea/configure.ac rename to autoconf/tea/configure.ac.in index d3952707a2..a13a1e7615 100644 --- a/autoconf/tea/configure.ac +++ b/autoconf/tea/configure.ac.in @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([sqlite],[3.50.0]) +AC_INIT([sqlite],[@VERSION@]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/manifest b/manifest index 9f60cfd2ce..5bc360dce6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C DLL\sinstallation\srules\sno\slonger\screate\sversioned\ssymlinks\son\splatforms\swhere\sthe\sDLL\sextension\sis\s'.dll'\s(cygwin,\smsys2,\setc.),\sas\ssuggested\sin\s[forum:28bb79638844c328|forum\spost\s28bb79638844c328]. -D 2025-02-15T16:12:28.303 +C Automate\supdate\sof\sthe\slibrary\sversion\snumber\sin\sautoconf/tea/configure.ac\sas\spart\sof\sthe\stool/mkautoconfamal.sh\sprocess,\sper\s/chat\sdiscussion. +D 2025-02-15T16:24:05.242 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 40106236dd97053cbeed7f47880375fb402c89f6dc7b8effe363c791f8ef3ca3 +F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -24,7 +24,7 @@ F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac 830cb2af5a3888312d0fd88402c2509d551d60e4c03f0481006a07c78313ef12 +F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 w autoconf/tea/configure.ac F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 55aec3c6d7e9a1de9b8d2fdc9c27fd055da3ac3a51b572195e2ae7300bcfd3a2 @@ -2142,7 +2142,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a -F tool/mkautoconfamal.sh 14d2144043c6455958012f92324f4ce7c90a261b5daa2f2c7509498468475f8d +F tool/mkautoconfamal.sh c5e65fa1c922f2e3b3e4f6cd0331ec7d84bdef085f32cb1c46673cdf95ec8090 F tool/mkccode.tcl 210159febe0ef0ecbc53c79833500663ceaba0115b2b374405818dc835b5f84b x F tool/mkctimec.tcl b57ab5c43cf6a46ba4030027da1cc73d7839e7b78da3b328545bc941bb62360b x F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 334ed723d0fc0b202f79a9746459181f637ca99c54864a4aa11629eecb4b8d0c -R 09a6356f5a88db966518edd4cb1e0940 +P d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb +R f10f58ea0cc54a3a2f87d5e937cce9f5 U stephan -Z b289b7542f84beb5087c6c73ca65d385 +Z 7cd96ea5b5e041e12c38e608e87b6e81 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5f6eb79423..d8fe83f80f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb +be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index c26ca47bf1..c26ac8c73c 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -25,10 +25,14 @@ VERSION=`cat $TOP/VERSION` HASH=`cut -c1-10 $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` -# Verify that the version number in the TEA autoconf file is correct. -# Fail with an error if not. +# Inject the current version into the TEA autoconf file. # -if grep $VERSION $TOP/autoconf/tea/configure.ac +sed -e "s/@VERSION@/$VERSION/" \ + < $TOP/autoconf/tea/configure.ac.in \ + > $TOP/autoconf/tea/configure.ac +# And then verify that that worked... +# +if grep $VERSION $TOP/autoconf/tea/configure.ac > /dev/null then echo "TEA version number ok" else echo "TEA version number mismatch. Should be $VERSION"; exit 1 fi @@ -91,10 +95,8 @@ cat < tea/generic/tclsqlite3.c EOF cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c -sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" tea/configure.ac > tmp -mv tmp tea/configure.ac - cd tea +rm -f configure.ac.in autoconf rm -rf autom4te.cache From ac729894be0d60e9bf298b3c45611a4bf7b74b1c Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 15 Feb 2025 17:29:56 +0000 Subject: [PATCH 58/72] Remove tea version check from tool/srctree-check.tcl, as it's obsoleted by [be265559]. FossilOrigin-Name: 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/srctree-check.tcl | 15 --------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 5bc360dce6..2f7a6368f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Automate\supdate\sof\sthe\slibrary\sversion\snumber\sin\sautoconf/tea/configure.ac\sas\spart\sof\sthe\stool/mkautoconfamal.sh\sprocess,\sper\s/chat\sdiscussion. -D 2025-02-15T16:24:05.242 +C Remove\stea\sversion\scheck\sfrom\stool/srctree-check.tcl,\sas\sit's\sobsoleted\sby\s[be265559]. +D 2025-02-15T17:29:56.489 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -24,7 +24,7 @@ F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 w autoconf/tea/configure.ac +F autoconf/tea/configure.ac.in da18360dfdeac7414fa8deb549f3d65aeca0ae1150ff1a8b902019b39ce019a4 F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 55aec3c6d7e9a1de9b8d2fdc9c27fd055da3ac3a51b572195e2ae7300bcfd3a2 @@ -2193,7 +2193,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 4e635aed7dd8198d2b212353823d4b10b380211bf9a8287921ec6b2b773ca097 +F tool/srctree-check.tcl fa4d82dd3e8a38d5cbce7d6ade8abef2f42b9eca0394484d521dc8d086739460 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c dfe9cc03cf87728ac9836be30763f8aa52b82caca0780b3d3f3572e4643b01d3 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d743410665df8ba962db6e1f245d929b005d0add77be95af3c3c7f87a1c758fb -R f10f58ea0cc54a3a2f87d5e937cce9f5 +P be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac +R ec0de275110a891612615fec90c077b9 U stephan -Z 7cd96ea5b5e041e12c38e608e87b6e81 +Z db33573bd4969af02b51c5852b05ae57 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8fe83f80f..99249bbdb0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac +1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index b16bd924a0..921bb0976e 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -34,21 +34,6 @@ set TCLSH [info nameofexe] # set NERR 0 -######################### autoconf/tea/configure.ac ########################### - -set confac [readfile $ROOT/autoconf/tea/configure.ac] -set vers [readfile $ROOT/VERSION] -set pattern {AC_INIT([sqlite],[} -append pattern [string trim $vers] -append pattern {])} -if {[string first $pattern $confac]<=0} { - puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION" - puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the" - puts "...... correct version number in AC_INIT()" - incr NERR -} -unset confac - ######################### autoconf/Makefile.msc ############################### set f1 [readfile $ROOT/autoconf/Makefile.msc] From f4fc2ee20311a0a5141726c71d318ab52001c974 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 16 Feb 2025 10:57:25 +0000 Subject: [PATCH 59/72] Add a typecast to avoid 32-bit integer overflow in the concat_ws() function with an enormous separator values and many arguments. FossilOrigin-Name: 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/func.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2f7a6368f8..9f03427425 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\stea\sversion\scheck\sfrom\stool/srctree-check.tcl,\sas\sit's\sobsoleted\sby\s[be265559]. -D 2025-02-15T17:29:56.489 +C Add\sa\stypecast\sto\savoid\s32-bit\sinteger\soverflow\sin\sthe\sconcat_ws()\nfunction\swith\san\senormous\sseparator\svalues\sand\smany\sarguments. +D 2025-02-16T10:57:25.604 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -732,7 +732,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f -F src/func.c b2fb33139972d7d65640b27ea962a49f1616265428001090cab39fcf270228e1 +F src/func.c 838bb4c02065daef6ef359cf294e6b6f95a73d4ff0159240a4710478bae80e1c F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P be265559a334eda127862ae54edb58c46051f74445642daa84a9f61a81df1bac -R ec0de275110a891612615fec90c077b9 -U stephan -Z db33573bd4969af02b51c5852b05ae57 +P 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e +R a83683a53b87e7c1a91cc72d41480630 +U drh +Z e32688ad6baa8e44c1d5b0c7282d0615 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 99249bbdb0..f4fea86bdd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e +498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 diff --git a/src/func.c b/src/func.c index 52462b4682..222c9ac64a 100644 --- a/src/func.c +++ b/src/func.c @@ -1570,7 +1570,7 @@ static void concatFuncCore( for(i=0; i Date: Sun, 16 Feb 2025 13:13:19 +0000 Subject: [PATCH 60/72] API naming typo reported in [forum:416f2d8dec|forum post 416f2d8dec]. No functional changes. FossilOrigin-Name: 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d --- ext/jni/src/org/sqlite/jni/capi/CApi.java | 12 ++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index b5d08306e2..3387282378 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -199,16 +199,16 @@ public final class CApi { } private static native sqlite3_backup sqlite3_backup_init( - @NotNull long ptrToDbDest, @NotNull String destTableName, - @NotNull long ptrToDbSrc, @NotNull String srcTableName + @NotNull long ptrToDbDest, @NotNull String destSchemaName, + @NotNull long ptrToDbSrc, @NotNull String srcSchemaName ); public static sqlite3_backup sqlite3_backup_init( - @NotNull sqlite3 dbDest, @NotNull String destTableName, - @NotNull sqlite3 dbSrc, @NotNull String srcTableName + @NotNull sqlite3 dbDest, @NotNull String destSchemaName, + @NotNull sqlite3 dbSrc, @NotNull String srcSchemaName ){ - return sqlite3_backup_init( dbDest.getNativePointer(), destTableName, - dbSrc.getNativePointer(), srcTableName ); + return sqlite3_backup_init( dbDest.getNativePointer(), destSchemaName, + dbSrc.getNativePointer(), srcSchemaName ); } private static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup); diff --git a/manifest b/manifest index 9f03427425..aaf0236700 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stypecast\sto\savoid\s32-bit\sinteger\soverflow\sin\sthe\sconcat_ws()\nfunction\swith\san\senormous\sseparator\svalues\sand\smany\sarguments. -D 2025-02-16T10:57:25.604 +C API\snaming\stypo\sreported\sin\s[forum:416f2d8dec|forum\spost\s416f2d8dec].\sNo\sfunctional\schanges. +D 2025-02-16T13:13:19.874 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -298,7 +298,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 27bbd944ea8c147afd25b93f17dc397f3627611ebe2878944a32ffeffc98e99e +F ext/jni/src/org/sqlite/jni/capi/CApi.java 8620c652138b84af795fd65bc200028590f533407c093d4355f9524dc594c004 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1860ea060bd373f49d0b5d41367409a4607e9a0a0cb606af99927af15de1e21e -R a83683a53b87e7c1a91cc72d41480630 -U drh -Z e32688ad6baa8e44c1d5b0c7282d0615 +P 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 +R 4e1e370efca67eead8ee775d6ab0dd45 +U stephan +Z 1f778f59dd3029d05607c051f27c5963 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f4fea86bdd..274efd1e8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 +0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d From 4b1c8362e756d44a6227b7054bb07b9d65a35374 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 13:49:18 +0000 Subject: [PATCH 61/72] Update autoconf/Makefile.msc from tool/mkmsvcmin.tcl. FossilOrigin-Name: 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b --- autoconf/Makefile.msc | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index f891036a14..538cc43a4b 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -1088,5 +1088,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H) clean: del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL - del /Q sqlite3.def tclsqlite3.def ctime.c 2>NUL + del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL diff --git a/manifest b/manifest index aaf0236700..afcb520cfa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C API\snaming\stypo\sreported\sin\s[forum:416f2d8dec|forum\spost\s416f2d8dec].\sNo\sfunctional\schanges. -D 2025-02-16T13:13:19.874 +C Update\sautoconf/Makefile.msc\sfrom\stool/mkmsvcmin.tcl. +D 2025-02-16T13:49:18.989 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -17,7 +17,7 @@ F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 -F autoconf/Makefile.msc 4f09fead3bf7de337242896f107c5d03cd8f7b39754315ab091a2e4d02892c40 +F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5 -R 4e1e370efca67eead8ee775d6ab0dd45 +P 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d +R 9c4f553142a0ea668666d37befbf6bf0 U stephan -Z 1f778f59dd3029d05607c051f27c5963 +Z 4091a24d92e7409613201f686c9db113 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 274efd1e8c..d99bcbb45f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d +9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b From c2d56ea4ea131ee09d0dbd09e96ba5d511d96ee0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 18:14:05 +0000 Subject: [PATCH 62/72] Re-add the --disable-static-shell configure feature to the autoconf bundle. It got lost in the autoconf-to-autosetup port, as reported in [forum:cc219ee7044|forum post cc219ee7044]. FossilOrigin-Name: 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 --- autoconf/Makefile.in | 15 ++++++++++++--- autoconf/auto.def | 1 + autosetup/sqlite-config.tcl | 4 ++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index d7cc0e946f..b186f498b9 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -202,12 +202,21 @@ install-lib: install-lib-$(ENABLE_LIB_STATIC) install: install-lib -sqlite3$(T.exe): $(TOP)/shell.c $(TOP)/sqlite3.c +# Flags to link the shell app either directly against sqlite3.c +# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0). +# +ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ +sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) +sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) +sqlite3-shell-deps.1 = $(TOP)/sqlite3.c +sqlite3-shell-deps.0 = $(libsqlite3.SO) +sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL)) $(CC) -o $@ \ - $(TOP)/shell.c $(TOP)/sqlite3.c \ + $(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \ -I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \ $(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \ - $(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) + $(LDFLAGS) $(LDFLAGS.readline) + all: sqlite3$(T.exe) install-shell: sqlite3$(T.exe) $(install-dir.bin) diff --git a/autoconf/auto.def b/autoconf/auto.def index bb8710378f..099b52aff7 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -22,6 +22,7 @@ sqlite-handle-load-extension sqlite-handle-math sqlite-handle-icu +define ENABLE_STATIC_SHELL [opt-bool static-shell] define ENABLE_LIB_SHARED [opt-bool shared] define ENABLE_LIB_STATIC [opt-bool static] diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index ccb114868c..4416372951 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -259,6 +259,10 @@ proc sqlite-config-bootstrap {buildMode} { linemacros => {Enable #line macros in the amalgamation} dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } + {autoconf} { + # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 + static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} + } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } diff --git a/manifest b/manifest index afcb520cfa..8d78e7da63 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sautoconf/Makefile.msc\sfrom\stool/mkmsvcmin.tcl. -D 2025-02-16T13:49:18.989 +C Re-add\sthe\s--disable-static-shell\sconfigure\sfeature\sto\sthe\sautoconf\sbundle.\sIt\sgot\slost\sin\sthe\sautoconf-to-autosetup\sport,\sas\sreported\sin\s[forum:cc219ee7044|forum\spost\scc219ee7044]. +D 2025-02-16T18:14:05.950 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,11 +16,11 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 5e5ab43450b27e7247a0066f0606c5471e72f935c59ac3ba40038e23ebce92d5 +F autoconf/Makefile.in 491e16a002c19263af3aeba857ca4619d2e8ad8550f6c9cea89ba0385fdd4344 F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 9af634c6d51fa4b82c9bb61b51249ca087f2cbe09c7c3c31f920759082a1ffdb +F autoconf/auto.def 3a318c4898024b35ed61a4876a42e3dcc313f93bd8486874d1ad498b88643d1a F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 17b5417841c402dcf8f656749be6fcff651f3360c48afcdc01aad375fe414fec +F autosetup/sqlite-config.tcl 671b79027b162b9d945367d288cf82a9f6c7bd834c7b6812a24084f9ecf763ea F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0cfb9e234e116741d01b65d0abf18210e495276319fb08ec6e40d3f2e698956d -R 9c4f553142a0ea668666d37befbf6bf0 +P 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b +R 98921f713d8fbfbddc4ac85a3af675c9 U stephan -Z 4091a24d92e7409613201f686c9db113 +Z e6ed162aea3b5e30451735f568dc1c13 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d99bcbb45f..dbd9d9bc69 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b +47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 From 3cc3898e13e903e620f9e471313fc4f290dc5c14 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Feb 2025 19:16:09 +0000 Subject: [PATCH 63/72] Internal reordering/re-grouping of some configure flags. No functional changes. FossilOrigin-Name: 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d --- autosetup/sqlite-config.tcl | 44 ++++++++++++++++++------------------- manifest | 12 +++++----- manifest.uuid | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 4416372951..7d9a9ea84b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -237,6 +237,28 @@ proc sqlite-config-bootstrap {buildMode} { } } + # Options primarily for downstream packagers/package maintainers + packaging { + {autoconf} { + # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 + static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} + } + {*} { + # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded + soname:=legacy + => {SONAME for libsqlite3.so. "none", or not using this flag, sets no + soname. "legacy" sets it to its historical value of + libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets + it to that literal value. Any other value is assumed to be a + suffix which gets applied to "libsqlite3.so.", + e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} + # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 + out-implib=0 + => {Enable use of --out-implib linker flag to generate an + "import library" for the DLL} + } + } + # Options mostly for sqlite's own development developer { {*} { @@ -259,32 +281,10 @@ proc sqlite-config-bootstrap {buildMode} { linemacros => {Enable #line macros in the amalgamation} dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } - {autoconf} { - # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 - static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} - } {*} { dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} } } - - # Options specifically for downstream package maintainers - packaging { - {*} { - # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded - soname:=legacy - => {SONAME for libsqlite3.so. "none", or not using this flag, sets no - soname. "legacy" sets it to its historical value of - libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets - it to that literal value. Any other value is assumed to be a - suffix which gets applied to "libsqlite3.so.", - e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} - # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 - out-implib=0 - => {Enable use of --out-implib linker flag to generate an - "import library" for the DLL} - } - } }; # $allOpts # Filter allOpts to create the set of [options] legal for this build diff --git a/manifest b/manifest index 8d78e7da63..1c68ce988d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Re-add\sthe\s--disable-static-shell\sconfigure\sfeature\sto\sthe\sautoconf\sbundle.\sIt\sgot\slost\sin\sthe\sautoconf-to-autosetup\sport,\sas\sreported\sin\s[forum:cc219ee7044|forum\spost\scc219ee7044]. -D 2025-02-16T18:14:05.950 +C Internal\sreordering/re-grouping\sof\ssome\sconfigure\sflags.\sNo\sfunctional\schanges. +D 2025-02-16T19:16:09.834 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl cef1e0aa0f2dee2042af66f28c97a9445f84d55d858ba9db4f6116846a1a325f -F autosetup/sqlite-config.tcl 671b79027b162b9d945367d288cf82a9f6c7bd834c7b6812a24084f9ecf763ea +F autosetup/sqlite-config.tcl e1d65cc632e1de94ff39618ac82b649f2062f674ca36dae78ab3573cab096761 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ffe94d2ea0b3679c3d2657e2c3b67f84c09e9bcbbe0a13c76d58858df367d1b -R 98921f713d8fbfbddc4ac85a3af675c9 +P 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 +R 969cb5a3f034581c276e9924fba081e4 U stephan -Z e6ed162aea3b5e30451735f568dc1c13 +Z e3597b532b91bea5961ce10f269dd158 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dbd9d9bc69..70121ce06d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 +0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d From 59c64e086abcd938662c63a331683f34a39f696a Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 10:58:23 +0000 Subject: [PATCH 64/72] Fix a typo (a missing ")") in a comment that is used to generate documentation. No changes to code. FossilOrigin-Name: ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1c68ce988d..836882a5fa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Internal\sreordering/re-grouping\sof\ssome\sconfigure\sflags.\sNo\sfunctional\schanges. -D 2025-02-16T19:16:09.834 +C Fix\sa\stypo\s(a\smissing\s")")\sin\sa\scomment\sthat\sis\sused\sto\sgenerate\ndocumentation.\s\sNo\schanges\sto\scode. +D 2025-02-17T10:58:23.329 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -780,7 +780,7 @@ F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 -F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0 +F src/sqlite.h.in 16e92876a50762b860e8855dadb3448880aaaa8da42b7b5a73d7a5afff54305e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 47e817f663468ce08dae4965b7ecacefb921a77398ec958b35bf5cedee767e24 -R 969cb5a3f034581c276e9924fba081e4 -U stephan -Z e3597b532b91bea5961ce10f269dd158 +P 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d +R b319f27049b560368bfb8eee14269c8c +U drh +Z 1ed7fde276b92255807656366cd0eace # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 70121ce06d..5c4a155602 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d +ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f diff --git a/src/sqlite.h.in b/src/sqlite.h.in index a9eb5fed72..52968a20c7 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2239,7 +2239,7 @@ struct sqlite3_mem_methods { ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE ** should have a total of five parameters. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a +** ^The first argument (the third parameter to [sqlite3_db_config()]) is a ** pointer to a memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the From 56d2fd008b108109f489339f5fd55212bb50afd4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 14:16:49 +0000 Subject: [PATCH 65/72] Harden the SQLITE_DBCONFIG_LOOKASIDE interface against misuse, such as described in [forum:/forumpost/48f365daec|forum post 48f365daec]. Enhancements to the SQLITE_DBCONFIG_LOOKASIDE documentation. Test cases in TH3. FossilOrigin-Name: 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 --- manifest | 14 +++++------ manifest.uuid | 2 +- src/main.c | 42 ++++++++++++++++++++------------- src/sqlite.h.in | 62 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 76 insertions(+), 44 deletions(-) diff --git a/manifest b/manifest index 836882a5fa..a4fe1e8034 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\s(a\smissing\s")")\sin\sa\scomment\sthat\sis\sused\sto\sgenerate\ndocumentation.\s\sNo\schanges\sto\scode. -D 2025-02-17T10:58:23.329 +C Harden\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sinterface\sagainst\smisuse,\ssuch\sas\ndescribed\sin\s[forum:/forumpost/48f365daec|forum\spost\s48f365daec].\s\sEnhancements\nto\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sdocumentation.\s\sTest\scases\sin\sTH3. +D 2025-02-17T14:16:49.747 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -742,7 +742,7 @@ F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 -F src/main.c b99d15d843f7a86adbec855de77b1656dde07359722ef63a9d9393678dbb58d1 +F src/main.c 2650f54f7c2aa2c53cc61b571bad9c7c32d60400e3f6a270bd444f5d76e03eb8 F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -780,7 +780,7 @@ F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993 F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237 -F src/sqlite.h.in 16e92876a50762b860e8855dadb3448880aaaa8da42b7b5a73d7a5afff54305e +F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0c085a5ab51d6ac793a147a865bd086b1a6a572932c251b38d3854e4ea802f8d -R b319f27049b560368bfb8eee14269c8c +P ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f +R 178cf752f8b81a96b68c7190d2092e4d U drh -Z 1ed7fde276b92255807656366cd0eace +Z b489b8d8bee8421d4edf281585fd7758 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5c4a155602..f2fb8fb0d3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f +1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 diff --git a/src/main.c b/src/main.c index 17d0cd434a..28a7216405 100644 --- a/src/main.c +++ b/src/main.c @@ -759,17 +759,22 @@ int sqlite3_config(int op, ...){ ** If lookaside is already active, return SQLITE_BUSY. ** ** The sz parameter is the number of bytes in each lookaside slot. -** The cnt parameter is the number of slots. If pStart is NULL the -** space for the lookaside memory is obtained from sqlite3_malloc(). -** If pStart is not NULL then it is sz*cnt bytes of memory to use for -** the lookaside memory. +** The cnt parameter is the number of slots. If pBuf is NULL the +** space for the lookaside memory is obtained from sqlite3_malloc() +** or similar. If pBuf is not NULL then it is sz*cnt bytes of memory +** to use for the lookaside memory. */ -static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ +static int setupLookaside( + sqlite3 *db, /* Database connection being configured */ + void *pBuf, /* Memory to use for lookaside. May be NULL */ + int sz, /* Desired size of each lookaside memory slot */ + int cnt /* Number of slots to allocate */ +){ #ifndef SQLITE_OMIT_LOOKASIDE - void *pStart; - sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; - int nBig; /* Number of full-size slots */ - int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ + void *pStart; /* Start of the lookaside buffer */ + sqlite3_int64 szAlloc; /* Total space set aside for lookaside memory */ + int nBig; /* Number of full-size slots */ + int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ if( sqlite3LookasideUsed(db,0)>0 ){ return SQLITE_BUSY; @@ -782,17 +787,22 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ sqlite3_free(db->lookaside.pStart); } /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger - ** than a pointer to be useful. + ** than a pointer and small enough to fit in a u16. */ - sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ + sz = ROUNDDOWN8(sz); if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; - if( cnt<0 ) cnt = 0; - if( sz==0 || cnt==0 ){ + if( sz>65528 ) sz = 65528; + /* Count must be at least 1 to be useful, but not so large as to use + ** more than 0x7fff0000 total bytes for lookaside. */ + if( cnt<1 ) cnt = 0; + if( sz>0 && cnt>(0x7fff0000/sz) ) cnt = 0x7fff0000/sz; + szAlloc = (i64)sz*(i64)cnt; + if( szAlloc==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ sqlite3BeginBenignMalloc(); - pStart = sqlite3Malloc( szAlloc ); /* IMP: R-61949-35727 */ + pStart = sqlite3Malloc( szAlloc ); sqlite3EndBenignMalloc(); if( pStart ) szAlloc = sqlite3MallocSize(pStart); }else{ @@ -801,10 +811,10 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( sz>=LOOKASIDE_SMALL*3 ){ nBig = szAlloc/(3*LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else if( sz>=LOOKASIDE_SMALL*2 ){ nBig = szAlloc/(LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */ if( sz>0 ){ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 52968a20c7..43cc4962e9 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1989,13 +1989,16 @@ struct sqlite3_mem_methods { ** ** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    **
    ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine -** the default size of lookaside memory on each [database connection]. +** the default size of [lookaside memory] on each [database connection]. ** The first argument is the -** size of each lookaside buffer slot and the second is the number of -** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE -** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** option to [sqlite3_db_config()] can be used to change the lookaside -** configuration on individual connections.)^
    +** size of each lookaside buffer slot ("sz") and the second is the number of +** slots allocated to each database connection ("cnt").)^ +** ^(SQLITE_CONFIG_LOOKASIDE sets the default lookaside size. +** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can +** be used to change the lookaside configuration on individual connections.)^ +** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the +** default lookaside configuration at compile-time. +** ** ** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    **
    ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is @@ -2232,31 +2235,50 @@ struct sqlite3_mem_methods { ** [[SQLITE_DBCONFIG_LOOKASIDE]] **
    SQLITE_DBCONFIG_LOOKASIDE
    **
    The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the -** configuration of the lookaside memory allocator within a database +** configuration of the [lookaside memory allocator] within a database ** connection. ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not ** in the [DBCONFIG arguments|usual format]. ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two, ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE ** should have a total of five parameters. -** ^The first argument (the third parameter to [sqlite3_db_config()]) is a +**
      +**
    1. The first argument ("buf") is a ** pointer to a memory buffer to use for lookaside memory. -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb -** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the -** size of each lookaside buffer slot. ^The third argument is the number of -** slots. The size of the buffer in the first argument must be greater than -** or equal to the product of the second and third arguments. The buffer -** must be aligned to an 8-byte boundary. ^If the second argument to -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally -** rounded down to the next smaller multiple of 8. ^(The lookaside memory +** The first argument may be NULL in which case SQLite will allocate the +** lookaside buffer itself using [sqlite3_malloc()]. +**

    2. The second argument ("sz") is the +** size of each lookaside buffer slot. Lookaside is disabled if "sz" +** is less than 8. The "sz" argument should be a multiple of 8 less than +** 65536. If "sz" does not meet this constraint, it is reduced in size until +** it does. +**

    3. The third argument ("cnt") is the number of slots. Lookaside is disabled +** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so +** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt" +** parameter is usually chosen so that the product of "sz" and "cnt" is less +** than 1,000,000. +**

    +**

    If the "buf" argument is not NULL, then it must +** point to a memory buffer with a size that is greater than +** or equal to the product of "sz" and "cnt". +** The buffer must be aligned to an 8-byte boundary. +** The lookaside memory ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words -** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero. +** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns -** [SQLITE_BUSY].)^

    +** [SQLITE_BUSY]. +** If the "buf" argument is NULL and an attempt +** to allocate memory based on "sz" and "cnt" fails, then +** lookaside is silently disabled. +**

    +** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the +** default lookaside configuration at initialization. The +** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside +** configuration at compile-time. Typical values for lookaside are 1200 for +** "sz" and 40 to 100 for "cnt". +** ** ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] **

    SQLITE_DBCONFIG_ENABLE_FKEY
    From f6757b305a57c7df59e7b8de134946c7d35b4914 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 17 Feb 2025 16:04:21 +0000 Subject: [PATCH 66/72] Replace TEXE (legacy name) with T.exe (3.48+ name) in two places in makefiles. This fixes distclean of jimsh.exe in the canonical build in non-native Windows environments. FossilOrigin-Name: edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b --- Makefile.in | 2 +- main.mk | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 59a62d0618..1ff791c8ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -147,7 +147,7 @@ T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite # shell command. # CFLAGS.jimsh = @CFLAGS_JIMSH@ -JIMSH = ./jimsh$(TEXE) +JIMSH = ./jimsh$(T.exe) # # $(B.tclsh) is documented in main.mk. diff --git a/main.mk b/main.mk index 00e519d216..6081fbdfd8 100644 --- a/main.mk +++ b/main.mk @@ -1708,7 +1708,7 @@ fuzztest: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) ./fuzzcheck$(T.exe) $(FUZZDATA) ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db -valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(T.exe) +valgrindfuzz: fuzzcheck$(T.exe) $(FUZZDATA) sessionfuzz$(T.exe) valgrind ./fuzzcheck$(T.exe) --cell-size-check --limit-mem 10M $(FUZZDATA) valgrind ./sessionfuzz$(T.exe) run $(TOP)/test/sessionfuzz-data1.db diff --git a/manifest b/manifest index a4fe1e8034..89d17bb2ce 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Harden\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sinterface\sagainst\smisuse,\ssuch\sas\ndescribed\sin\s[forum:/forumpost/48f365daec|forum\spost\s48f365daec].\s\sEnhancements\nto\sthe\sSQLITE_DBCONFIG_LOOKASIDE\sdocumentation.\s\sTest\scases\sin\sTH3. -D 2025-02-17T14:16:49.747 +C Replace\sTEXE\s(legacy\sname)\swith\sT.exe\s(3.48+\sname)\sin\stwo\splaces\sin\smakefiles.\sThis\sfixes\sdistclean\sof\sjimsh.exe\sin\sthe\scanonical\sbuild\sin\snon-native\sWindows\senvironments. +D 2025-02-17T16:04:21.900 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in aa869faf7ca086f35c9b3e974fddc7fd65ed2dc45a246b1a94e6f9fdc99b0ed5 +F Makefile.in 80be2e281d4647ac15a5bac15d5d20fc76d1cfb3f3f6dc01d1a26e3346a5042a F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc 50c656e096ae49ccf9e5e88b4995f0a155f231ebae5b6d185cc64ce99d728a83 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 840f0b3ac055a026930e52eb9d6300753e91ddd9fcbafe30395201908ad35e61 +F main.mk 323e71cd79e49c9e33d39b6558694a71c08973d9ac3ee4f211aa32e58bd876f5 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f -R 178cf752f8b81a96b68c7190d2092e4d -U drh -Z b489b8d8bee8421d4edf281585fd7758 +P 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 +R 04096de493525d9bda4b4505f3bd6b4f +U stephan +Z fb1f31bb07ada248f4e4b04a26bc9aeb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f2fb8fb0d3..1b2fe3d822 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 +edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b From ad5dcff53bfb93d0e2ce8165fc2d63f83edd4c79 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 17 Feb 2025 16:14:15 +0000 Subject: [PATCH 67/72] Add two generated files to the distclean rules of the autoconf bundle. FossilOrigin-Name: b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 --- autoconf/Makefile.in | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index b186f498b9..d494e9d1e0 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -240,7 +240,7 @@ clean: rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a distclean: clean - rm -f jimsh0$(T.exe) config.* sqlite3.pc + rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile DIST_FILES := \ README.txt VERSION \ diff --git a/manifest b/manifest index 89d17bb2ce..826c33b244 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\sTEXE\s(legacy\sname)\swith\sT.exe\s(3.48+\sname)\sin\stwo\splaces\sin\smakefiles.\sThis\sfixes\sdistclean\sof\sjimsh.exe\sin\sthe\scanonical\sbuild\sin\snon-native\sWindows\senvironments. -D 2025-02-17T16:04:21.900 +C Add\stwo\sgenerated\sfiles\sto\sthe\sdistclean\srules\sof\sthe\sautoconf\sbundle. +D 2025-02-17T16:14:15.880 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -16,7 +16,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 491e16a002c19263af3aeba857ca4619d2e8ad8550f6c9cea89ba0385fdd4344 +F autoconf/Makefile.in 844bc155e1c02075821530b2b4d996ab3d162e647352bb6e2895f3d0e64ad988 F autoconf/Makefile.msc 1249e425a24859c7b3f17575275247df9eec3bddc0d1d7e73941f1abdbb95a92 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377 -R 04096de493525d9bda4b4505f3bd6b4f +P edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b +R 35984cc59a3a13710af92ec281a18a95 U stephan -Z fb1f31bb07ada248f4e4b04a26bc9aeb +Z b005a16738a1a2fa13fe8f4e242441b2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1b2fe3d822..3431f51c49 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b +b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 From ef86b942b9ffbfc2086da7865effea3e7950c7a0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 17:33:14 +0000 Subject: [PATCH 68/72] Code changes that make it easier to prove that no 32-bit integer overflows happen during memory allocation. No problems fixed; this change is just to make future maintenance easier. FossilOrigin-Name: 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 --- manifest | 50 ++++++++++++++++++++++++------------------------- manifest.uuid | 2 +- src/analyze.c | 2 +- src/attach.c | 2 +- src/bitvec.c | 2 +- src/btree.c | 5 +++-- src/build.c | 24 ++++++++++++++++-------- src/expr.c | 2 +- src/func.c | 2 +- src/memdb.c | 4 ++-- src/os_win.c | 19 +++++++++---------- src/pager.c | 30 ++++++++++++++++------------- src/pcache1.c | 8 ++++---- src/printf.c | 2 +- src/sqliteInt.h | 8 ++++++++ src/vdbe.c | 10 +++++----- src/vdbeapi.c | 7 +++++-- src/vdbeaux.c | 5 +++-- src/vdbemem.c | 4 ++-- src/vdbesort.c | 6 ++++-- src/wal.c | 2 +- 21 files changed, 111 insertions(+), 85 deletions(-) diff --git a/manifest b/manifest index 826c33b244..1e1fb70b59 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stwo\sgenerated\sfiles\sto\sthe\sdistclean\srules\sof\sthe\sautoconf\sbundle. -D 2025-02-17T16:14:15.880 +C Code\schanges\sthat\smake\sit\seasier\sto\sprove\sthat\sno\s32-bit\sinteger\soverflows\nhappen\sduring\smemory\sallocation.\s\sNo\sproblems\sfixed;\sthis\schange\sis\sjust\nto\smake\sfuture\smaintenance\seasier. +D 2025-02-17T17:33:14.937 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -713,26 +713,26 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03 F src/alter.c 1751e231d8385067fa0d0145f0d461a092db6bd3d7edbfc3172db625aceccd9a -F src/analyze.c 0823d2edb3ce564157e9d62714cc729027933209b712e95fbabb23e47fff0aec -F src/attach.c 3a5cb9ee4aad6c5b22268287340a4f2f7b07959b7a522201be30fee23cd802e9 +F src/analyze.c 6d27b425a16817975e6a4f8501e531d13dd1bf4b53bff2329dbc1f301aeef82d +F src/attach.c c36d9d82811e2274bd06bf3b34459e36d8ae8a7f32efa5cbf3f890eef08a9987 F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 -F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 +F src/bitvec.c d64aa60cd5f2721ebd6c155b3ac5ff7342086bead485239d57342cdfdccb9f50 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c +F src/btree.c 9316859aa5f14bde4a3719ffb1570219e51c5de433221e38b87ea19db868aedf F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6 -F src/build.c 602fc45ea6301a3dc03ec20a9f9b294c492b7e1766ae96651f2ba8044dc445a6 +F src/build.c 2fa35745a279e2a17eec6df67a3cd35d456c136a7f5c75e80bdd6c5658423b60 F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57 F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117 +F src/expr.c 6e0635f3e3761f368d10e77d26d29a1a521ab208f1be66e84c13354ffbcf5ad2 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f -F src/func.c 838bb4c02065daef6ef359cf294e6b6f95a73d4ff0159240a4710478bae80e1c +F src/func.c 6c8b7bbdc5b588f3cfc79ed5effcfd3031758f5034c464fcd8891e8010b4d317 F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf @@ -749,7 +749,7 @@ F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 F src/mem2.c c8bfc9446fd0798bddd495eb5d9dbafa7d4b7287d8c22d50a83ac9daa26d8a75 F src/mem3.c 30301196cace2a085cbedee1326a49f4b26deff0af68774ca82c1f7c06fda4f6 F src/mem5.c b7da5c10a726aacacc9ad7cdcb0667deec643e117591cc69cf9b4b9e7f3e96ff -F src/memdb.c 16679def118b5fd75292a253166d3feba3ec9c6189205bf209643ecdb2174ecc +F src/memdb.c a3feb427cdd4036ea2db0ba56d152f14c8212ca760ccb05fb7aa49ff6b897df3 F src/memjournal.c c283c6c95d940eb9dc70f1863eef3ee40382dbd35e5a1108026e7817c206e8a0 F src/msvc.h 80b35f95d93bf996ccb3e498535255f2ef1118c78764719a7cd15ab4106ccac9 F src/mutex.c 06bcd9c3dbf2d9b21fcd182606c00fafb9bfe0287983c8e17acd13d2c81a2fa9 @@ -764,17 +764,17 @@ F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 F src/os_unix.c 4c73f89479d90412cb736a180e9ef89ac1495a158753a7f5de1260c197bc8e1f -F src/os_win.c 49c7725b500f5867e8360e75eeb30f9d70b62fa1f05c8a101da627210578df32 +F src/os_win.c 2423a45e70c2cda01bfc84106f7e9f34feb1add42121ab2e35a67ba24589ac52 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 3a1c4e7f69af482e33c8cba8a75afe0dda0ea6391240adac22b040ce1bdeef44 +F src/pager.c 8d73e7a0ebbecd8bb4996ff285cc055cec56b7e3edb5a4609d0748e0fa39d28a F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 -F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319 +F src/pcache1.c 78d4935e510f7bed0fdd1a3f742c0e663b36a795f9dc7411161dc22bdae1245e F src/pragma.c c7ada272232e1182c4536d9637fa7b955a10bc1bd8d5a87d4dc9309dab827791 F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126 -F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105 +F src/printf.c b9ac740dfaf68552f5da1266be28ae2824b53a6b73d93425f7c6b2ef62457cbb F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 @@ -783,7 +783,7 @@ F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf323 F src/sqlite.h.in 8d4486fb28a90de818ac1e8c6206ea458e7de6bd8e0dfa3d554494f155be8c01 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b +F src/sqliteInt.h 020aff180111b7dfe5bbdf8e59e8595c195b956488e9ca955f876cb7482e6de5 F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -847,19 +847,19 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989 F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40 -F src/vdbe.c 063763e08f1ad00890b7377fc663dbccec85a47630f5d2bbb13f3fdf77e06f78 +F src/vdbe.c e7567bed441a53c4ceb48d2bdf3d1747677fc296a91e8d2a0fe8facdb9b890ce F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89 F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091 -F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86 -F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b +F src/vdbeapi.c cb8eb9e41a16f5fa3ce5b8f3910edfbba336d10156cfb7a79f92cf7bf443977b +F src/vdbeaux.c d7ef1a0a7233589d789eda1ba9ffa4b0ea61fca9651e4f47fb4250d03d62bcaf F src/vdbeblob.c 9166b6eb7054e5da82e35255892fb1ed551355a4716452539e8e3ac14f25fbe3 -F src/vdbemem.c 4af21a948820259ced96e3d46d70f9af347afa2deb7cb60a8b3981d5748e4279 -F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f +F src/vdbemem.c 571ae3116dbf840a62c4aaa6bc09d577dfef8ad4d3978cf37275bb5f9653217b +F src/vdbesort.c 3e8e6340ec5f68909a975031081102471300eaec9791d081b5443822e1061cda F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 4e6181d8780ab0af2e1388d0754cbe6f2f04593d2b1ab6c41699a89942fd8997 +F src/wal.c cefdffc112c767c79596d9c0d15cb4de27071132e9b8a0fce323b140cd4af683 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P edb8a78c0238f085eefbf86aa7777528f36f3400d4ef096ffd6855cf3321a97b -R 35984cc59a3a13710af92ec281a18a95 -U stephan -Z b005a16738a1a2fa13fe8f4e242441b2 +P b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 +R a324a0ad4ec5bff22beea8348186f31d +U drh +Z e55663a48a3fa77210e8f8e7032e8f31 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3431f51c49..cab7456372 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 +215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 diff --git a/src/analyze.c b/src/analyze.c index 799d43924c..58cea90caa 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -407,7 +407,7 @@ static void statInit( int nCol; /* Number of columns in index being sampled */ int nKeyCol; /* Number of key columns */ int nColUp; /* nCol rounded up for alignment */ - int n; /* Bytes of space to allocate */ + i64 n; /* Bytes of space to allocate */ sqlite3 *db = sqlite3_context_db_handle(context); /* Database connection */ #ifdef SQLITE_ENABLE_STAT4 /* Maximum number of samples. 0 if STAT4 data is not collected */ diff --git a/src/attach.c b/src/attach.c index 399a6cb537..f6c224710d 100644 --- a/src/attach.c +++ b/src/attach.c @@ -156,7 +156,7 @@ static void attachFunc( if( aNew==0 ) return; memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); }else{ - aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); + aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(1+(i64)db->nDb)); if( aNew==0 ) return; } db->aDb = aNew; diff --git a/src/bitvec.c b/src/bitvec.c index 13f87d5676..32bfade115 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -344,7 +344,7 @@ int sqlite3BitvecBuiltinTest(int sz, int *aOp){ /* Allocate the Bitvec to be tested and a linear array of ** bits to act as the reference */ pBitvec = sqlite3BitvecCreate( sz ); - pV = sqlite3MallocZero( (sz+7)/8 + 1 ); + pV = sqlite3MallocZero( (7+(i64)sz)/8 + 1 ); pTmpSpace = sqlite3_malloc64(BITVEC_SZ); if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end; diff --git a/src/btree.c b/src/btree.c index 49eb1d8037..97fbdf8d21 100644 --- a/src/btree.c +++ b/src/btree.c @@ -729,7 +729,7 @@ static int saveCursorKey(BtCursor *pCur){ ** below. */ void *pKey; pCur->nKey = sqlite3BtreePayloadSize(pCur); - pKey = sqlite3Malloc( pCur->nKey + 9 + 8 ); + pKey = sqlite3Malloc( ((i64)pCur->nKey) + 9 + 8 ); if( pKey ){ rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey); if( rc==SQLITE_OK ){ @@ -6100,7 +6100,7 @@ bypass_moveto_root: rc = SQLITE_CORRUPT_PAGE(pPage); goto moveto_index_finish; } - pCellKey = sqlite3Malloc( nCell+nOverrun ); + pCellKey = sqlite3Malloc( (u64)nCell+(u64)nOverrun ); if( pCellKey==0 ){ rc = SQLITE_NOMEM_BKPT; goto moveto_index_finish; @@ -11289,6 +11289,7 @@ int sqlite3BtreeIsInBackup(Btree *p){ */ void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ BtShared *pBt = p->pBt; + assert( nBytes==0 || nBytes==sizeof(Schema) ); sqlite3BtreeEnter(p); if( !pBt->pSchema && nBytes ){ pBt->pSchema = sqlite3DbMallocZero(0, nBytes); diff --git a/src/build.c b/src/build.c index 8f64d5ec30..986201bfb4 100644 --- a/src/build.c +++ b/src/build.c @@ -68,6 +68,7 @@ static SQLITE_NOINLINE void lockTable( } } + assert( pToplevel->nTableLock < 0x7fff0000 ); nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1); pToplevel->aTableLock = sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); @@ -2089,7 +2090,8 @@ static void identPut(char *z, int *pIdx, char *zSignedIdent){ ** from sqliteMalloc() and must be freed by the calling function. */ static char *createTableStmt(sqlite3 *db, Table *p){ - int i, k, n; + int i, k, len; + i64 n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; @@ -2113,8 +2115,9 @@ static char *createTableStmt(sqlite3 *db, Table *p){ sqlite3OomFault(db); return 0; } - sqlite3_snprintf(n, zStmt, "CREATE TABLE "); - k = sqlite3Strlen30(zStmt); + assert( n>14 && n<=0x7fffffff ); + memcpy(zStmt, "CREATE TABLE ", 13); + k = 13; identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; inCol; i++, pCol++){ @@ -2126,13 +2129,15 @@ static char *createTableStmt(sqlite3 *db, Table *p){ /* SQLITE_AFF_REAL */ " REAL", /* SQLITE_AFF_FLEXNUM */ " NUM", }; - int len; const char *zType; - sqlite3_snprintf(n-k, &zStmt[k], zSep); - k += sqlite3Strlen30(&zStmt[k]); + len = sqlite3Strlen30(zSep); + assert( k+lenzCnName); + assert( kaffinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); @@ -2147,11 +2152,14 @@ static char *createTableStmt(sqlite3 *db, Table *p){ assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==SQLITE_AFF_FLEXNUM || pCol->affinity==sqlite3AffinityType(zType, 0) ); + assert( k+lenop==TK_IN ); - zRet = sqlite3DbMallocRaw(pParse->db, nVal+1); + zRet = sqlite3DbMallocRaw(pParse->db, 1+(i64)nVal); if( zRet ){ int i; for(i=0; izPath); - pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); + pNew = sqlite3MallocZero( sizeof(*pShmNode) + (i64)nName + 17 ); if( pNew==0 ){ sqlite3_free(p); return SQLITE_IOERR_NOMEM_BKPT; @@ -4759,7 +4759,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ size_t i, j; DWORD pid; int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX); - int nMax, nBuf, nDir, nLen; + i64 nMax, nBuf, nDir, nLen; char *zBuf; /* It's odd to simulate an io-error here, but really this is just @@ -4771,7 +4771,8 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){ /* Allocate a temporary buffer to store the fully qualified file ** name for the temporary file. If this fails, we cannot continue. */ - nMax = pVfs->mxPathname; nBuf = nMax + 2; + nMax = pVfs->mxPathname; + nBuf = 2 + (i64)nMax; zBuf = sqlite3MallocZero( nBuf ); if( !zBuf ){ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); @@ -5630,7 +5631,7 @@ static int winFullPathnameNoMutex( ** for converting the relative path name to an absolute ** one by prepending the data directory and a slash. */ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); + char *zOut = sqlite3MallocZero( 1+(u64)pVfs->mxPathname ); if( !zOut ){ return SQLITE_IOERR_NOMEM_BKPT; } @@ -5725,13 +5726,12 @@ static int winFullPathnameNoMutex( return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname1", zRelative); } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); if( zTemp==0 ){ sqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } - nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); + nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte+3, zTemp, 0); if( nByte==0 ){ sqlite3_free(zConverted); sqlite3_free(zTemp); @@ -5751,13 +5751,12 @@ static int winFullPathnameNoMutex( return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), "winFullPathname3", zRelative); } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) + 3*sizeof(zTemp[0]) ); if( zTemp==0 ){ sqlite3_free(zConverted); return SQLITE_IOERR_NOMEM_BKPT; } - nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); + nByte = osGetFullPathNameA((char*)zConverted, nByte+3, zTemp, 0); if( nByte==0 ){ sqlite3_free(zConverted); sqlite3_free(zTemp); diff --git a/src/pager.c b/src/pager.c index ecec892b45..5d279001e7 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1291,7 +1291,7 @@ static void checkPage(PgHdr *pPg){ ** If an error occurs while reading from the journal file, an SQLite ** error code is returned. */ -static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){ +static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u64 nSuper){ int rc; /* Return code */ u32 len; /* Length in bytes of super-journal name */ i64 szJ; /* Total size in bytes of journal file pJrnl */ @@ -2527,12 +2527,12 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){ char *zJournal; /* Pointer to one journal within MJ file */ char *zSuperPtr; /* Space to hold super-journal filename */ char *zFree = 0; /* Free this buffer */ - int nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ + i64 nSuperPtr; /* Amount of space allocated to zSuperPtr[] */ /* Allocate space for both the pJournal and pSuper file descriptors. ** If successful, open the super-journal file for reading. */ - pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); + pSuper = (sqlite3_file *)sqlite3MallocZero(2 * (i64)pVfs->szOsFile); if( !pSuper ){ rc = SQLITE_NOMEM_BKPT; pJournal = 0; @@ -2550,11 +2550,14 @@ static int pager_delsuper(Pager *pPager, const char *zSuper){ */ rc = sqlite3OsFileSize(pSuper, &nSuperJournal); if( rc!=SQLITE_OK ) goto delsuper_out; - nSuperPtr = pVfs->mxPathname+1; + nSuperPtr = 1 + (i64)pVfs->mxPathname; + assert( nSuperJournal>=0 && nSuperPtr>0 ); zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2); if( !zFree ){ rc = SQLITE_NOMEM_BKPT; goto delsuper_out; + }else{ + assert( nSuperJournal<=0x7fffffff ); } zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0; zSuperJournal = &zFree[4]; @@ -2815,7 +2818,7 @@ static int pager_playback(Pager *pPager, int isHot){ ** for pageSize. */ zSuper = pPager->pTmpSpace; - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); if( rc==SQLITE_OK && zSuper[0] ){ rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res); } @@ -2954,7 +2957,7 @@ end_playback: ** which case it requires 4 0x00 bytes in memory immediately before ** the filename. */ zSuper = &pPager->pTmpSpace[4]; - rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1); + rc = readSuperJournal(pPager->jfd, zSuper, 1+(i64)pPager->pVfs->mxPathname); testcase( rc!=SQLITE_OK ); } if( rc==SQLITE_OK @@ -4724,6 +4727,7 @@ int sqlite3PagerOpen( u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ const char *zUri = 0; /* URI args to copy */ int nUriByte = 1; /* Number of bytes of URI args at *zUri */ + /* Figure out how much space is required for each journal file-handle ** (there are two of them, the main journal and the sub-journal). */ @@ -4750,8 +4754,8 @@ int sqlite3PagerOpen( */ if( zFilename && zFilename[0] ){ const char *z; - nPathname = pVfs->mxPathname+1; - zPathname = sqlite3DbMallocRaw(0, nPathname*2); + nPathname = pVfs->mxPathname + 1; + zPathname = sqlite3DbMallocRaw(0, 2*(i64)nPathname); if( zPathname==0 ){ return SQLITE_NOMEM_BKPT; } @@ -4838,14 +4842,14 @@ int sqlite3PagerOpen( ROUND8(sizeof(*pPager)) + /* Pager structure */ ROUND8(pcacheSize) + /* PCache object */ ROUND8(pVfs->szOsFile) + /* The main db file */ - journalFileSize * 2 + /* The two journal files */ + (u64)journalFileSize * 2 + /* The two journal files */ SQLITE_PTRSIZE + /* Space to hold a pointer */ 4 + /* Database prefix */ - nPathname + 1 + /* database filename */ - nUriByte + /* query parameters */ - nPathname + 8 + 1 + /* Journal filename */ + (u64)nPathname + 1 + /* database filename */ + (u64)nUriByte + /* query parameters */ + (u64)nPathname + 8 + 1 + /* Journal filename */ #ifndef SQLITE_OMIT_WAL - nPathname + 4 + 1 + /* WAL filename */ + (u64)nPathname + 4 + 1 + /* WAL filename */ #endif 3 /* Terminator */ ); diff --git a/src/pcache1.c b/src/pcache1.c index a0a8c7e28c..88a7b3a0b4 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -538,12 +538,12 @@ static int pcache1UnderMemoryPressure(PCache1 *pCache){ */ static void pcache1ResizeHash(PCache1 *p){ PgHdr1 **apNew; - unsigned int nNew; - unsigned int i; + u64 nNew; + u32 i; assert( sqlite3_mutex_held(p->pGroup->mutex) ); - nNew = p->nHash*2; + nNew = 2*(u64)p->nHash; if( nNew<256 ){ nNew = 256; } @@ -766,7 +766,7 @@ static void pcache1Destroy(sqlite3_pcache *p); static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ PCache1 *pCache; /* The newly created page cache */ PGroup *pGroup; /* The group the new page cache will belong to */ - int sz; /* Bytes of memory required to allocate the new cache */ + i64 sz; /* Bytes of memory required to allocate the new cache */ assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 ); assert( szExtra < 300 ); diff --git a/src/printf.c b/src/printf.c index 71363f91b4..97f93dc157 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1057,7 +1057,7 @@ void sqlite3_str_appendall(sqlite3_str *p, const char *z){ static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ char *zText; assert( p->mxAlloc>0 && !isMalloced(p) ); - zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); + zText = sqlite3DbMallocRaw(p->db, 1+(u64)p->nChar ); if( zText ){ memcpy(zText, p->zText, p->nChar+1); p->printfFlags |= SQLITE_PRINTF_MALLOCED; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c8ecaf8571..6ebd8eb4fe 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1016,6 +1016,14 @@ typedef INT16_TYPE LogEst; #define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32)) #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) +/* +** Macro SMXV(n) return the maximum value that can be held in variable n, +** assuming n is a signed integer type. UMXV(n) is similar for unsigned +** integer types. +*/ +#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1) +#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1) + /* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. diff --git a/src/vdbe.c b/src/vdbe.c index 6d7769173f..b78a0aabf2 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -276,7 +276,7 @@ static VdbeCursor *allocateCursor( */ Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem; - int nByte; + i64 nByte; VdbeCursor *pCx = 0; nByte = ROUND8P(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + @@ -304,7 +304,7 @@ static VdbeCursor *allocateCursor( pMem->szMalloc = 0; return 0; } - pMem->szMalloc = nByte; + pMem->szMalloc = (int)nByte; } p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; @@ -7325,7 +7325,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */ */ case OP_Program: { /* jump0 */ int nMem; /* Number of memory registers for sub-program */ - int nByte; /* Bytes of runtime space required for sub-program */ + i64 nByte; /* Bytes of runtime space required for sub-program */ Mem *pRt; /* Register to allocate runtime space */ Mem *pMem; /* Used to iterate through memory cells */ Mem *pEnd; /* Last memory cell in new array */ @@ -7376,7 +7376,7 @@ case OP_Program: { /* jump0 */ nByte = ROUND8(sizeof(VdbeFrame)) + nMem * sizeof(Mem) + pProgram->nCsr * sizeof(VdbeCursor*) - + (pProgram->nOp + 7)/8; + + (7 + (i64)pProgram->nOp)/8; pFrame = sqlite3DbMallocZero(db, nByte); if( !pFrame ){ goto no_mem; @@ -7384,7 +7384,7 @@ case OP_Program: { /* jump0 */ sqlite3VdbeMemRelease(pRt); pRt->flags = MEM_Blob|MEM_Dyn; pRt->z = (char*)pFrame; - pRt->n = nByte; + pRt->n = (int)nByte; pRt->xDel = sqlite3VdbeFrameMemDel; pFrame->v = p; diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 0dc09d501e..31880d85b5 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -2233,7 +2233,9 @@ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ Column *pCol = &p->pTab->aCol[iIdx]; if( pCol->iDflt>0 ){ if( p->apDflt==0 ){ - int nByte = sizeof(sqlite3_value*)*p->pTab->nCol; + int nByte; + assert( sizeof(sqlite3_value*)*UMXV(p->pTab->nCol) < 0x7fffffff ); + nByte = sizeof(sqlite3_value*)*p->pTab->nCol; p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte); if( p->apDflt==0 ) goto preupdate_old_out; } @@ -2383,7 +2385,8 @@ int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ */ assert( p->op==SQLITE_UPDATE ); if( !p->aNew ){ - p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField); + assert( sizeof(Mem)*UMXV(p->pCsr->nField) < 0x7fffffff ); + p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem)*p->pCsr->nField); if( !p->aNew ){ rc = SQLITE_NOMEM; goto preupdate_new_out; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index cf661eb9cb..6a8db6f394 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -726,7 +726,7 @@ static Op *opIterNext(VdbeOpIter *p){ } if( pRet->p4type==P4_SUBPROGRAM ){ - int nByte = (p->nSub+1)*sizeof(SubProgram*); + i64 nByte = (1+(u64)p->nSub)*sizeof(SubProgram*); int j; for(j=0; jnSub; j++){ if( p->apSub[j]==pRet->p4.pProgram ) break; @@ -1198,7 +1198,7 @@ void sqlite3VdbeScanStatus( const char *zName /* Name of table or index being scanned */ ){ if( IS_STMT_SCANSTATUS(p->db) ){ - sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); + i64 nByte = (1+(i64)p->nScan) * sizeof(ScanStatus); ScanStatus *aNew; aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); if( aNew ){ @@ -4219,6 +4219,7 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( ){ UnpackedRecord *p; /* Unpacked record to return */ int nByte; /* Number of bytes required for *p */ + assert( sizeof(UnpackedRecord) + sizeof(Mem)*65536 < 0x7fffffff ); nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1); p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte); if( !p ) return 0; diff --git a/src/vdbemem.c b/src/vdbemem.c index 61298d10ff..8534849432 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1440,7 +1440,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ if( pRec==0 ){ Index *pIdx = p->pIdx; /* Index being probed */ - int nByte; /* Bytes of space to allocate */ + i64 nByte; /* Bytes of space to allocate */ int i; /* Counter variable */ int nCol = pIdx->nColumn; /* Number of index columns including rowid */ @@ -1506,7 +1506,7 @@ static int valueFromFunction( ){ sqlite3_context ctx; /* Context object for function invocation */ sqlite3_value **apVal = 0; /* Function arguments */ - int nVal = 0; /* Size of apVal[] array */ + int nVal = 0; /* Number of function arguments */ FuncDef *pFunc = 0; /* Function definition */ sqlite3_value *pVal = 0; /* New value */ int rc = SQLITE_OK; /* Return code */ diff --git a/src/vdbesort.c b/src/vdbesort.c index 239c0a0f36..5774537b81 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -936,7 +936,7 @@ int sqlite3VdbeSorterInit( VdbeSorter *pSorter; /* The new sorter */ KeyInfo *pKeyInfo; /* Copy of pCsr->pKeyInfo with db==0 */ int szKeyInfo; /* Size of pCsr->pKeyInfo in bytes */ - int sz; /* Size of pSorter in bytes */ + i64 sz; /* Size of pSorter in bytes */ int rc = SQLITE_OK; #if SQLITE_MAX_WORKER_THREADS==0 # define nWorker 0 @@ -964,6 +964,8 @@ int sqlite3VdbeSorterInit( assert( pCsr->pKeyInfo ); assert( !pCsr->isEphemeral ); assert( pCsr->eCurType==CURTYPE_SORTER ); + assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*) + < 0x7fffffff ); szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); @@ -1177,7 +1179,7 @@ static int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){ */ static MergeEngine *vdbeMergeEngineNew(int nReader){ int N = 2; /* Smallest power of two >= nReader */ - int nByte; /* Total bytes of space to allocate */ + i64 nByte; /* Total bytes of space to allocate */ MergeEngine *pNew; /* Pointer to allocated object to return */ assert( nReader<=SORTER_MAX_MERGE_COUNT ); diff --git a/src/wal.c b/src/wal.c index 42ce3cb97b..0b4510e179 100644 --- a/src/wal.c +++ b/src/wal.c @@ -753,7 +753,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc( /* Enlarge the pWal->apWiData[] array if required */ if( pWal->nWiData<=iPage ){ - sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); + sqlite3_int64 nByte = sizeof(u32*)*(1+(i64)iPage); volatile u32 **apNew; apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); if( !apNew ){ From 7bfa4452a3cc9b57d970938cbc642cb48024a2a7 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 18:09:24 +0000 Subject: [PATCH 69/72] Additional changes making it easier to prove that integer overflow does not occur. No problems found. FossilOrigin-Name: e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc --- ext/fts3/fts3.c | 2 +- ext/fts3/fts3_expr.c | 2 +- ext/fts5/fts5_index.c | 9 +++++---- ext/fts5/fts5_vocab.c | 6 +++--- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/json.c | 7 ++++--- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 2b2c3b8d26..d5db2a3dd1 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -4438,7 +4438,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ nDistance = iPrev - nMaxUndeferred; } - aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING); + aOut = (char *)sqlite3Fts3MallocZero(((i64)nPoslist)+FTS3_BUFFER_PADDING); if( !aOut ){ sqlite3_free(aPoslist); return SQLITE_NOMEM; diff --git a/ext/fts3/fts3_expr.c b/ext/fts3/fts3_expr.c index 9e201b1684..ce4282dea5 100644 --- a/ext/fts3/fts3_expr.c +++ b/ext/fts3/fts3_expr.c @@ -283,7 +283,7 @@ static int getNextString( Fts3Expr *p = 0; sqlite3_tokenizer_cursor *pCursor = 0; char *zTemp = 0; - int nTemp = 0; + i64 nTemp = 0; const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase); int nToken = 0; diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index f56aa82e8c..3ac5008502 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -5206,7 +5206,7 @@ static void fts5DoSecureDelete( int iDelKeyOff = 0; /* Offset of deleted key, if any */ nIdx = nPg-iPgIdx; - aIdx = sqlite3Fts5MallocZero(&p->rc, nIdx+16); + aIdx = sqlite3Fts5MallocZero(&p->rc, ((i64)nIdx)+16); if( p->rc ) return; memcpy(aIdx, &aPg[iPgIdx], nIdx); @@ -5800,7 +5800,7 @@ static Fts5Structure *fts5IndexOptimizeStruct( assert( pStruct->aLevel[i].nMerge<=nThis ); } - nByte += (pStruct->nLevel+1) * sizeof(Fts5StructureLevel); + nByte += (((i64)pStruct->nLevel)+1) * sizeof(Fts5StructureLevel); pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte); if( pNew ){ @@ -6688,7 +6688,8 @@ static void fts5SetupPrefixIter( } } - pData = fts5IdxMalloc(p, sizeof(*pData)+s.doclist.n+FTS5_DATA_ZERO_PADDING); + pData = fts5IdxMalloc(p, sizeof(*pData) + + ((i64)s.doclist.n)+FTS5_DATA_ZERO_PADDING); assert( pData!=0 || p->rc!=SQLITE_OK ); if( pData ){ pData->p = (u8*)&pData[1]; @@ -8912,7 +8913,7 @@ static void fts5DecodeFunction( ** buffer overreads even if the record is corrupt. */ n = sqlite3_value_bytes(apVal[1]); aBlob = sqlite3_value_blob(apVal[1]); - nSpace = n + FTS5_DATA_ZERO_PADDING; + nSpace = ((i64)n) + FTS5_DATA_ZERO_PADDING; a = (u8*)sqlite3Fts5MallocZero(&rc, nSpace); if( a==0 ) goto decode_out; if( n>0 ) memcpy(a, aBlob, n); diff --git a/ext/fts5/fts5_vocab.c b/ext/fts5/fts5_vocab.c index fb280567f4..b157ab0d97 100644 --- a/ext/fts5/fts5_vocab.c +++ b/ext/fts5/fts5_vocab.c @@ -193,12 +193,12 @@ static int fts5VocabInitVtab( *pzErr = sqlite3_mprintf("wrong number of vtable arguments"); rc = SQLITE_ERROR; }else{ - int nByte; /* Bytes of space to allocate */ + i64 nByte; /* Bytes of space to allocate */ const char *zDb = bDb ? argv[3] : argv[1]; const char *zTab = bDb ? argv[4] : argv[3]; const char *zType = bDb ? argv[5] : argv[4]; - int nDb = (int)strlen(zDb)+1; - int nTab = (int)strlen(zTab)+1; + i64 nDb = strlen(zDb)+1; + i64 nTab = strlen(zTab)+1; int eType = 0; rc = fts5VocabTableType(zType, pzErr, &eType); diff --git a/manifest b/manifest index 1e1fb70b59..3d8c78ede6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Code\schanges\sthat\smake\sit\seasier\sto\sprove\sthat\sno\s32-bit\sinteger\soverflows\nhappen\sduring\smemory\sallocation.\s\sNo\sproblems\sfixed;\sthis\schange\sis\sjust\nto\smake\sfuture\smaintenance\seasier. -D 2025-02-17T17:33:14.937 +C Additional\schanges\smaking\sit\seasier\sto\sprove\sthat\sinteger\soverflow\sdoes\snot\noccur.\s\sNo\sproblems\sfound. +D 2025-02-17T18:09:24.766 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -78,11 +78,11 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c b840ee915a6fb36571e3fe3c096e8a481a4a9cd8a35199a1b976b132b9f84ad3 +F ext/fts3/fts3.c 1da0265e8798f335165d54959459eeb69b6d32f586f85cf8795ab5d3b1292dcb F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h 2fe7c76dfd7d46dff964d17d3f4c53bca2116cf5d6252552ebbc22e38afdf4e0 F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 -F ext/fts3/fts3_expr.c 365849a2a1185e19028a9db2d9f1ea63efe909a3a6aca7ec86fc26a13a60bd58 +F ext/fts3/fts3_expr.c ebf7f2adead8cc54bc91deb41cb4a156874003078116f76631d65b87ff47464d F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 @@ -112,7 +112,7 @@ F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70 F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8 F ext/fts5/fts5_expr.c 69b8d976058512c07dfe86e229521b7a871768157bd1607cedf1a5038dfd72c9 F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1 -F ext/fts5/fts5_index.c f1eec0931548b529ddd7ebd274eaef37de7461fe2b0ebdc9818f37324bdf9494 +F ext/fts5/fts5_index.c b7827b32e0e1e1ff7d7cb27c5d0480426a01c8ec4e89fd7e106bb463e2b63dd1 F ext/fts5/fts5_main.c 9a1daef7247f9b8a50b4159323e340efa6b0e4bea4fcd83580480f94d4f2c888 F ext/fts5/fts5_storage.c 1ad05dab4830a4e2eaf2900bb143477f93bc17437093582f36f4b818809e88d8 F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329 @@ -121,7 +121,7 @@ F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b F ext/fts5/fts5_unicode2.c 6f9b0fb79a8facaed76628ffd4eb9c16d7f2b84b52872784f617cf3422a9b043 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 -F ext/fts5/fts5_vocab.c e4830b00809e5da53bc10f93adc59e321407b0f801c7f4167c0e47f5552267e0 +F ext/fts5/fts5_vocab.c ff0441c4ea165081e8152dec6d29056faa0cdc281a9f218a00e3d7aacc1958bc F ext/fts5/fts5parse.y eb526940f892ade5693f22ffd6c4f2702543a9059942772526eac1fde256bb05 F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba F ext/fts5/test/fts5_common.tcl c5aa7cf7148b6dcffb5b61520ae18212baf169936af734ab265143f59db328fe @@ -739,7 +739,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06 -F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7 +F src/json.c 5abb5cb782e74451a8882f6b7ee4d5e629246642262660bd1980a5e1b796258d F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c 2650f54f7c2aa2c53cc61b571bad9c7c32d60400e3f6a270bd444f5d76e03eb8 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b59d0ebb22e4ca2f3a7a73dd49a0c142dbca538cb1b4eafd35a78bac87c6c456 -R a324a0ad4ec5bff22beea8348186f31d +P 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 +R 051727f689eef9866e97198933e64087 U drh -Z e55663a48a3fa77210e8f8e7032e8f31 +Z 6482d56e78ea7ae46b1be7711d2aadc0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cab7456372..4265221c97 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 +e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc diff --git a/src/json.c b/src/json.c index 47a9c875e7..97bf25b2dd 100644 --- a/src/json.c +++ b/src/json.c @@ -1086,7 +1086,7 @@ static void jsonWrongNumArgs( */ static int jsonBlobExpand(JsonParse *pParse, u32 N){ u8 *aNew; - u32 t; + u64 t; assert( N>pParse->nBlobAlloc ); if( pParse->nBlobAlloc==0 ){ t = 100; @@ -1096,8 +1096,9 @@ static int jsonBlobExpand(JsonParse *pParse, u32 N){ if( tdb, pParse->aBlob, t); if( aNew==0 ){ pParse->oom = 1; return 1; } + assert( t<0x7fffffff ); pParse->aBlob = aNew; - pParse->nBlobAlloc = t; + pParse->nBlobAlloc = (u32)t; return 0; } @@ -3116,7 +3117,7 @@ static void jsonReturnFromBlob( char *zOut; u32 nOut = sz; z = (const char*)&pParse->aBlob[i+n]; - zOut = sqlite3DbMallocRaw(db, nOut+1); + zOut = sqlite3DbMallocRaw(db, ((u64)nOut)+1); if( zOut==0 ) goto returnfromblob_oom; for(iIn=iOut=0; iIn Date: Mon, 17 Feb 2025 19:44:45 +0000 Subject: [PATCH 70/72] Fix problems in test script fkey6.test. FossilOrigin-Name: 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a --- manifest | 14 ++++++------- manifest.uuid | 2 +- test/fkey6.test | 53 +++++++++++++++++++++++++++---------------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index 3d8c78ede6..e98c2b76af 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Additional\schanges\smaking\sit\seasier\sto\sprove\sthat\sinteger\soverflow\sdoes\snot\noccur.\s\sNo\sproblems\sfound. -D 2025-02-17T18:09:24.766 +C Fix\sproblems\sin\stest\sscript\sfkey6.test. +D 2025-02-17T19:44:45.980 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1153,7 +1153,7 @@ F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb30 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421 -F test/fkey6.test 1e0874ba15f8ed1e14a1d0a40fc8fb90a9912f4c82ea220a43137d4d9eff4d69 +F test/fkey6.test 668a7299e75899b0a3342c36df655be57f76a05aca3544bda939a6e676e2f000 F test/fkey7.test 64fb28da03da5dfe3cdef5967aa7e832c2507bf7fb8f0780cacbca1f2338d031 F test/fkey8.test 51deda7f1a1448bca95875e4a6e1a3a75b4bd7215e924e845bd60de60e4d84bf F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5 -R 051727f689eef9866e97198933e64087 -U drh -Z 6482d56e78ea7ae46b1be7711d2aadc0 +P e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc +R bf9a2dfadfc67dccdfbf52fd5d450169 +U dan +Z 6cfd174e1e1a340132d02a73b4dc4571 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4265221c97..d45c550bf9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc +088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a diff --git a/test/fkey6.test b/test/fkey6.test index 7cdc8ab0ae..415daeaf3e 100644 --- a/test/fkey6.test +++ b/test/fkey6.test @@ -271,31 +271,36 @@ do_execsql_test 5.1 { # reset_db -do_execsql_test 6.1 { - PRAGMA writable_schema = 1; - INSERT INTO sqlite_schema - VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); +ifcapable fts5 { +if {[permutation]!="inmemory_journal"} { + do_execsql_test 6.1 { + PRAGMA auto_vacuum = 0; + PRAGMA writable_schema = 1; + INSERT INTO sqlite_schema + VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)'); + } + db close + sqlite3 db test.db + do_execsql_test 6.1 { + PRAGMA foreign_keys = 1; + PRAGMA writable_schema = 1; + } + do_execsql_test 6.2 { + CREATE TABLE t2( + y INTEGER PRIMARY KEY, + z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED + ); + } + do_execsql_test 6.3 { + BEGIN; + INSERT INTO t2 VALUES(1,0),(2,1); + CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); + INSERT INTO t3 VALUES(3,3); + PRAGMA defer_foreign_keys=ON; + DELETE FROM t2; + COMMIT; + } } -db close -sqlite3 db test.db -do_execsql_test 6.1 { - PRAGMA foreign_keys = 1; - PRAGMA writable_schema = 1; -} -do_execsql_test 6.2 { - CREATE TABLE t2( - y INTEGER PRIMARY KEY, - z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED - ); -} -do_execsql_test 6.3 { - BEGIN; - INSERT INTO t2 VALUES(1,0),(2,1); - CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1); - INSERT INTO t3 VALUES(3,3); - PRAGMA defer_foreign_keys=ON; - DELETE FROM t2; - COMMIT; } finish_test From 21212923f276c11aaa048819779853a19c3d6636 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Feb 2025 20:13:20 +0000 Subject: [PATCH 71/72] Add an ORDER BY to a test case for skip-scan to make the output consistent. FossilOrigin-Name: 9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/skipscan6.test | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index e98c2b76af..6b0a647388 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sproblems\sin\stest\sscript\sfkey6.test. -D 2025-02-17T19:44:45.980 +C Add\san\sORDER\sBY\sto\sa\stest\scase\sfor\sskip-scan\sto\smake\sthe\soutput\sconsistent. +D 2025-02-17T20:13:20.679 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -1653,7 +1653,7 @@ F test/skipscan1.test 9cbbb6575517b15292bd87ee85b853bbd3cd4b4735d69b0f083020cec1 F test/skipscan2.test b032ed3e0ba5caa4df6c43ef22c31566aac67783bc031869155989a7ccdb5bd5 F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5 F test/skipscan5.test 0672103fd2c8f96bd114133f356192b35ece45c794fe3677e1d9e5e3104a608e -F test/skipscan6.test bddbb35dd335e2d21b7791a61e3b2e1f3255dc307ce80aa6fe19cc298e6feb13 +F test/skipscan6.test e2b256cf5d538a605beb97dc97ca5e2836dfc24c5e1d9b7a09e13c069a3b8b49 F test/snapshot.test a504f2e7009f512ef66c719f0ea1c55a556bdaf1e1312c80a04d46fc1a3e9632 F test/snapshot2.test 8d6ff5dd9cc503f6e12d408a30409c3f9c653507b24408d9cd7195931c89bc54 F test/snapshot3.test 41350216abc6c7da37113ad462259c070786e5ad70bdc8709daaed148b1b3a2c @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc -R bf9a2dfadfc67dccdfbf52fd5d450169 -U dan -Z 6cfd174e1e1a340132d02a73b4dc4571 +P 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a +R ac29bfbe7732fa69155d4757aa0d3755 +U drh +Z ae23d3651ecb8ceaf7a4973c35e0c2db # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d45c550bf9..f3d1660e17 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a +9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 diff --git a/test/skipscan6.test b/test/skipscan6.test index 4f592bc0e0..a97f440eef 100644 --- a/test/skipscan6.test +++ b/test/skipscan6.test @@ -167,10 +167,10 @@ do_execsql_test 3.0 { INSERT INTO t2 SELECT * FROM t3; ANALYZE; - SELECT * FROM sqlite_stat1; + SELECT * FROM sqlite_stat1 ORDER BY +idx; } { - t2 t2_ba {100 20 1 1} t2 t2_a {100 1} + t2 t2_ba {100 20 1 1} t3 t3_a {100 1} t3 t3_ba {100 20 1 1} } From 9ef8399055aaf10f623be8b900ac0c895c783b9c Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 18 Feb 2025 01:16:26 +0000 Subject: [PATCH 72/72] Update path on the web server for test/snapshot instances of fiddle. FossilOrigin-Name: 57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc --- ext/wasm/fiddle.make | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/wasm/fiddle.make b/ext/wasm/fiddle.make index 2a43959e2b..8110384a6e 100644 --- a/ext/wasm/fiddle.make +++ b/ext/wasm/fiddle.make @@ -91,7 +91,7 @@ all: fiddle fiddle_remote ?= ifeq (,$(fiddle_remote)) ifneq (,$(wildcard /home/stephan)) - fiddle_remote = wh:www/wh/sqlite3/. + fiddle_remote = wh:www/wasm-testing/fiddle/. else ifneq (,$(wildcard /home/drh)) #fiddle_remote = if appropriate, add that user@host:/path here endif diff --git a/manifest b/manifest index 6b0a647388..a37fef62de 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sORDER\sBY\sto\sa\stest\scase\sfor\sskip-scan\sto\smake\sthe\soutput\sconsistent. -D 2025-02-17T20:13:20.679 +C Update\spath\son\sthe\sweb\sserver\sfor\stest/snapshot\sinstances\sof\sfiddle. +D 2025-02-18T01:16:26.885 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -672,7 +672,7 @@ F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2 F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535da776950314 F ext/wasm/dist.make 92ef4ffe33022a50f92d602acabad10bd8dd91759f3eb7df27fc6d7d37072b96 F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f -F ext/wasm/fiddle.make d4969f0322a582c57a22ce3541f10a5b09a609d14eab32891f613f43b3c14d8b +F ext/wasm/fiddle.make c6d7a3d6cc03bb5f21acb295c1233820d0dbf5c6a89b28dc2e093edcc001c45a F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea162765d660277cd84ce F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1 F ext/wasm/fiddle/index.html c79b1741cbeba78f88af0a84cf5ec7de87a909a6a8d10a369b1f4824c66c2088 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 088e476519c2c759ba9387cb18eaad7c042cc37e45e96237d3125ba33ee3633a -R ac29bfbe7732fa69155d4757aa0d3755 -U drh -Z ae23d3651ecb8ceaf7a4973c35e0c2db +P 9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 +R c1357609bb5713a7e3d612d7117e08d1 +U stephan +Z d5c65d18a9c1aa9330f1639d76c6628b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f3d1660e17..4a2d06e29c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9c9c19414ac243ce48a34bf13a08bff54a465e54a0c09ded50508b8d4bdba227 +57caa3136d1bfca06e4f2285734a4977b8d3fa1f75bf87453b975867e9de38fc