]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
23 months agoMerge the latest trunk enhancements into the sqlite3_stmt_explain branch. sqlite3_stmt_explain
drh [Wed, 19 Jul 2023 10:17:42 +0000 (10:17 +0000)] 
Merge the latest trunk enhancements into the sqlite3_stmt_explain branch.

FossilOrigin-Name: 06eae046c1a1155f22590b88942db72f01482f2363da9753f8adfdb322679055

23 months agoTwo minor improvements to sum(), one of which was inspired by
drh [Wed, 19 Jul 2023 09:52:10 +0000 (09:52 +0000)] 
Two minor improvements to sum(), one of which was inspired by
[forum:/forumpost/af5be98dbc|forum post af5be98dbc].

FossilOrigin-Name: a0d3e7571aded8d1e03908059d2d5aa5d62ec49bff099cb38f6f35df5e4b18b5

23 months agoDo not use the [/info/609fbb94b8f01d67|viewscan optimization] on a query
drh [Tue, 18 Jul 2023 21:06:19 +0000 (21:06 +0000)] 
Do not use the [/info/609fbb94b8f01d67|viewscan optimization] on a query
that has only a single loop, as the cost adjustments can cause problems
for outer queries.  Proposed fix for the performance regression reported by
[forum:/forumpost/64d36440e473516c|forum post 64d36440e473516c].

FossilOrigin-Name: 76152ad2ffe56034f2fd93d9a1ce9358e1677a7e9cd3dcd9f3a34a5c956a463e

23 months agoImproved ".wheretrace" for the VIEWSCAN optimization.
drh [Tue, 18 Jul 2023 20:41:09 +0000 (20:41 +0000)] 
Improved ".wheretrace" for the VIEWSCAN optimization.

FossilOrigin-Name: 27057ea76b5f72c73fb6f16094736685019643c665b49fd0bb8d60a812ce2338

23 months agoEnhance the sqlite3_stmt_explain() interface so that avoids unnecessary
drh [Tue, 18 Jul 2023 17:29:05 +0000 (17:29 +0000)] 
Enhance the sqlite3_stmt_explain() interface so that avoids unnecessary
reprepare operations.

FossilOrigin-Name: 050f773addd605f6690348c98e9000a9a3663bbc26288a71973fd7b40468e8ab

23 months agoFix memory leak in fts5 introduced by [def41225].
dan [Tue, 18 Jul 2023 16:29:34 +0000 (16:29 +0000)] 
Fix memory leak in fts5 introduced by [def41225].

FossilOrigin-Name: 4dcad2db743fdb9ef72871ca5a4d1384f76cb697161b0f5110e2670a83a18e8a

23 months agoFix a buffer overrun in fts5 that could occur in 'secure-delete' mode when dealing...
dan [Tue, 18 Jul 2023 13:55:19 +0000 (13:55 +0000)] 
Fix a buffer overrun in fts5 that could occur in 'secure-delete' mode when dealing with corrupt database records.

FossilOrigin-Name: def41225b2f10b0294ab506f28bc87873688d4030f7056839298ff18e058ece5

23 months agoAdd the experimental sqlite3_stmt_explain(S,E) interface.
drh [Sat, 15 Jul 2023 16:48:14 +0000 (16:48 +0000)] 
Add the experimental sqlite3_stmt_explain(S,E) interface.

FossilOrigin-Name: 5683743ddf0bb051f2fe5d137cc18407e000e77e9faa9010a22e3134b575638b

23 months agoMinor internal cleanups in the OPFS VFS.
stephan [Fri, 14 Jul 2023 21:06:00 +0000 (21:06 +0000)] 
Minor internal cleanups in the OPFS VFS.

FossilOrigin-Name: 984d491eb3fe06f714bf07d6873321f3992a072812b46508e599bfefd39dff3e

23 months agoMinor wasm build cleanups.
stephan [Fri, 14 Jul 2023 12:21:05 +0000 (12:21 +0000)] 
Minor wasm build cleanups.

FossilOrigin-Name: 816b503f093c4e6d92d0eb2f9fbd841acd01cc9bc89ee58d961b56c64f71406a

23 months agoReintroduce WASMFS+OPFS support, albeit as a separate (less portable) WASM build.
stephan [Thu, 13 Jul 2023 18:35:48 +0000 (18:35 +0000)] 
Reintroduce WASMFS+OPFS support, albeit as a separate (less portable) WASM build.

FossilOrigin-Name: 7e4c594e9591101f6b727212c99f561498444e86d3d059e5864a717c614f903a

23 months agoMinor cleanups related to reintroducing wasmfs support. wasmfs-2023
stephan [Thu, 13 Jul 2023 18:13:52 +0000 (18:13 +0000)] 
Minor cleanups related to reintroducing wasmfs support.

FossilOrigin-Name: 6918a927b5ecd1df5916b70d52d8d5ce289869c3f323e577b7dfc7c939084400

23 months agoMore work on the wasmfs build and its test apps.
stephan [Thu, 13 Jul 2023 17:27:05 +0000 (17:27 +0000)] 
More work on the wasmfs build and its test apps.

