SQLite
Check-in [f29680c468]
Not logged in
Overview
SHA1 Hash:f29680c468d5635e5ea7711f12f56ff467824241
Date: 2013-01-08 17:24:25
User: mistachkin
Comment:Merge updates from trunk.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to src/resolve.c

607 int n = pList ? pList->nExpr : 0; /* Number of arguments */ 607 int n = pList ? pList->nExpr : 0; /* Number of arguments */ 608 int no_such_func = 0; /* True if no such function exists */ 608 int no_such_func = 0; /* True if no such function exists */ 609 int wrong_num_args = 0; /* True if wrong number of arguments */ 609 int wrong_num_args = 0; /* True if wrong number of arguments */ 610 int is_agg = 0; /* True if is an aggregate function */ 610 int is_agg = 0; /* True if is an aggregate function */ 611 int auth; /* Authorization to use the function */ 611 int auth; /* Authorization to use the function */ 612 int nId; /* Number of characters in function name */ 612 int nId; /* Number of characters in function name */ 613 const char *zId; /* The function name. */ 613 const char *zId; /* The function name. */ > 614 FuncDef *pDef; /* Information about the function */ 614 u8 enc = ENC(pParse->db); /* The database encoding */ 615 u8 enc = ENC(pParse->db); /* The database encoding */ 615 616 616 testcase( pExpr->op==TK_CONST_FUNC ); 617 testcase( pExpr->op==TK_CONST_FUNC ); 617 assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); 618 assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); 618 zId = pExpr->u.zToken; 619 zId = pExpr->u.zToken; 619 nId = sqlite3Strlen30(zId); 620 nId = sqlite3Strlen30(zId); 620 if( pParse->db->init.busy==0 ){ < 621 FuncDef *pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0); | 621 pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0); 622 if( pDef==0 ){ | 622 if( pDef==0 ){ 623 pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0); | 623 pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0); 624 if( pDef==0 ){ | 624 if( pDef==0 ){ 625 no_such_func = 1; | 625 no_such_func = 1; 626 }else{ | 626 }else{ 627 wrong_num_args = 1; | 627 wrong_num_args = 1; 628 } | 628 } 629 }else{ | 629 }else{ 630 is_agg = pDef->xFunc==0; | 630 is_agg = pDef->xFunc==0; 631 } | 631 } 632 #ifndef SQLITE_OMIT_AUTHORIZATION 632 #ifndef SQLITE_OMIT_AUTHORIZATION 633 if( pDef ){ | 633 if( pDef ){ 634 auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0); | 634 auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0); 635 if( auth!=SQLITE_OK ){ | 635 if( auth!=SQLITE_OK ){ 636 if( auth==SQLITE_DENY ){ | 636 if( auth==SQLITE_DENY ){ 637 sqlite3ErrorMsg(pParse, "not authorized to use function: %s", | 637 sqlite3ErrorMsg(pParse, "not authorized to use function: %s", 638 pDef->zName); | 638 pDef->zName); 639 pNC->nErr++; | 639 pNC->nErr++; 640 } | 640 } 641 pExpr->op = TK_NULL; | 641 pExpr->op = TK_NULL; 642 return WRC_Prune; | 642 return WRC_Prune; 643 } | 643 } 644 } | 644 } 645 #endif 645 #endif 646 } < 647 if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){ 646 if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){ 648 sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); 647 sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); 649 pNC->nErr++; 648 pNC->nErr++; 650 is_agg = 0; 649 is_agg = 0; 651 }else if( no_such_func ){ | 650 }else if( no_such_func && pParse->db->init.busy==0 ){ 652 sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); 651 sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); 653 pNC->nErr++; 652 pNC->nErr++; 654 }else if( wrong_num_args ){ 653 }else if( wrong_num_args ){ 655 sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", 654 sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", 656 nId, zId); 655 nId, zId); 657 pNC->nErr++; 656 pNC->nErr++; 658 } 657 }