Better error message when coalesce() has too few arguments. Ticket #3623. (CVS 6222)

FossilOrigin-Name: 9cd43c82a3c123829806aa7bf14efdd29f4424d8
This commit is contained in:
drh
2009-01-31 22:28:48 +00:00
parent 64beba4338
commit dfbc3a8a3b
4 changed files with 26 additions and 13 deletions
+6 -3
View File
@@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.34 2008/12/10 21:19:57 drh Exp $
** $Id: callback.c,v 1.35 2009/01/31 22:28:49 drh Exp $
*/
#include "sqliteInt.h"
@@ -228,8 +228,9 @@ CollSeq *sqlite3FindCollSeq(
** that uses encoding enc. The value returned indicates how well the
** request is matched. A higher value indicates a better match.
**
** The returned value is always between 1 and 6, as follows:
** The returned value is always between 0 and 6, as follows:
**
** 0: Not a match, or if nArg<0 and the function is has no implementation.
** 1: A variable arguments function that prefers UTF-8 when a UTF-16
** encoding is requested, or vice versa.
** 2: A variable arguments function that uses UTF-16BE when UTF-16LE is
@@ -244,7 +245,9 @@ CollSeq *sqlite3FindCollSeq(
*/
static int matchQuality(FuncDef *p, int nArg, u8 enc){
int match = 0;
if( p->nArg==-1 || p->nArg==nArg || nArg==-1 ){
if( p->nArg==-1 || p->nArg==nArg
|| (nArg==-1 && (p->xFunc!=0 || p->xStep!=0))
){
match = 1;
if( p->nArg==nArg || nArg==-1 ){
match = 4;