FossilOrigin-Name: 953b8557194e9451dcf9f3bb433eafb67961487325e6519e675e73fecf850bfb

23 months agoGet speedtest1 wasmfs variant running again.
stephan [Thu, 13 Jul 2023 16:33:45 +0000 (16:33 +0000)] 
Get speedtest1 wasmfs variant running again.

FossilOrigin-Name: 0f77e031daf0121f7603409cedf57f138edbb43083cbbcf00d2a423e16de25a7

23 months agoFix an off-by-one error in tests for cells overflowing the end pages. The
drh [Thu, 13 Jul 2023 14:49:39 +0000 (14:49 +0000)] 
Fix an off-by-one error in tests for cells overflowing the end pages.  The
error is completely harmless for the default page cache, but might cause
problems for application-defined page caches that pack pages tightly
together.

FossilOrigin-Name: ce6793e954f291b6f5c29175baf730ce217328de1f0601b8935daac62af5f448

23 months agoSignificant surgery on the wasm build on the way to incorporating wasmfs as a first...
stephan [Thu, 13 Jul 2023 14:08:30 +0000 (14:08 +0000)] 
Significant surgery on the wasm build on the way to incorporating wasmfs as a first-class build option.

FossilOrigin-Name: 215c37fce38cf647e073480689b79d952af7eb8165ae08c7f5caed27003fecfc

23 months agoMore work on the wasmfs build. Resolve the inconsistent argument type passed to sqlit...
stephan [Thu, 13 Jul 2023 10:41:41 +0000 (10:41 +0000)] 
More work on the wasmfs build. Resolve the inconsistent argument type passed to sqlite3InitModule() in such builds.

FossilOrigin-Name: 4850a9e2d2b41b91e91b9ef99a6d26ddf11a161b4c970fc00d2d095606729a04

23 months agoMinor cleanups in the wasmfs build.
stephan [Thu, 13 Jul 2023 04:54:18 +0000 (04:54 +0000)] 
Minor cleanups in the wasmfs build.

FossilOrigin-Name: f64477f21040c265061ad9b7f601e74159fd6141e7e4b122c80bf244ab6ddb76

23 months agoGet wasmfs build and its bare-bones test app working again, albeit currently in ES6...
stephan [Thu, 13 Jul 2023 04:26:13 +0000 (04:26 +0000)] 
Get wasmfs build and its bare-bones test app working again, albeit currently in ES6 mode only.

FossilOrigin-Name: 647761ed422f196f94facc88bbddd7219a2c1a6301a5f847b0a32d3e405233a7

23 months agoReplace 'self' with 'globalThis' in some JS test code. 12/head
stephan [Thu, 13 Jul 2023 03:46:43 +0000 (03:46 +0000)] 
Replace 'self' with 'globalThis' in some JS test code.

FossilOrigin-Name: 53eeffc9b1ea8c3ee7d7cdcc220997ed893403e45b35d8ea10805ea3b0435587

23 months agoJS: change the default OPFS VFS journal mode from PERSIST to DELETE, as DELETE is...
stephan [Thu, 13 Jul 2023 01:51:16 +0000 (01:51 +0000)] 
JS: change the default OPFS VFS journal mode from PERSIST to DELETE, as DELETE is faster in current browsers.

FossilOrigin-Name: a061a43e36b8f3cb7c465fd2e54cfcd9dceb07e232ee78602bbdd1818acd05ea

23 months agoRemove obsolete ext/wasm/api/sqlite3-wasi.h.
stephan [Thu, 13 Jul 2023 01:48:53 +0000 (01:48 +0000)] 
Remove obsolete ext/wasm/api/sqlite3-wasi.h.

FossilOrigin-Name: f661a6e0c1ac081ee402e64590eabd427440db1b717be9166bdfc025d0b0d899

23 months agoInternal JS doc fix.
stephan [Wed, 12 Jul 2023 09:30:13 +0000 (09:30 +0000)] 
Internal JS doc fix.

FossilOrigin-Name: 7c5ea02205a360a11fa9043be12c678eb7fe6f6a0b63b09a3dc976beae881e3f

23 months agoCorrect handling of the speedtest1 --without-rowid flag in the HTML front-end to...
stephan [Wed, 12 Jul 2023 09:16:18 +0000 (09:16 +0000)] 
Correct handling of the speedtest1 --without-rowid flag in the HTML front-end to speedtest1.wasm. Reduce default speedtest1-with-OPFS workload size in ext/wasm/index.html to speed up manual testing.

FossilOrigin-Name: 2daba2cdd3890c87899ff3eb0c1706c814f0ae62e72822eef3b0d4a885679a6b

23 months agoReduce divergence between branches: trunk and wal-shm-exceptions.
drh [Tue, 11 Jul 2023 19:54:17 +0000 (19:54 +0000)] 
Reduce divergence between branches: trunk and wal-shm-exceptions.

FossilOrigin-Name: d38ed6b1fc6b572997d520c36f256c11404fb1bd5f28acab07466bfc96554a8f

