diff options
author | drh <> | 2022-06-01 11:05:59 +0000 |
---|---|---|
committer | drh <> | 2022-06-01 11:05:59 +0000 |
commit | 645682a7c73c3e5df5551bec5666195f10cbe0b5 (patch) | |
tree | fdedc0ad6897d15d7d6612280383bdcc9f5ae363 /src/expr.c | |
parent | 6ffa895884881b228ece0ed8a06679175746d4dd (diff) | |
download | sqlite-645682a7c73c3e5df5551bec5666195f10cbe0b5.tar.gz sqlite-645682a7c73c3e5df5551bec5666195f10cbe0b5.zip |
Move the sqlite_offset() function implementation to be an in-line function,
thereby avoiding special case code and freeing up a bit in the
FuncDef.flags field.
FossilOrigin-Name: 1c9812c458bd229c862efe5df1b64fae333da9871c8756b5ae4605a81bcda4b5
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/expr.c b/src/expr.c index 93b23049d..dcb5ee171 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3955,7 +3955,15 @@ static int exprCodeInlineFunction( caseExpr.x.pList = pFarg; return sqlite3ExprCodeTarget(pParse, &caseExpr, target); } - + case INLINEFUNC_sqlite_offset: { + Expr *pArg = pFarg->a[0].pExpr; + if( pArg->op==TK_COLUMN && pArg->iTable>=0 ){ + sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); + }else{ + sqlite3VdbeAddOp2(v, OP_Null, 0, target); + } + break; + } default: { /* The UNLIKELY() function is a no-op. The result is the value ** of the first argument. @@ -4494,20 +4502,8 @@ expr_code_doover: if( !pColl ) pColl = db->pDfltColl; sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); } -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){ - Expr *pArg = pFarg->a[0].pExpr; - if( pArg->op==TK_COLUMN ){ - sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); - }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - } - }else -#endif - { - sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, - pDef, pExpr->op2); - } + sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, + pDef, pExpr->op2); if( nFarg ){ if( constMask==0 ){ sqlite3ReleaseTempRange(pParse, r1, nFarg); |