1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Simplifications to the SQL function and aggregate calling procedures.

FossilOrigin-Name: 3467049a1705b49905ea88a5c6becb6fe318f2fa
This commit is contained in:
drh
2014-09-25 13:17:30 +00:00
parent 2c4dc635a1
commit a15cc47f81
5 changed files with 15 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
C Simplification\sto\sthe\srandom\srowid\spicking\slogic\sthat\sbegins\srunning\swhen\nthe\smaximum\spossible\srowid\shas\salready\sbeen\sused. C Simplifications\sto\sthe\sSQL\sfunction\sand\saggregate\scalling\sprocedures.
D 2014-09-25T12:31:28.476 D 2014-09-25T13:17:30.283
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -184,7 +184,7 @@ F src/delete.c fae81cc2eb14b75267d4f47d3cfc9ae02aae726f
F src/expr.c f32119248996680aa73c5c37bfdd42820804dc17 F src/expr.c f32119248996680aa73c5c37bfdd42820804dc17
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7 F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
F src/func.c 727a324e87a3392a47e44568b901d2fb96ba0ed4 F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee
F src/global.c 5110fa12e09729b84eee0191c984ec4008e21937 F src/global.c 5110fa12e09729b84eee0191c984ec4008e21937
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
@@ -289,9 +289,9 @@ F src/update.c 729f6f18fc27740591d085e1172cebe311144bf0
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8 F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
F src/vdbe.c 9fe630d05840aa151a5ba9039901478d9524120b F src/vdbe.c 73eace757ead9fee63576e8c9f5337edb4c8c69d
F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327 F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
F src/vdbeInt.h f177bed1ec8d4eb5c7089f012aeb95f374745735 F src/vdbeInt.h bb7f7ecfdead1a2ae0251b59f86f5724838d975c
F src/vdbeapi.c e9e33b59834e3edc8790209765e069874c269d9d F src/vdbeapi.c e9e33b59834e3edc8790209765e069874c269d9d
F src/vdbeaux.c a05adc3c96abdaf3db14768ddd63132fc9678060 F src/vdbeaux.c a05adc3c96abdaf3db14768ddd63132fc9678060
F src/vdbeblob.c 848238dc73e93e48432991bb5651bf87d865eca4 F src/vdbeblob.c 848238dc73e93e48432991bb5651bf87d865eca4
@@ -1200,7 +1200,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 6c8924cacc2b875270770fed2cc3b1884f57a655 P 1330c72e172324c68ab49e5bb2ceba985935ae01
R c9d002c28940b83ace850b74161b9f39 R db6a54c99d97f1320af4a50fd756c282
U drh U drh
Z a6a7b4b719a1f0df211ae0686c0976a9 Z 1da03df9544819e54ad17b4099a36954

View File

@@ -1 +1 @@
1330c72e172324c68ab49e5bb2ceba985935ae01 3467049a1705b49905ea88a5c6becb6fe318f2fa

View File

@@ -22,7 +22,10 @@
** Return the collating function associated with a function. ** Return the collating function associated with a function.
*/ */
static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
return context->pColl; VdbeOp *pOp = &context->pVdbe->aOp[context->iOp-1];
assert( pOp->opcode==OP_CollSeq );
assert( pOp->p4type==P4_COLLSEQ );
return pOp->p4.pColl;
} }
/* /*

View File

@@ -1557,17 +1557,8 @@ case OP_Function: {
ctx.iOp = pc; ctx.iOp = pc;
ctx.pVdbe = p; ctx.pVdbe = p;
MemSetTypeFlag(ctx.pOut, MEM_Null); MemSetTypeFlag(ctx.pOut, MEM_Null);
ctx.fErrorOrAux = 0; ctx.fErrorOrAux = 0;
if( ctx.pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
assert( pOp>aOp );
assert( pOp[-1].p4type==P4_COLLSEQ );
assert( pOp[-1].opcode==OP_CollSeq );
ctx.pColl = pOp[-1].p4.pColl;
}
db->lastRowid = lastRowid;
(*ctx.pFunc->xFunc)(&ctx, n, apVal); /* IMP: R-24505-23230 */ (*ctx.pFunc->xFunc)(&ctx, n, apVal); /* IMP: R-24505-23230 */
lastRowid = db->lastRowid;
/* If the function returned an error, throw an exception */ /* If the function returned an error, throw an exception */
if( ctx.fErrorOrAux ){ if( ctx.fErrorOrAux ){
@@ -5624,14 +5615,9 @@ case OP_AggStep: {
sqlite3VdbeMemInit(&t, db, MEM_Null); sqlite3VdbeMemInit(&t, db, MEM_Null);
ctx.pOut = &t; ctx.pOut = &t;
ctx.isError = 0; ctx.isError = 0;
ctx.pColl = 0; ctx.pVdbe = p;
ctx.iOp = pc;
ctx.skipFlag = 0; ctx.skipFlag = 0;
if( ctx.pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
assert( pOp>p->aOp );
assert( pOp[-1].p4type==P4_COLLSEQ );
assert( pOp[-1].opcode==OP_CollSeq );
ctx.pColl = pOp[-1].p4.pColl;
}
(ctx.pFunc->xStep)(&ctx, n, apVal); /* IMP: R-24505-23230 */ (ctx.pFunc->xStep)(&ctx, n, apVal); /* IMP: R-24505-23230 */
if( ctx.isError ){ if( ctx.isError ){
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&t)); sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&t));

View File

@@ -272,7 +272,6 @@ struct sqlite3_context {
Mem *pOut; /* The return value is stored here */ Mem *pOut; /* The return value is stored here */
FuncDef *pFunc; /* Pointer to function information */ FuncDef *pFunc; /* Pointer to function information */
Mem *pMem; /* Memory cell used to store aggregate context */ Mem *pMem; /* Memory cell used to store aggregate context */
CollSeq *pColl; /* Collating sequence */
Vdbe *pVdbe; /* The VM that owns this context */ Vdbe *pVdbe; /* The VM that owns this context */
int iOp; /* Instruction number of OP_Function */ int iOp; /* Instruction number of OP_Function */
int isError; /* Error code returned by the function. */ int isError; /* Error code returned by the function. */