23 months agoAlways use the "LL" suffix on 64-bit integer literals.
drh [Sat, 8 Jul 2023 17:42:24 +0000 (17:42 +0000)] 
Always use the "LL" suffix on 64-bit integer literals.

FossilOrigin-Name: 07d95ed60f0a17ea13b4bc19c2ab2ec9052fedd27c9e1e57a1ec6e3a6470e5b7

23 months agoFix harmless scan-build warnings.
drh [Sat, 8 Jul 2023 14:27:55 +0000 (14:27 +0000)] 
Fix harmless scan-build warnings.

FossilOrigin-Name: beab3c98639be531744e60440223bb9ee76bc15234aff05e5efb273c8241dfd8

23 months agoOmit the use of memmove() in sqlite3FpDecode() in an attempt to avoid
drh [Fri, 7 Jul 2023 18:49:08 +0000 (18:49 +0000)] 
Omit the use of memmove() in sqlite3FpDecode() in an attempt to avoid
spurious warnings from valgrind.  Also makes the code slightly smaller and
faster.

FossilOrigin-Name: b409943af00e35ad05906d0a80ffa1225a66f3d807c131e00cfbf6671a03a981

23 months agoFor the "Valgrind" test scenario, set LONGDOUBLE_TYPE=double as valgrind
drh [Fri, 7 Jul 2023 12:18:26 +0000 (12:18 +0000)] 
For the "Valgrind" test scenario, set LONGDOUBLE_TYPE=double as valgrind
does not correctly emulated extended precision on x64.

FossilOrigin-Name: d3532eaed1cc671d8149b1bd34ead2a88fb83502a2898a5f60aea0a7daf18958

23 months agoAdd option 2 to SQLITE_TESTCTRL_USELONGDOUBLE to move the setting to its
drh [Fri, 7 Jul 2023 12:08:22 +0000 (12:08 +0000)] 
Add option 2 to SQLITE_TESTCTRL_USELONGDOUBLE to move the setting to its
defaults.  Enhance the CLI and testfixture to make use of this value.
Base the default on sizeof(LONGDOUBLE_TYPE) rather than on sizeof(long double).

FossilOrigin-Name: 64e6bd1c25d8e1dbfe511cba1921ff052c0fa4fe410fc9ce4435700a70cb88b1

2 years agoImproved handling of integer inputs to the new sum() implementation.
drh [Thu, 6 Jul 2023 20:34:06 +0000 (20:34 +0000)] 
Improved handling of integer inputs to the new sum() implementation.

FossilOrigin-Name: 31561c63bde6af2210296810fd66232b935033b4d26273a6b8a52142c54b4e12

2 years agoA more precise implementation of sqlite3RealToI64().
drh [Thu, 6 Jul 2023 18:29:15 +0000 (18:29 +0000)] 
A more precise implementation of sqlite3RealToI64().

FossilOrigin-Name: 8813317cb52990d90bd48de163b6e35ddcad2b6f3187aa28b28e2e088b4489ce

2 years agoFix octet_length() test cases so that they work when the database encoding
drh [Thu, 6 Jul 2023 17:14:47 +0000 (17:14 +0000)] 
Fix octet_length() test cases so that they work when the database encoding
is utf16.

FossilOrigin-Name: ad2e39626e6115fd322ef9495ae3bcd91343d7131a725f1bf24211a51a21dcc2

2 years agoUse the Kahan-Babushka-Neumaier algorithm to improve the accuracy of sum().
drh [Thu, 6 Jul 2023 15:44:38 +0000 (15:44 +0000)] 
Use the Kahan-Babushka-Neumaier algorithm to improve the accuracy of sum().

FossilOrigin-Name: c63e26e705f5e967e14ef6aea8ce226548293ad8d25066069f29fa89673913d2

2 years agoFix minor inaccuracies in the new sum() algorithm. kahan-babuska-neumaier-summation
drh [Thu, 6 Jul 2023 14:45:53 +0000 (14:45 +0000)] 
Fix minor inaccuracies in the new sum() algorithm.

FossilOrigin-Name: e3f7a960c9bd8e84cd70f0585bb955d043604a92001d0e2bf6c1216bb1fd7221

2 years agoExperimental attempt to boost the accuracy of sum() using the
drh [Thu, 6 Jul 2023 13:19:10 +0000 (13:19 +0000)] 
Experimental attempt to boost the accuracy of sum() using the
Kahan-Babuska-Neumaier algorithm.

FossilOrigin-Name: ebc5edd3b10c1102b07b9fb0d6837266b81e55504ef883b9b8a7ad5e8ab29dd2

2 years agoUse "volatile" isntead of "#pragma" to get floating point calculations
drh [Thu, 6 Jul 2023 00:55:06 +0000 (00:55 +0000)] 
Use "volatile" isntead of "#pragma" to get floating point calculations
working correctly when compiling with GCC for x86 machines.

FossilOrigin-Name: 9427f42687ed6d97c474bf42d0c3e82d6f4b0075e74206adcb5699d72e32140e

