Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe36d1d

Browse files
author
Nikita Glukhov
committed
Extract JsonValueFromCString()
1 parente324ad7 commitbe36d1d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

‎src/backend/utils/adt/jsonb.c‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,8 @@ jsonb_typeof(PG_FUNCTION_ARGS)
230230
PG_RETURN_TEXT_P(cstring_to_text(result));
231231
}
232232

233-
/*
234-
* jsonb_from_cstring
235-
*
236-
* Turns json string into a jsonb Datum.
237-
*
238-
* Uses the json parser (with hooks) to construct a jsonb.
239-
*/
240-
staticinlineDatum
241-
jsonb_from_cstring(char*json,intlen,boolunique_keys)
233+
staticJsonbValue*
234+
JsonValueFromCString(char*json,intlen,boolunique_keys)
242235
{
243236
JsonLexContext*lex;
244237
JsonbInStatestate;
@@ -262,9 +255,21 @@ jsonb_from_cstring(char *json, int len, bool unique_keys)
262255
pg_parse_json_or_ereport(lex,&sem);
263256

264257
/* after parsing, the item member has the composed jsonb structure */
265-
PG_RETURN_JSONB_P(JsonbValueToJsonb(state.res));
258+
returnstate.res;
266259
}
267260

261+
/*
262+
* jsonb_from_cstring
263+
*
264+
* Turns json string into a jsonb Datum.
265+
*
266+
* Uses the json parser (with hooks) to construct a jsonb.
267+
*/
268+
staticinlineDatum
269+
jsonb_from_cstring(char*json,intlen,boolunique_keys)
270+
{
271+
PG_RETURN_JSONB_P(JsonbValueToJsonb(JsonValueFromCString(json,len,unique_keys)));
272+
}
268273

269274
staticvoid
270275
jsonb_in_object_start(void*pstate)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp