1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

It is an error to try to insert a BLOB value into JSON.

FossilOrigin-Name: 28c6e964b1e2257527df02b352f02e135f7c4b764b8b41eda6461f9538f5d042
This commit is contained in:
drh
2023-07-24 23:27:05 +00:00
parent 3d2a559ecb
commit b715fe9d80
3 changed files with 18 additions and 11 deletions

View File

@@ -733,10 +733,12 @@ static void jsonReturnJson(
sqlite3_result_error_nomem(pCtx);
return;
}
jsonInit(&s, pCtx);
jsonRenderNode(pParse, pNode, &s);
jsonResult(&s);
sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
if( pParse->nErr==0 ){
jsonInit(&s, pCtx);
jsonRenderNode(pParse, pNode, &s);
jsonResult(&s);
sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
}
}
/*
@@ -2705,6 +2707,11 @@ static void jsonReplaceNode(
}
break;
}
case SQLITE_BLOB: {
sqlite3_result_error(pCtx, "JSON cannot hold BLOB values", -1);
p->nErr++;
break;
}
}
}