Make sure group_concat() ignores initial NULL values. (CVS 6787)

FossilOrigin-Name: 90c3b23ccac8a9e7fc1cc831e43888e4e43badc9
This commit is contained in:
drh
2009-06-19 16:44:41 +00:00
parent 8bfdf72136
commit 8bfd719065
4 changed files with 34 additions and 18 deletions
+3 -8
View File
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.238 2009/06/19 14:06:03 drh Exp $
** $Id: func.c,v 1.239 2009/06/19 16:44:41 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -1265,15 +1265,10 @@ static void groupConcatStep(
if( pAccum ){
sqlite3 *db = sqlite3_context_db_handle(context);
int n;
int firstTerm = pAccum->useMalloc==0;
pAccum->useMalloc = 1;
pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH];
#ifdef SQLITE_OMIT_DEPRECATED
n = context->pMem->n;
#else
n = sqlite3_aggregate_count(context);
#endif
if( n>1 ){
if( !firstTerm ){
if( argc==2 ){
zSep = (char*)sqlite3_value_text(argv[1]);
nSep = sqlite3_value_bytes(argv[1]);