mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Change the json_valid(X) routine to return true whenever X is a blob that
could plausibly be a valid JSONB. FossilOrigin-Name: 425f0b85a6f8ad0604c4a5faa18efb90436fedb1fe2612a559147c62cff8b7e7
This commit is contained in:
14
src/json.c
14
src/json.c
@@ -4812,8 +4812,14 @@ static void jsonTypeFunc(
|
||||
/*
|
||||
** json_valid(JSON)
|
||||
**
|
||||
** Return 1 if JSON is a well-formed canonical JSON string according
|
||||
** to RFC-7159. Return 0 otherwise.
|
||||
** Return 1 if the argument is one of:
|
||||
**
|
||||
** * A well-formed canonical JSON string according to RFC-8259
|
||||
** (without JSON5 enhancements), or
|
||||
**
|
||||
** * A BLOB that plausibly could be a JSONB value.
|
||||
**
|
||||
** Return 0 otherwise.
|
||||
*/
|
||||
static void jsonValidFunc(
|
||||
sqlite3_context *ctx,
|
||||
@@ -4829,6 +4835,10 @@ static void jsonValidFunc(
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if( jsonFuncArgMightBeBinary(argv[0]) ){
|
||||
sqlite3_result_int(ctx, 1);
|
||||
return;
|
||||
}
|
||||
p = jsonParseCached(ctx, argv[0], 0, 0);
|
||||
if( p==0 || p->oom ){
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
|
||||
Reference in New Issue
Block a user