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

Commite4926bf

Browse files
author
Nikita Glukhov
committed
Return back json_out(), json_send()
1 parent513242f commite4926bf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,32 @@ json_in(PG_FUNCTION_ARGS)
4747
PG_RETURN_TEXT_P(result);
4848
}
4949

50+
/*
51+
* Output.
52+
*/
53+
Datum
54+
json_out(PG_FUNCTION_ARGS)
55+
{
56+
/* we needn't detoast because text_to_cstring will handle that */
57+
Datumtxt=PG_GETARG_DATUM(0);
58+
59+
PG_RETURN_CSTRING(TextDatumGetCString(txt));
60+
}
61+
62+
/*
63+
* Binary send.
64+
*/
65+
Datum
66+
json_send(PG_FUNCTION_ARGS)
67+
{
68+
text*t=PG_GETARG_TEXT_PP(0);
69+
StringInfoDatabuf;
70+
71+
pq_begintypsend(&buf);
72+
pq_sendtext(&buf,VARDATA_ANY(t),VARSIZE_ANY_EXHDR(t));
73+
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
74+
}
75+
5076
/*
5177
* Binary receive.
5278
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp