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

Non-aggregate SQL functions use sqlite_value* instead of const char * for

argument values. (CVS 1449)

FossilOrigin-Name: 1e47d7384d5fdfceb6ec737c656f70be59ba5b01
This commit is contained in:
danielk1977
2004-05-24 12:39:02 +00:00
parent 7e435458a0
commit 51ad0ecd28
10 changed files with 168 additions and 133 deletions

View File

@@ -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.325 2004/05/24 09:15:39 danielk1977 Exp $
** $Id: vdbe.c,v 1.326 2004/05/24 12:39:02 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -2269,33 +2269,29 @@ divide_by_zero:
** See also: AggFunc
*/
case OP_Function: {
int n, i;
int i;
Mem *pArg;
char **azArgv;
sqlite_func ctx;
sqlite3_value **apVal;
int n = pOp->p1;
n = pOp->p1;
apVal = sqliteMalloc(sizeof(sqlite3_value*)*n);
assert( apVal || n==0 );
pArg = &pTos[1-n];
azArgv = p->zArgv;
for(i=0; i<n; i++, pArg++){
if( pArg->flags & MEM_Null ){
azArgv[i] = 0;
}else if( !(pArg->flags&MEM_Str) ){
Stringify(pArg, TEXT_Utf8);
azArgv[i] = pArg->z;
}else{
SetEncodingFlags(pArg, db->enc);
SetEncoding(pArg, MEM_Utf8|MEM_Term);
azArgv[i] = pArg->z;
}
SetEncodingFlags(pArg, db->enc);
apVal[i] = pArg;
}
ctx.pFunc = (FuncDef*)pOp->p3;
ctx.s.flags = MEM_Null;
ctx.s.z = 0;
ctx.isError = 0;
ctx.isStep = 0;
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
(*ctx.pFunc->xFunc)(&ctx, n, (const char**)azArgv);
(*ctx.pFunc->xFunc)(&ctx, n, apVal);
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
popStack(&pTos, n);
pTos++;
@@ -2317,6 +2313,7 @@ case OP_Function: {
SetEncoding(pTos, encToFlags(db->enc)|MEM_Term);
}
if( apVal ) sqliteFree(apVal);
break;
}