2 years agoThis is alternative work-around for the x86 float-point problem that uses fix-dekker-with-volatile
drh [Wed, 5 Jul 2023 22:05:18 +0000 (22:05 +0000)] 
This is alternative work-around for the x86 float-point problem that uses
"volatile" rather than compile-specific #pragmas.

FossilOrigin-Name: 1d972a690fdc70ab40862bd38427d68b48e8802ddf8e5c301f2d58ce2178b6ec

2 years agoImproved comments on the work-around to the GCC x86 floating point wonkiness.
drh [Wed, 5 Jul 2023 19:56:14 +0000 (19:56 +0000)] 
Improved comments on the work-around to the GCC x86 floating point wonkiness.

FossilOrigin-Name: 7b4c16731e7bf6f03f5adf4fcb2008c0b19be473fb1b90b405c217c08916586a

2 years agoWork around for an apparent GCC bug. See
drh [Wed, 5 Jul 2023 18:59:52 +0000 (18:59 +0000)] 
Work around for an apparent GCC bug.  See
[forum:/info/ee7278611394034c|forum post ee7278611394034c] for details.

FossilOrigin-Name: 5d9e9364808793d65925d4efbfde0f4246df258758f15e8ce1105070d1018fe6

2 years agoMake the order of operations explicit for the error term of Dekker
drh [Wed, 5 Jul 2023 15:34:30 +0000 (15:34 +0000)] 
Make the order of operations explicit for the error term of Dekker
double-precision multiply.

FossilOrigin-Name: 28f57b34e6b11184a36e363a985e7531bddd7be48a5e039a670e5acf748eedda

2 years agoSimplification of the dekkerMul2() subroutine.
drh [Wed, 5 Jul 2023 14:42:50 +0000 (14:42 +0000)] 
Simplification of the dekkerMul2() subroutine.

FossilOrigin-Name: bfe6432a46fd41bfadf4516a73b4e2523d9b453c3e4486fe6df7e1d25275dfb3

2 years agoAdd the ieee754_inc(r,N) function to the ieee754.c extension.
drh [Wed, 5 Jul 2023 12:00:32 +0000 (12:00 +0000)] 
Add the ieee754_inc(r,N) function to the ieee754.c extension.

FossilOrigin-Name: 9a36f269451d8832f68e223ac3995493704364e7fd0cc772989c96e863a08d29

2 years agoEnhance the sqlite3AtoF() function so that it can operate with or without
drh [Mon, 3 Jul 2023 18:32:29 +0000 (18:32 +0000)] 
Enhance the sqlite3AtoF() function so that it can operate with or without
long double and provides accurate results in both cases.

FossilOrigin-Name: fd987508d5589d42b46625c97cfb2feeac70fdb1cb11224610554b07a60644e6

2 years agoEnhance sqlite3AtoF() so that it honors the USELONGDOUBLE test-control. fp-to-decimal-refactor
drh [Mon, 3 Jul 2023 18:18:35 +0000 (18:18 +0000)] 
Enhance sqlite3AtoF() so that it honors the USELONGDOUBLE test-control.
Enable the test/atof1.test module on non-intel platforms.

FossilOrigin-Name: b7850fd480535980d66f107c2746e7f7fc0a5379ec8244d84f7785533c83f276

2 years agoStore the fp-speed-1.c test program used to measure relative performance of
drh [Mon, 3 Jul 2023 15:30:50 +0000 (15:30 +0000)] 
Store the fp-speed-1.c test program used to measure relative performance of
SQLite versus the standard library, in the test/ directory.  A header comment
explains how to use it.

FossilOrigin-Name: eaff376277edceb043e9aac9d2df3e1157f576605508733be8a0a0aa4d720e1d

2 years agoAdd the --nolongdouble option to speedtest1.c.
drh [Mon, 3 Jul 2023 15:11:28 +0000 (15:11 +0000)] 
Add the --nolongdouble option to speedtest1.c.

FossilOrigin-Name: 6bf6018a00d61c5f0e53b37b00befaf5ad1d85323f41cf0cea25d8c6c1017096

2 years agoImproved precision of binary-to-decimal conversion of floating-point values
drh [Mon, 3 Jul 2023 15:03:59 +0000 (15:03 +0000)] 
Improved precision of binary-to-decimal conversion of floating-point values
on all systems but especially non-x86 systems that lake extended precision
hardward floating point.

FossilOrigin-Name: 32befb224b254639e756fd493f300507ff60c5222e00a7338dbcd39140133964

2 years agoWhether or not to use the long-double floating point conversion technique
drh [Mon, 3 Jul 2023 14:56:49 +0000 (14:56 +0000)] 
Whether or not to use the long-double floating point conversion technique
is now a test-control setting.

FossilOrigin-Name: 02ae6caff1f7925c696ad263fe78b1036364d24b6373e1baec10d53aafb14a12

2 years agoNew test cases for floating-point conversions.
drh [Mon, 3 Jul 2023 12:58:18 +0000 (12:58 +0000)] 
New test cases for floating-point conversions.

FossilOrigin-Name: 9435ed76cd9bb1be02768b3853a2323834f67bda75d3e3f76f6aa7bd0bade3d7

