1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

The FuncDev.nArg field values -3 and -4 now have special meansing of 1 or more

or 2 or more arguments, respectively.  This saves space in the built-in
function table, resulting in slightly faster performance and a reduced binary
size.

FossilOrigin-Name: 753fd747f24c5e9a019eb00b8a4f66e65c6733ba10a7adbd1b55786867c32ca6
This commit is contained in:
drh
2025-01-21 15:12:00 +00:00
parent b80d01a182
commit 2e899ccaff
4 changed files with 22 additions and 23 deletions

View File

@@ -2695,12 +2695,10 @@ void sqlite3RegisterBuiltinFunctions(void){
FUNCTION(rtrim, 2, 2, 0, trimFunc ),
FUNCTION(trim, 1, 3, 0, trimFunc ),
FUNCTION(trim, 2, 3, 0, trimFunc ),
FUNCTION(min, -1, 0, 1, minmaxFunc ),
FUNCTION(min, 0, 0, 1, 0 ),
FUNCTION(min, -3, 0, 1, minmaxFunc ),
WAGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
FUNCTION(max, -1, 1, 1, minmaxFunc ),
FUNCTION(max, 0, 1, 1, 0 ),
FUNCTION(max, -3, 1, 1, minmaxFunc ),
WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
@@ -2727,11 +2725,8 @@ void sqlite3RegisterBuiltinFunctions(void){
FUNCTION(hex, 1, 0, 0, hexFunc ),
FUNCTION(unhex, 1, 0, 0, unhexFunc ),
FUNCTION(unhex, 2, 0, 0, unhexFunc ),
FUNCTION(concat, -1, 0, 0, concatFunc ),
FUNCTION(concat, 0, 0, 0, 0 ),
FUNCTION(concat_ws, -1, 0, 0, concatwsFunc ),
FUNCTION(concat_ws, 0, 0, 0, 0 ),
FUNCTION(concat_ws, 1, 0, 0, 0 ),
FUNCTION(concat, -3, 0, 0, concatFunc ),
FUNCTION(concat_ws, -4, 0, 0, concatwsFunc ),
INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ),
VFUNCTION(random, 0, 0, 0, randomFunc ),
VFUNCTION(randomblob, 1, 0, 0, randomBlob ),
@@ -2775,8 +2770,6 @@ void sqlite3RegisterBuiltinFunctions(void){
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
#endif
FUNCTION(coalesce, 1, 0, 0, 0 ),
FUNCTION(coalesce, 0, 0, 0, 0 ),
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
@@ -2814,7 +2807,7 @@ void sqlite3RegisterBuiltinFunctions(void){
MFUNCTION(pi, 0, 0, piFunc ),
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
FUNCTION(sign, 1, 0, 0, signFunc ),
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
INLINE_FUNC(coalesce, -4, INLINEFUNC_coalesce, 0 ),
INLINE_FUNC(iif, 2, INLINEFUNC_iif, 0 ),
INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
INLINE_FUNC(if, 2, INLINEFUNC_iif, 0 ),