Convert all names to lower case before sending them to the xFindFunction

method of a virtual table.  In FTS1, use strcmp instead of strcasecmp.
Ticket #1981. (CVS 3428)

FossilOrigin-Name: efa8fb32a596c7232bb1754b3231e4f2421df75b
This commit is contained in:
drh 2006-09-18 20:24:02 +00:00
parent b08249ced3
commit a70034de7c
4 changed files with 24 additions and 13 deletions

View File

@ -2886,10 +2886,10 @@ static int fulltextFindFunction(
void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
void **ppArg
){
if( strcasecmp(zName,"snippet")==0 ){
if( strcmp(zName,"snippet")==0 ){
*pxFunc = snippetFunc;
return 1;
}else if( strcasecmp(zName,"offsets")==0 ){
}else if( strcmp(zName,"offsets")==0 ){
*pxFunc = snippetOffsetsFunc;
return 1;
}

View File

@ -1,5 +1,5 @@
C Modify\sFTS1\sso\sthat\sthe\s"magic"\scolumn\shas\sthe\ssame\sname\sas\sthe\svirtual\ntable.\s\sOffsets\sare\sretrieved\susing\sa\sspecial\s"offsets"\sfunction\swhose\nfirst\sargument\sis\sthe\smagic\scolumn.\s\sSnippets\swill\sultimately\sbe\sretrieved\nin\sthe\ssame\sway.\s(CVS\s3427)
D 2006-09-18T02:12:48
C Convert\sall\snames\sto\slower\scase\sbefore\ssending\sthem\sto\sthe\sxFindFunction\nmethod\sof\sa\svirtual\stable.\s\sIn\sFTS1,\suse\sstrcmp\sinstead\sof\sstrcasecmp.\nTicket\s#1981.\s(CVS\s3428)
D 2006-09-18T20:24:03
F Makefile.in cabd42d34340f49260bc2a7668c38eba8d4cfd99
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -21,7 +21,7 @@ F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5
F ext/fts1/fts1.c 298a1b77f51083cf76fae406971c6a2312315409
F ext/fts1/fts1.c c33206af7efcfea003863ca3e0038630cc6accf5
F ext/fts1/fts1.h 6060b8f62c1d925ea8356cb1a6598073eb9159a6
F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114
F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089
@ -119,7 +119,7 @@ F src/vdbeapi.c f1858a5edc3a5e32d038514dd9e7e9091400a782
F src/vdbeaux.c 7d15dcf0eab43b0f6b1bb840dc2a3126eb370f5b
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 26623176bf1c616aa478da958fac49502491a921
F src/vtab.c 2582c4e4a939072608bd8b4557c46f4343759197
F src/vtab.c aa30e940058ea56a1b7a9a7019ec21d307316fb4
F src/where.c 75a89957fcb8c068bec55caa4e9d2ed5fa0b0724
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@ -399,7 +399,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P aa7728f9f5b80dbb1b3db124f84b9166bf72bdd3
R 5f7b3fdccab6ce661c65210783a1bcaa
P 5e35dc1ffadfe7fa47673d052501ee79903eead9
R 867d1b47989e3f735fc6f80577ade597
U drh
Z 772a57c08cf67baf90fc0fd4a8945191
Z 02de4c591746aed0d8ad3108083846c8

View File

@ -1 +1 @@
5e35dc1ffadfe7fa47673d052501ee79903eead9
efa8fb32a596c7232bb1754b3231e4f2421df75b

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.36 2006/09/15 07:28:51 drh Exp $
** $Id: vtab.c,v 1.37 2006/09/18 20:24:03 drh Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@ -648,6 +648,10 @@ FuncDef *sqlite3VtabOverloadFunction(
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
void *pArg;
FuncDef *pNew;
int rc;
char *zLowerName;
unsigned char *z;
/* Check to see the left operand is a column in a virtual table */
if( pExpr==0 ) return pDef;
@ -662,8 +666,15 @@ FuncDef *sqlite3VtabOverloadFunction(
if( pMod->xFindFunction==0 ) return pDef;
/* Call the xFuncFunction method on the virtual table implementation
** to see if the implementation wants to overload this function */
if( pMod->xFindFunction(pVtab, nArg, pDef->zName, &xFunc, &pArg)==0 ){
** to see if the implementation wants to overload this function
*/
zLowerName = sqlite3StrDup(pDef->zName);
for(z=(unsigned char*)zLowerName; *z; z++){
*z = sqlite3UpperToLower[*z];
}
rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg);
sqliteFree(zLowerName);
if( rc==0 ){
return pDef;
}