2 years agoUse Dekker double-precision floating point to do the value normalization
drh [Mon, 3 Jul 2023 11:44:15 +0000 (11:44 +0000)] 
Use Dekker double-precision floating point to do the value normalization
step in sqlite3FpDecode() for systems on which "long double" is 8 bytes or
less.

FossilOrigin-Name: 51f492b440728151ce64168d5436ba87ca60d84b89408e47c593fa731355afe4

2 years agoFinal clean-up of the idea of using Dekker double-precision floating fp-to-decimal-branch1
drh [Mon, 3 Jul 2023 11:39:38 +0000 (11:39 +0000)] 
Final clean-up of the idea of using Dekker double-precision floating
computations to improve accuracy.

FossilOrigin-Name: 40285d631072b79aba39cc20d4b217bdf0069f29ac9902cb97dec28d3e4cde11

2 years agoSqueeze as many bits as we can out of normalization.
drh [Mon, 3 Jul 2023 10:35:29 +0000 (10:35 +0000)] 
Squeeze as many bits as we can out of normalization.

FossilOrigin-Name: 25d1ad6df1ed460c2cc9f32e8a5106e121ae502044f83abf431c1d5b3879eb56

2 years agoFaster Dekker multiplication that removes the restriction on input magnitude.
drh [Mon, 3 Jul 2023 10:18:02 +0000 (10:18 +0000)] 
Faster Dekker multiplication that removes the restriction on input magnitude.

FossilOrigin-Name: 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e

2 years agoFix one constant in the normalization logic. Improved error output
drh [Mon, 3 Jul 2023 10:00:38 +0000 (10:00 +0000)] 
Fix one constant in the normalization logic.  Improved error output
from atof1.test.

FossilOrigin-Name: d3c48807100a358a70fdd799c8935eba1b765ace2e1ddea4475fd673006cb6da

2 years agoReplace the dodgy error estimating logic in the previous check-in with
drh [Mon, 3 Jul 2023 09:07:23 +0000 (09:07 +0000)] 
Replace the dodgy error estimating logic in the previous check-in with
full-up Dekker double-double multiplication, and this idea works much better.
There are still a few inaccuracies, but it is much closer.

FossilOrigin-Name: 4fa6938dac2d3d813a37664053db31451a2a065f78dd212488f5f7f8d583ddc5

2 years agoAn idea for improving accuracy of fp-to-decimal conversion for systems that
drh [Mon, 3 Jul 2023 00:40:37 +0000 (00:40 +0000)] 
An idea for improving accuracy of fp-to-decimal conversion for systems that
do not have "long double".  Does not quite work.  Retained only for
documentation purposes.

FossilOrigin-Name: 702243333843219f8904ee0fd12283080d6c6b3fc1ffb36c534cdefb3563c00d

2 years agoThis check-in adds the use of "long double" to sqlite3FpDecode() which when
drh [Sat, 1 Jul 2023 20:21:27 +0000 (20:21 +0000)] 
This check-in adds the use of "long double" to sqlite3FpDecode() which when
run on x86 using a compiler that translates "long double" into binary80,
causes all legacy tests to pass.  But on a system where "long double" is just
an alias for "double", some of the tests are still failing.

FossilOrigin-Name: ce06982f880339cf46704e95c907249827c3e44af2b9420005200ca8abd3f371

2 years agoReinstate the fpdecode() SQL function for testing, but only when compiled
drh [Sat, 1 Jul 2023 18:33:26 +0000 (18:33 +0000)] 
Reinstate the fpdecode() SQL function for testing, but only when compiled
with SQLITE_DEBUG.

FossilOrigin-Name: 07eab52e0801bb0e4743b304a06ad16e18cdf8eaa18c0faf8d47a1f5d8576ea0

2 years agoImproved rounding policy.
drh [Sat, 1 Jul 2023 17:56:00 +0000 (17:56 +0000)] 
Improved rounding policy.

FossilOrigin-Name: 6f1122e942b8269552daaf13d647d200d8546ec25f36310d67037c6b58d09976

2 years agoImproved response to Infinity and NaN. Remove the termporary fpdecode()
drh [Sat, 1 Jul 2023 15:23:24 +0000 (15:23 +0000)] 
Improved response to Infinity and NaN.  Remove the termporary fpdecode()
function.

FossilOrigin-Name: 76ab8ae809a47a66688e2d50c20dc87ce946d82e9ffebb3adda55c451fad07fc

2 years agoProgress towards fixing corner-case floating-point formatting issues.
drh [Sat, 1 Jul 2023 14:03:50 +0000 (14:03 +0000)] 
Progress towards fixing corner-case floating-point formatting issues.

FossilOrigin-Name: 1138b8d16edef16d2943d407e289d07d546a14e64c3efa3c94127631e06fafeb

2 years agoFix an issue with the "+" attribute in printf().
drh [Fri, 30 Jun 2023 23:42:46 +0000 (23:42 +0000)] 
Fix an issue with the "+" attribute in printf().

FossilOrigin-Name: bdfd1eb1d7b4c570a53d58789dac0bf55fdaf8eba515d5a0caf2e57e25b51952

