From: drh Date: Tue, 7 Oct 2008 19:53:14 +0000 (+0000) Subject: Raise the hard upper bound on SQLITE_MAX_FUNCTION_ARG to 1000 from 100. X-Git-Tag: version-3.6.10~397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e82f5d04c330c21ba11285c03ff64950e12946bd;p=thirdparty%2Fsqlite.git Raise the hard upper bound on SQLITE_MAX_FUNCTION_ARG to 1000 from 100. The default upper bound is still 100, but it can now be raised as high as 1000 at compile-time. (CVS 5780) FossilOrigin-Name: 79df72ee836db91647913055ba6cf55558679b01 --- diff --git a/manifest b/manifest index 6263bc4c46..992f8c36fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\sSQLITE_MUTEX_APPDEF\scompile-time\soption.\s\sThe\sSQLITE_THREADSAFE=0\noption\salways\sremoves\sall\smutex\scode.\s\sFor\sapplication-defined\smutexes\sonly,\nuse\sSQLITE_THREADSAFE=1\swith\sSQLITE_MUTEX_NOOP=1.\s\sTicket\s#3421.\s(CVS\s5779) -D 2008-10-07T15:25:48 +C Raise\sthe\shard\supper\sbound\son\sSQLITE_MAX_FUNCTION_ARG\sto\s1000\sfrom\s100.\nThe\sdefault\supper\sbound\sis\sstill\s100,\sbut\sit\scan\snow\sbe\sraised\sas\shigh\nas\s1000\sat\scompile-time.\s(CVS\s5780) +D 2008-10-07T19:53:14 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 7fc26e087207e7a4a7723583dbd7997477af3b13 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -107,7 +107,7 @@ F src/callback.c 7a40fd44da3eb89e7f6eff30aa6f940c45d73a97 F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c F src/date.c 1b1fc801df40aae891bff8b03f65313df192d677 F src/delete.c 7c9183a17b93b79dabbbc7cdb2159972d052b5a0 -F src/expr.c 30973b017bf95ca767f5eec64918c8afc425488d +F src/expr.c 0ceafeff3a4e0f460d6a7695a675ae12391e313d F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff F src/func.c 8431b40a7843d1024145684d303c55b4ee087bbe F src/global.c 20a3fe46c8287a01ba3a7442558f0eb70c66b19a @@ -118,7 +118,7 @@ F src/insert.c 110cca7845ed5a66c08fdd413b02e706ae34455f F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 F src/loadext.c cadd5df14bcda5ef0c26d815eb609a755861923e -F src/main.c 48e2ff96b1e6efdc144f4bcaa737621f7273a3b1 +F src/main.c fccd1a32306147aa751d4aaacec8fecfe4a34d1c F src/malloc.c 31f4ca218f4b664dce45ef9c4f1fcd2929c67a42 F src/mem1.c 5a529ff121c55ab067be14de00f86f6dcc4f4fb9 F src/mem2.c f87e681d0d1ed8436870d089332ed0d27d885b5c @@ -148,11 +148,11 @@ F src/prepare.c c7e00ed1b0bdcf699b1aad651247d4dc3d281b0b F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51 F src/resolve.c 1971ff6996f1a73303339acf7f1de8497546045d -F src/select.c c1c555ee714c61db92b2688b307a0145d7405122 +F src/select.c d910d7350df0d918e22286c5bfd39d4ea68ec813 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/sqlite.h.in ea235b37a691b32e7941baa70fb0afaf6377dbb4 F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e -F src/sqliteInt.h d7d1c122acd525994d7a69f0ce521626473bf9f0 +F src/sqliteInt.h 0d6bac3e25f0f37bac0efa4ed115d226c9252ba5 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 @@ -190,7 +190,7 @@ F src/update.c 206fffc877379affe3a9b42c78e478ea0874c9fe F src/utf.c c63e6f69082f85c19ab88d62dedaf91d71ac1a50 F src/util.c afe659ccc05d1f8af9e8631dabfec3ee3a7144af F src/vacuum.c fd77433d0c26d3ff1eb96eab017a1787ac5aa642 -F src/vdbe.c c9499f1824049cfef00a6146ef832b742f477920 +F src/vdbe.c b1c79e640b23e4e592f02719d70910ded09e4037 F src/vdbe.h 41c99aaad9167c1b5431993db446de74b2f71fc3 F src/vdbeInt.h b48c74d86a9fb62b707a3186ccca76bb32f1c6be F src/vdbeapi.c 8f194355e0270f236838d5b2a3af3ae3572adf44 @@ -641,7 +641,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 7d55ec374d62c6d3d588949b96e194920083fe4e -R 1635239c5f5cf9fdcf5c2cf2ba05eee1 +P 02a12eb1cfe9307c66556105a1a99d657cc01ab5 +R 5472677a4096378b94ede8934c9bcd72 U drh -Z 038b5cd7b8b898745d7ab0f99c550ee3 +Z a3cb5746d8ce1de551ab384e92396b35 diff --git a/manifest.uuid b/manifest.uuid index 16e1c271f7..a5944010a1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -02a12eb1cfe9307c66556105a1a99d657cc01ab5 \ No newline at end of file +79df72ee836db91647913055ba6cf55558679b01 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index b5fc4f9d11..c0760943eb 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.397 2008/10/06 05:32:19 danielk1977 Exp $ +** $Id: expr.c,v 1.398 2008/10/07 19:53:14 drh Exp $ */ #include "sqliteInt.h" #include @@ -2030,11 +2030,11 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ if( sqlite3ExprIsConstant(pList->a[i].pExpr) ){ constMask |= (1<needCollSeq && !pColl ){ + if( (pDef->flags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){ pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr); } } - if( pDef->needCollSeq ){ + if( pDef->flags & SQLITE_FUNC_NEEDCOLL ){ if( !pColl ) pColl = db->pDfltColl; sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); } diff --git a/src/main.c b/src/main.c index 12b98c0441..9343e674c6 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.503 2008/10/07 15:25:48 drh Exp $ +** $Id: main.c,v 1.504 2008/10/07 19:53:14 drh Exp $ */ #include "sqliteInt.h" #include @@ -1383,8 +1383,8 @@ static const int aHardLimit[] = { #if SQLITE_MAX_VDBE_OP<40 # error SQLITE_MAX_VDBE_OP must be at least 40 #endif -#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127 -# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127 +#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>1000 +# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 1000 #endif #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30 # error SQLITE_MAX_ATTACHED must be between 0 and 30 diff --git a/src/select.c b/src/select.c index 5d8171e860..5a8a6183be 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.479 2008/10/07 01:18:59 shane Exp $ +** $Id: select.c,v 1.480 2008/10/07 19:53:14 drh Exp $ */ #include "sqliteInt.h" @@ -3355,11 +3355,11 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){ assert( nArg==1 ); codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg); } - if( pF->pFunc->needCollSeq ){ + if( pF->pFunc->flags & SQLITE_FUNC_NEEDCOLL ){ CollSeq *pColl = 0; struct ExprList_item *pItem; int j; - assert( pList!=0 ); /* pList!=0 if pF->pFunc->needCollSeq is true */ + assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ for(j=0, pItem=pList->a; !pColl && jpExpr); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index f7494445ca..d97ccb8dd4 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.777 2008/10/07 15:25:49 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.778 2008/10/07 19:53:14 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -798,9 +798,8 @@ struct sqlite3 { ** points to a linked list of these structures. */ struct FuncDef { - i8 nArg; /* Number of arguments. -1 means unlimited */ + i16 nArg; /* Number of arguments. -1 means unlimited */ u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ - u8 needCollSeq; /* True if sqlite3GetFuncCollSeq() might be called */ u8 flags; /* Some combination of SQLITE_FUNC_* */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ @@ -814,9 +813,10 @@ struct FuncDef { /* ** Possible values for FuncDef.flags */ -#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ -#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ -#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */ +#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ +#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ +#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */ +#define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ /* ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are @@ -844,11 +844,11 @@ struct FuncDef { ** parameter. */ #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_UTF8, bNC, 0, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName} + {nArg, SQLITE_UTF8, bNC*8, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName} #define LIKEFUNC(zName, nArg, arg, flags) \ - {nArg, SQLITE_UTF8, 0, flags, (void *)arg, 0, likeFunc, 0, 0, #zName} + {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName} #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ - {nArg, SQLITE_UTF8, nc, 0, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName} + {nArg, SQLITE_UTF8, nc*8, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName} /* diff --git a/src/vdbe.c b/src/vdbe.c index df2ef23a16..38fc0964b0 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.779 2008/09/22 06:13:32 danielk1977 Exp $ +** $Id: vdbe.c,v 1.780 2008/10/07 19:53:14 drh Exp $ */ #include "sqliteInt.h" #include @@ -1322,7 +1322,7 @@ case OP_Function: { MemSetTypeFlag(&ctx.s, MEM_Null); ctx.isError = 0; - if( ctx.pFunc->needCollSeq ){ + if( ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){ assert( pOp>p->aOp ); assert( pOp[-1].p4type==P4_COLLSEQ ); assert( pOp[-1].opcode==OP_CollSeq ); @@ -4434,7 +4434,7 @@ case OP_AggStep: { ctx.s.db = db; ctx.isError = 0; ctx.pColl = 0; - if( ctx.pFunc->needCollSeq ){ + if( ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){ assert( pOp>p->aOp ); assert( pOp[-1].p4type==P4_COLLSEQ ); assert( pOp[-1].opcode==OP_CollSeq );