Compare commits

...

1 Commits

Author SHA1 Message Date
drh 88a429c9d6 Demonstration of how to extend the if() and iif() SQL functions to support
more than 3 arguments.

FossilOrigin-Name: f13ef591848e7c69694c0af5778dae4d04a071a2f95192fb1dc9d6978dc87c0c
2025-01-21 12:33:00 +00:00
3 changed files with 16 additions and 11 deletions
+9 -6
View File
@@ -1,5 +1,5 @@
C Use\sTcl_GetString()\sinstead\sof\sTcl_GetCharLength()\sto\stest\sfor\sa\szero-length\nstring\sin\sthe\sTCL\sinterface,\ssince\sthat\sis\smuch\smore\sefficient.
D 2025-01-21T11:10:16.446
C Demonstration\sof\show\sto\sextend\sthe\sif()\sand\siif()\sSQL\sfunctions\sto\ssupport\nmore\sthan\s3\sarguments.
D 2025-01-21T12:33:00.984
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 30a407765d4e4b592f9f958085fb4e8336e54fa46a70ade7f5a67111bc191563
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c 89b733a5f513c4bc06b7271384363d5693d62782de8295bc87b97d79862c9714
F src/func.c 3f084d938c91d7faa7fa645973e60ef210b9dbf6b53ff0a44ce94ffc27bd3622
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
@@ -2208,8 +2208,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 bd5dc92368e41231a07bb59dd3db8942e238129ec7a3c8d785459d9b62bfcba3
R e87ed836260a3ceb4ad61cd2f818556e
P a8d9dcfd23fbfcd887e451382836c1e88215984cc01e00be11387dbf4ab26fd8
R 34c93cf9d01e3c710507a6b6a34500fc
T *branch * if-many-args
T *sym-if-many-args *
T -sym-trunk *
U drh
Z 345b10e2ab0f1f1054b6abc135136648
Z d4669fe91d65f0e0dabff4825fb271ee
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
a8d9dcfd23fbfcd887e451382836c1e88215984cc01e00be11387dbf4ab26fd8
f13ef591848e7c69694c0af5778dae4d04a071a2f95192fb1dc9d6978dc87c0c
+6 -4
View File
@@ -2815,10 +2815,12 @@ void sqlite3RegisterBuiltinFunctions(void){
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
FUNCTION(sign, 1, 0, 0, signFunc ),
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
INLINE_FUNC(iif, 2, INLINEFUNC_iif, 0 ),
INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
INLINE_FUNC(if, 2, INLINEFUNC_iif, 0 ),
INLINE_FUNC(if, 3, INLINEFUNC_iif, 0 ),
INLINE_FUNC(iif, 0, 0, 0 ),
INLINE_FUNC(iif, 1, 0, 0 ),
INLINE_FUNC(iif, -1, INLINEFUNC_iif, 0 ),
INLINE_FUNC(if, 0, 0, 0 ),
INLINE_FUNC(if, 1, 0, 0 ),
INLINE_FUNC(if, -1, INLINEFUNC_iif, 0 ),
};
#ifndef SQLITE_OMIT_ALTERTABLE
sqlite3AlterFunctions();