2 years agoBegin cutting over sqlite3FpDecode() into printf(). The code in this
drh [Fri, 30 Jun 2023 23:18:44 +0000 (23:18 +0000)] 
Begin cutting over sqlite3FpDecode() into printf().  The code in this
check-in gets a lot right, but there are still some formatting
discrepencies.

FossilOrigin-Name: c134d423e79ba5d3343d7480229822a0c83210f67f12129e0237181f892f97a5

2 years agoAdd decimal rounding to the sqlite3FpDecode() routine.
drh [Fri, 30 Jun 2023 19:41:57 +0000 (19:41 +0000)] 
Add decimal rounding to the sqlite3FpDecode() routine.

FossilOrigin-Name: 27871140caa833f0bc0962e44356993938e93dcf81c1074382b1560a3e1aeb61

2 years agoExperiments with a new algorithm for converting ieee-754 binary64 numbers
drh [Fri, 30 Jun 2023 18:35:43 +0000 (18:35 +0000)] 
Experiments with a new algorithm for converting ieee-754 binary64 numbers
into decimal.

FossilOrigin-Name: e923405e448385085224f9289991b303d86b02763535ea77d6fcee98ba6fc1f2

2 years agoAdd support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use...
dan [Fri, 30 Jun 2023 18:31:37 +0000 (18:31 +0000)] 
Add support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use a temp b-tree, and for sub-queries implemented as co-routines.

FossilOrigin-Name: 7afad1f759f7ceda873c6d869422fd56fe4399c2d24d47ad9bc3b84b06d830d1

2 years agoImprove support for sqlite3_stmt_scanstatus_v2() profiling of sub-queries implemented...
dan [Fri, 30 Jun 2023 18:23:53 +0000 (18:23 +0000)] 
Improve support for sqlite3_stmt_scanstatus_v2() profiling of sub-queries implemented as co-routines.

FossilOrigin-Name: 4e8718dc35dbbaf75f17265a88d14acd9750dc75efbadf41377f9c97e732009c

2 years agoAdd support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use...
dan [Fri, 30 Jun 2023 17:14:36 +0000 (17:14 +0000)] 
Add support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use a temp b-tree.

FossilOrigin-Name: 796eadcc50e7ea9ec348b1f7e2d6a5a3de78c675a07f665078309e6d81479e7d

2 years agoAdd extra debugging code for sqlite3_stmt_scanstatus_v2() to test1.c.
dan [Fri, 30 Jun 2023 16:16:51 +0000 (16:16 +0000)] 
Add extra debugging code for sqlite3_stmt_scanstatus_v2() to test1.c.

FossilOrigin-Name: f936f101406069b29218c89a36581b4497226fb61906782ea368f12d943c901c

2 years agoCompletely unwind the enhanced precision sum() from [a915f15a916af698] so
drh [Fri, 30 Jun 2023 14:01:09 +0000 (14:01 +0000)] 
Completely unwind the enhanced precision sum() from [a915f15a916af698] so
as not to offend UBSAN and OSS-Fuzz.

FossilOrigin-Name: 85be05b66ef975f02a3e7b2984bcab97d9280c7f3b6ee1e16718de549f240d46

2 years agoOmit the doubleToReal() function in vdbemem.c. Use the
drh [Fri, 30 Jun 2023 12:59:06 +0000 (12:59 +0000)] 
Omit the doubleToReal() function in vdbemem.c.  Use the
equivalent sqlite3RealToI64() function in its place.

FossilOrigin-Name: 625820e8ebfdcf513c81b1b632bbe2aa882a8fbba52001113dc6f56270fa5ceb

2 years agoMake the sum() function less precise and slower in order to avoid
drh [Fri, 30 Jun 2023 11:51:36 +0000 (11:51 +0000)] 
Make the sum() function less precise and slower in order to avoid
harmless signed integer overflow UBSAN warnings from OSS-Fuzz.

FossilOrigin-Name: 1be0646a2c352dbf03d2af87fd48b6f9edfd68666790ac6863144ac95f3e0621

2 years agoCleanup and commenting of the new DECIMAL extension code. No functional
drh [Thu, 29 Jun 2023 23:03:30 +0000 (23:03 +0000)] 
Cleanup and commenting of the new DECIMAL extension code.  No functional
changes.

FossilOrigin-Name: 5124481663eb8e74a9f861be98adb7075ea911fcff0216d98c658e955acadf14

2 years agoEnhancements to the DECIMAL extension:
drh [Thu, 29 Jun 2023 20:28:03 +0000 (20:28 +0000)] 
Enhancements to the DECIMAL extension:
(1) If the argument to decimal(X) is a floating point value (or an 8-byte blob),
the floating point value is expanded into its exact decimal representation.
(2) Function decimal_sci(X) works the same except it returns the result in
scientific notation.
(3) New function decimal_pow2(N) returns the full decimal expansion of the N-th
integer power of 2.

FossilOrigin-Name: 8baf8c10aecb261751f2b154356ab224b79d07230929ec9f123791278e601bba

