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

For infix functions (LIKE, GLOB, REGEXP, and MATCH) treat the left

operand as the first argument for the purposes of virtual table
function overloading, even though the left operand is really the
the second argument. (CVS 3324)

FossilOrigin-Name: 6e98373ca11c9d476f4c6b1841c6e006b7a49f29
This commit is contained in:
drh
2006-07-08 18:34:59 +00:00
parent e94b0c3920
commit 6a03a1c5f7
6 changed files with 40 additions and 20 deletions

View File

@@ -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.263 2006/07/08 17:06:44 drh Exp $
** $Id: expr.c,v 1.264 2006/07/08 18:35:00 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1675,7 +1675,16 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
assert( pDef!=0 );
nExpr = sqlite3ExprCodeExprList(pParse, pList);
#ifndef SQLITE_OMIT_VIRTUALTABLE
if( nExpr>0 ){
if( nExpr>=2 && (pExpr->flags & EP_InfixFunc) ){
/* For infix functions GLOB, LIKE, REGEXP, and MATCH, check
** the second argument to the function which is operand to
** left of the function name. Users normally consider the
** left operand to be the first argument, even though it is
** really the second argument to the underlying function. */
pDef = sqlite3VtabOverloadFunction(pDef, nExpr, pList->a[1].pExpr);
}else if( nExpr>0 ){
/* For normal functions, go by the first argument - the first
** argument after the "(" that follows the function name */
pDef = sqlite3VtabOverloadFunction(pDef, nExpr, pList->a[0].pExpr);
}
#endif