]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Better comment to describe the confusing operand reversal for infix
authordrh <drh@noemail.net>
Sat, 8 Jul 2006 18:41:37 +0000 (18:41 +0000)
committerdrh <drh@noemail.net>
Sat, 8 Jul 2006 18:41:37 +0000 (18:41 +0000)
functions. (CVS 3325)

FossilOrigin-Name: 30dfb9bf2131370fe57e000495f5c292d392a010

manifest
manifest.uuid
src/expr.c

index 2a732f48a2a7cef98f5e4b771cb51ea5f51b786d..050777a0fe029d3be66f3029912ea46774a2447c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C For\sinfix\sfunctions\s(LIKE,\sGLOB,\sREGEXP,\sand\sMATCH)\streat\sthe\sleft\noperand\sas\sthe\sfirst\sargument\sfor\sthe\spurposes\sof\svirtual\stable\nfunction\soverloading,\seven\sthough\sthe\sleft\soperand\sis\sreally\sthe\nthe\ssecond\sargument.\s(CVS\s3324)
-D 2006-07-08T18:35:00
+C Better\scomment\sto\sdescribe\sthe\sconfusing\soperand\sreversal\sfor\sinfix\nfunctions.\s(CVS\s3325)
+D 2006-07-08T18:41:37
 F Makefile.in 9c2a76055c305868cc5f5b73e29a252ff3632c0a
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -42,7 +42,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
 F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
 F src/delete.c 804384761144fe1a5035b99f4bd7d706976831bd
 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
-F src/expr.c 3bd41e5aa93b3575e803eecedca80f4581aac791
+F src/expr.c f2c7af5591370191840b2a6334abf07c62f74a76
 F src/func.c f357a81bcdd83684cb198a8ad96be1c21e29f85c
 F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
@@ -375,7 +375,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 3c4233e074cb016e2422b2e8f867c99217e9b10e
-R 80b3dd37ffe8ba579a452291981999c6
+P 6e98373ca11c9d476f4c6b1841c6e006b7a49f29
+R fb2db0f3e3dec3a535007370db8c858a
 U drh
-Z f07a93792e01a08c48f4070b7ca89738
+Z 03250fa1943b65f5e69e097a8e8f5c3f
index 11c0840083a4e24cbdbfbcb232034517c15b0eb6..18ef7f2890c025f1fa3128f397569b455c1b42f1 100644 (file)
@@ -1 +1 @@
-6e98373ca11c9d476f4c6b1841c6e006b7a49f29
\ No newline at end of file
+30dfb9bf2131370fe57e000495f5c292d392a010
\ No newline at end of file
index 1f8346ac46986b0c2ee42b683153f4553d5b74ed..5ba7cde7ccf70a4cba0324f7fd65d60a89d27481 100644 (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.264 2006/07/08 18:35:00 drh Exp $
+** $Id: expr.c,v 1.265 2006/07/08 18:41:37 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1675,16 +1675,21 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
       assert( pDef!=0 );
       nExpr = sqlite3ExprCodeExprList(pParse, pList);
 #ifndef SQLITE_OMIT_VIRTUALTABLE
+      /* Possibly overload the function if the first argument is
+      ** a virtual table column.
+      **
+      ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the
+      ** second argument, not the first, as the argument to test to
+      ** see if it is a column in a virtual table.  This is done because
+      ** the left operand of infix functions (the operand we want to
+      ** control overloading) ends up as the second argument to the
+      ** function.  The expression "A glob B" is equivalent to 
+      ** "glob(B,A).  We want to use the A in "A glob B" to test
+      ** for function overloading.  But we use the B term in "glob(B,A)".
+      */
       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