|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
14 | 14 |
|
15 |
| -#defineJSON_C |
16 |
| -#defineJSONB "json" |
17 |
| - |
18 |
| -#defineJSONXOIDJSONOID |
19 |
| - |
20 |
| -#definejsonb_in_json_in |
21 |
| -#definejsonb_recv_json_recv |
22 |
| - |
23 |
| -#definejsonb_outjson_out |
24 |
| -#definejsonb_sendjson_send |
25 |
| -#defineto_jsonbto_json |
26 |
| -#definejsonb_agg_transfnjson_agg_transfn |
27 |
| -#definejsonb_agg_finalfnjson_agg_finalfn |
28 |
| -#definejsonb_object_agg_transfnjson_object_agg_transfn |
29 |
| -#definejsonb_object_agg_finalfnjson_object_agg_finalfn |
30 |
| -#definejsonb_build_objectjson_build_object |
31 |
| -#definejsonb_build_object_noargsjson_build_object_noargs |
32 |
| -#definejsonb_build_arrayjson_build_array |
33 |
| -#definejsonb_build_array_noargsjson_build_array_noargs |
34 |
| -#definejsonb_objectjson_object |
35 |
| -#definejsonb_object_two_argjson_object_two_arg |
36 |
| -#definejsonb_typeofjson_typeof |
37 |
| - |
38 |
| -#defineJsonxContainerOps(&jsontContainerOps) |
39 |
| -#defineJsonxGetUniquified(json)(json) |
40 |
| -#defineJsonxPGetDatum(json)JsontPGetDatum(json) |
41 |
| - |
42 | 15 | #include"postgres.h"
|
43 | 16 |
|
44 | 17 | #include"catalog/pg_type.h"
|
@@ -259,82 +232,3 @@ escape_json(StringInfo buf, const char *str)
|
259 | 232 | }
|
260 | 233 | appendStringInfoCharMacro(buf,'"');
|
261 | 234 | }
|
262 |
| - |
263 |
| -#include"jsonb.c" |
264 |
| - |
265 |
| -/* |
266 |
| - * SQL function array_to_json(row) |
267 |
| - */ |
268 |
| -Datum |
269 |
| -array_to_json(PG_FUNCTION_ARGS) |
270 |
| -{ |
271 |
| -Datumarray=PG_GETARG_DATUM(0); |
272 |
| -JsonbInStateresult= {0}; |
273 |
| - |
274 |
| -array_to_jsonb_internal(array,&result, false); |
275 |
| - |
276 |
| -PG_RETURN_JSONT_P(JsonbValueToJsonb(result.res)); |
277 |
| -} |
278 |
| - |
279 |
| -/* |
280 |
| - * SQL function array_to_json(row, prettybool) |
281 |
| - */ |
282 |
| -Datum |
283 |
| -array_to_json_pretty(PG_FUNCTION_ARGS) |
284 |
| -{ |
285 |
| -Datumarray=PG_GETARG_DATUM(0); |
286 |
| -booluse_line_feeds=PG_GETARG_BOOL(1); |
287 |
| -JsonbInStateresult= {0}; |
288 |
| - |
289 |
| -array_to_jsonb_internal(array,&result, false); |
290 |
| - |
291 |
| -if (use_line_feeds) |
292 |
| -{ |
293 |
| -result.res->val.array.elementSeparator[0]='\n'; |
294 |
| -result.res->val.array.elementSeparator[1]=' '; |
295 |
| -} |
296 |
| -else |
297 |
| -result.res->val.array.elementSeparator[0]='\0'; |
298 |
| - |
299 |
| -PG_RETURN_JSONT_P(JsonbValueToJsonb(result.res)); |
300 |
| -} |
301 |
| - |
302 |
| -/* |
303 |
| - * SQL function row_to_json(row) |
304 |
| - */ |
305 |
| -Datum |
306 |
| -row_to_json(PG_FUNCTION_ARGS) |
307 |
| -{ |
308 |
| -Datumrow=PG_GETARG_DATUM(0); |
309 |
| -JsonbInStateresult= {0}; |
310 |
| - |
311 |
| -composite_to_jsonb(row,&result, false); |
312 |
| - |
313 |
| -PG_RETURN_JSONT_P(JsonbValueToJsonb(result.res)); |
314 |
| -} |
315 |
| - |
316 |
| -/* |
317 |
| - * SQL function row_to_json(row, prettybool) |
318 |
| - */ |
319 |
| -Datum |
320 |
| -row_to_json_pretty(PG_FUNCTION_ARGS) |
321 |
| -{ |
322 |
| -Datumrow=PG_GETARG_DATUM(0); |
323 |
| -booluse_line_feeds=PG_GETARG_BOOL(1); |
324 |
| -JsonbInStateresult= {0}; |
325 |
| - |
326 |
| -composite_to_jsonb(row,&result, false); |
327 |
| - |
328 |
| -if (use_line_feeds) |
329 |
| -{ |
330 |
| -result.res->val.object.fieldSeparator[0]='\n'; |
331 |
| -result.res->val.object.fieldSeparator[1]=' '; |
332 |
| -} |
333 |
| -else |
334 |
| -{ |
335 |
| -result.res->val.object.fieldSeparator[0]=' '; |
336 |
| -result.res->val.object.fieldSeparator[1]='\0'; |
337 |
| -} |
338 |
| - |
339 |
| -PG_RETURN_JSONT_P(JsonbValueToJsonb(result.res)); |
340 |
| -} |