mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Fix a performance regression in JSON associated with generating small
snippets of JSON from a larger JSON string. FossilOrigin-Name: 837f2907e10b026f6db1ca2d44b4bf60a6f069bf534bf369ad9b5c513cb0c6e4
This commit is contained in:
18
src/json.c
18
src/json.c
@@ -563,12 +563,18 @@ static void jsonAppendValue(
|
||||
** The JSON string is reset.
|
||||
*/
|
||||
static void jsonResult(JsonString *p){
|
||||
if( p->bErr==0 && jsonForceRCStr(p) ){
|
||||
sqlite3RCStrRef(p->zBuf);
|
||||
sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed,
|
||||
(void(*)(void*))sqlite3RCStrUnref,
|
||||
SQLITE_UTF8);
|
||||
}else if( p->bErr==1 ){
|
||||
if( p->bErr==0 ){
|
||||
if( p->bStatic ){
|
||||
sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed,
|
||||
SQLITE_TRANSIENT, SQLITE_UTF8);
|
||||
}else if( jsonForceRCStr(p) ){
|
||||
sqlite3RCStrRef(p->zBuf);
|
||||
sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed,
|
||||
(void(*)(void*))sqlite3RCStrUnref,
|
||||
SQLITE_UTF8);
|
||||
}
|
||||
}
|
||||
if( p->bErr==1 ){
|
||||
sqlite3_result_error_nomem(p->pCtx);
|
||||
}
|
||||
jsonReset(p);
|
||||
|
||||
Reference in New Issue
Block a user