1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Change json_group_object() so that it ignores entries where the label

is NULL.  [forum:/forumpost/e5bd251fb5|Forum post e5bd251fb5].

FossilOrigin-Name: 28215d131cd970a2756338579fb6b6091ab155be8f419505cae8ac918956165c
This commit is contained in:
drh
2025-05-24 20:20:20 +00:00
parent c5031b578b
commit a01b7adb13
4 changed files with 18 additions and 16 deletions

View File

@@ -4850,18 +4850,20 @@ static void jsonObjectStep(
UNUSED_PARAMETER(argc);
pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
if( pStr ){
z = (const char*)sqlite3_value_text(argv[0]);
n = sqlite3Strlen30(z);
if( pStr->zBuf==0 ){
jsonStringInit(pStr, ctx);
jsonAppendChar(pStr, '{');
}else if( pStr->nUsed>1 ){
}else if( pStr->nUsed>1 && z!=0 ){
jsonAppendChar(pStr, ',');
}
pStr->pCtx = ctx;
z = (const char*)sqlite3_value_text(argv[0]);
n = sqlite3Strlen30(z);
jsonAppendString(pStr, z, n);
jsonAppendChar(pStr, ':');
jsonAppendSqlValue(pStr, argv[1]);
if( z!=0 ){
jsonAppendString(pStr, z, n);
jsonAppendChar(pStr, ':');
jsonAppendSqlValue(pStr, argv[1]);
}
}
}
static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){