2 years agoFix harmless compiler warnings about unused function arguments.
drh [Thu, 29 Jun 2023 17:48:32 +0000 (17:48 +0000)] 
Fix harmless compiler warnings about unused function arguments.

FossilOrigin-Name: 24927c1377314a10177da4a57191593440aa97fd0c5949fdf25a22df1d947600

2 years agoImprove the range of floating-point numbers that can be handled as integers
drh [Thu, 29 Jun 2023 17:36:18 +0000 (17:36 +0000)] 
Improve the range of floating-point numbers that can be handled as integers
for numeric-to-text conversion.

FossilOrigin-Name: 41580ba452fdbc3f73da60d8030289d38614c4cab8d24140d7cc44a54b2da8d2

2 years agoFurther refine the dtostr() testing function in the CLI so that it takes an
drh [Thu, 29 Jun 2023 17:26:21 +0000 (17:26 +0000)] 
Further refine the dtostr() testing function in the CLI so that it takes an
optional second parameter which is the number of significant digits to display.

FossilOrigin-Name: 2f9d4444aa503102a00d6e6769dadc57d4b26a2c07f145f23f2f28e0c161246d

2 years agoChange the (undocumented) dtostr() SQL function in the CLI so that it only
drh [Thu, 29 Jun 2023 16:48:25 +0000 (16:48 +0000)] 
Change the (undocumented) dtostr() SQL function in the CLI so that it only
shows the first 26 significant digits - 10 more digits than are available
in a 64-bit double.

FossilOrigin-Name: d758859f6ab94ddb9b3ee6f6f5f24b16e2b7a7712761080cfc6540d68b5a0c97

2 years agoAdd the decimal_sci(X) function to the Decimal extension for showing a decimal
drh [Thu, 29 Jun 2023 14:49:23 +0000 (14:49 +0000)] 
Add the decimal_sci(X) function to the Decimal extension for showing a decimal
value in scientific notation:  +D.DDDDDe+DD

FossilOrigin-Name: 61d4923913e88b980ce93db4f3f9f9d7ba3baaac724995c36c9b887c034accdc

2 years agoCLI enhancements to facilitate SQLite core testing:
drh [Thu, 29 Jun 2023 12:14:10 +0000 (12:14 +0000)] 
CLI enhancements to facilitate SQLite core testing:
(1) Add built-in functions strtod() and dtostr() that convert text to
floating point and back using C-library routines.
(2) Do not disable all of ".testctrl" without --unsafe-testing, but only
those subcommands of .testctrl that are actually dangerous.

FossilOrigin-Name: 669996a8ddcbf35f3de66cf466508fc1e6dd09ab269aba395ac86a11b2ec238c

2 years agoEnhance the SUM() aggregate (and related AVG() and TOTAL()) so that the running
drh [Wed, 28 Jun 2023 12:02:48 +0000 (12:02 +0000)] 
Enhance the SUM() aggregate (and related AVG() and TOTAL()) so that the running
sum is accurate to about 100 bits.

FossilOrigin-Name: a915f15a916af698e0cef46c8b3e7ed11bda19349179d2d414073cd39c4cce24

2 years agoImproved accuracy of floating-point conversion constants as suggested by
drh [Wed, 28 Jun 2023 11:46:28 +0000 (11:46 +0000)] 
Improved accuracy of floating-point conversion constants as suggested by
[forum:/info/598d32f6135c41c1|forum post 598d32f6135c41c1].

FossilOrigin-Name: 4943e8a1819e189747eefc414d02c0485e1620deff9cf92664295b21a8a9a83c

2 years agoSimple test cases for the enhanced SUM() function. extended-precision-fp
drh [Mon, 26 Jun 2023 19:57:23 +0000 (19:57 +0000)] 
Simple test cases for the enhanced SUM() function.

FossilOrigin-Name: c66ef2440e4e6c7aa17b50e5a29e543713ccab69aa0a415bac29b35b6116504a

2 years agoUse ideas from T. J. Dekker in "A Floating-Point Technique for Extending the
drh [Mon, 26 Jun 2023 19:35:20 +0000 (19:35 +0000)] 
Use ideas from T. J. Dekker in "A Floating-Point Technique for Extending the
Available Precision" (1971-07-26) to enhance the accuracy of the SUM()
aggregate function in cases where input magnitudes vary wildly.

FossilOrigin-Name: 439fc00fee62b4db3751860485e21a99cae4fd1f5d911b2c08651a1466245ecc

