aboutsummaryrefslogtreecommitdiff
path: root/src/callback.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-04-24 14:02:59 +0000
committerdrh <drh@noemail.net>2010-04-24 14:02:59 +0000
commit545f587fc8564075dafeb6a324fde43079b87a11 (patch)
treea181c9e2d9078412105b37c69e6a95e2a1df31b0 /src/callback.c
parent9a6e897328371a17f4ead1cd72c12240d372a81a (diff)
downloadsqlite-545f587fc8564075dafeb6a324fde43079b87a11.tar.gz
sqlite-545f587fc8564075dafeb6a324fde43079b87a11.zip
When commands such as ALTER TABLE and VACUUM use SQL internally, make sure
they use only the built-in functions and not application-defined overrides for those functions. FossilOrigin-Name: 0291ed974d5bf1e344e2c38422530cc961b897da
Diffstat (limited to 'src/callback.c')
-rw-r--r--src/callback.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/callback.c b/src/callback.c
index e6c51bccd..c016959fd 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -353,14 +353,19 @@ FuncDef *sqlite3FindFunction(
/* If no match is found, search the built-in functions.
**
+ ** If the SQLITE_PreferBuiltin flag is set, then search the built-in
+ ** functions even if a prior app-defined function was found. And give
+ ** priority to built-in functions.
+ **
** Except, if createFlag is true, that means that we are trying to
** install a new function. Whatever FuncDef structure is returned will
** have fields overwritten with new information appropriate for the
** new function. But the FuncDefs for built-in functions are read-only.
** So we must not search for built-ins when creating a new function.
*/
- if( !createFlag && !pBest ){
+ if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
+ bestScore = 0;
p = functionSearch(pHash, h, zName, nName);
while( p ){
int score = matchQuality(p, nArg, enc);