2 years agoFix CLI .sha3sum error message for keyword identifiers, reported in [forum:/forumpost...
larrybr [Mon, 26 Jun 2023 17:08:08 +0000 (17:08 +0000)] 
Fix CLI .sha3sum error message for keyword identifiers, reported in [forum:/forumpost/7cbe081746dd|forum post 7cbe081746dd].

FossilOrigin-Name: 9d7813ddcf67f1256e7331c5f390cb122b3f7e35cf46e0b33b610216a5396a00

2 years agoReplace some JS 'self' references with 'globalThis', as reported via the npm subproject.
stephan [Mon, 26 Jun 2023 07:05:05 +0000 (07:05 +0000)] 
Replace some JS 'self' references with 'globalThis', as reported via the npm subproject.

FossilOrigin-Name: d4e66dfc2e87112fa73a9c64db358429d88fb2ab3a08908b0eb655f6ed42f94b

2 years agoFix typo in the README.md file.
drh [Sun, 25 Jun 2023 20:23:51 +0000 (20:23 +0000)] 
Fix typo in the README.md file.

FossilOrigin-Name: 6d435d1dace1be52bdb920168e629412b9adf55dbe59cf3db8f169c26f6e6b81

2 years agoAdd support for the octet_length() SQL function, with low-level optimizations
drh [Fri, 23 Jun 2023 11:10:13 +0000 (11:10 +0000)] 
Add support for the octet_length() SQL function, with low-level optimizations
that avoid loading large string content from disk when the argument to
octet_length() is a table column.

FossilOrigin-Name: fa5f77862c0fe0189aa4246a1e55bb7c537c28c436ec10b75f5fa141e5e4aff0

2 years agoOptimize the argument to the octet_length() function so that it does not octet_length
drh [Thu, 22 Jun 2023 21:19:37 +0000 (21:19 +0000)] 
Optimize the argument to the octet_length() function so that it does not
attempt to read content from disk.

FossilOrigin-Name: 8b8ea4e3f52d96cc217bd1fb27ca4a83489ef1f250756ed2f790d1b0ee529a3a

2 years agobasic test cases for octet_length().
drh [Thu, 22 Jun 2023 15:26:52 +0000 (15:26 +0000)] 
basic test cases for octet_length().

FossilOrigin-Name: 034a5fe2a0cfe085271385da1d281515b04b311e08962519d03ad8ad156fb4bd

2 years agoMerge recent trunk enhancements into the octet_length branch.
drh [Thu, 22 Jun 2023 13:01:02 +0000 (13:01 +0000)] 
Merge recent trunk enhancements into the octet_length branch.

FossilOrigin-Name: d35c214811aac7dec0000ca2aa77231f74a7963dd0c53cf25a65ade5ef0f8dc0

2 years agoSimplification to the getAndInitPage() routine that results in improved
drh [Thu, 22 Jun 2023 01:03:39 +0000 (01:03 +0000)] 
Simplification to the getAndInitPage() routine that results in improved
performance.

FossilOrigin-Name: 2e9734c2335d8c06fedc9f4cca02baaf326f7fa276bd464f3214f383715a48d6

2 years agoImproved comment on the getAndInitPage() in btree.c. No code changes.
drh [Wed, 21 Jun 2023 21:47:09 +0000 (21:47 +0000)] 
Improved comment on the getAndInitPage() in btree.c.  No code changes.

FossilOrigin-Name: dc468cfdb825083b3a4b6cb95c913961e9312e22103c5a0cd923b75c83c65e13

2 years agoAdd the --pcachetrace option to the CLI.
drh [Wed, 21 Jun 2023 14:11:25 +0000 (14:11 +0000)] 
Add the --pcachetrace option to the CLI.

FossilOrigin-Name: 61dfa92b44ad38a7aac76a09e167819ce5d0acace3e06ba9ed17b3264cc043c1

2 years agoOmit unnecessary calls to table locking routines in the common case when
drh [Tue, 20 Jun 2023 17:45:19 +0000 (17:45 +0000)] 
Omit unnecessary calls to table locking routines in the common case when
there is no shared cache.

FossilOrigin-Name: f94f3021cde1d46373ee8fc8e5028d7507a937240c59cf0d0d19ab22acbd3c41

2 years agoAvoid unnecessary calls to sqlite3DeleteTable() with NULL pointers.
drh [Tue, 20 Jun 2023 16:26:52 +0000 (16:26 +0000)] 
Avoid unnecessary calls to sqlite3DeleteTable() with NULL pointers.

FossilOrigin-Name: 4a35f391995a88757d7b46f52bf241f523ee2a6a7b6726df00cddaec8cee7080

2 years agoAvoid unnecessary calls to sqlite3CodeRowTrigger().
drh [Tue, 20 Jun 2023 15:48:24 +0000 (15:48 +0000)] 
Avoid unnecessary calls to sqlite3CodeRowTrigger().

FossilOrigin-Name: 27c174dbd0e7ba029d13fb005fc950ac99eb6aee31903ee3acfc88c262d13f6a

2 years agoPerformance optimization in sqlite3VdbeAddOp4Int().
drh [Tue, 20 Jun 2023 11:46:32 +0000 (11:46 +0000)] 
Performance optimization in sqlite3VdbeAddOp4Int().

FossilOrigin-Name: 456a24324bd42e1e3384ffa8474b7d0760b27df95be0e92ddce5eb87339f6272

2 years agoAvoid unnecessary NULL pointer checks on calls to sqlite3WalkExpr().
drh [Mon, 19 Jun 2023 23:27:22 +0000 (23:27 +0000)] 
Avoid unnecessary NULL pointer checks on calls to sqlite3WalkExpr().

FossilOrigin-Name: 73d86a12fb068456a884c030fddd87020d6ec9d56376de541cf082b2104174d3