PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "plpy_elog.h"
#include "plpy_typeio.h"
#include "plpython.h"
#include "utils/fmgrprotos.h"
#include "utils/jsonb.h"
#include "utils/numeric.h"
Go to the source code of this file.
Macros | |
#define | PLyObject_AsString (PLyObject_AsString_p) |
#define | PLyUnicode_FromStringAndSize (PLyUnicode_FromStringAndSize_p) |
#define | PLy_elog (PLy_elog_impl_p) |
Typedefs | |
typedef char *(* | PLyObject_AsString_t) (PyObject *plrv) |
typedef void(* | PLy_elog_impl_t) (int elevel, const char *fmt,...) |
typedef PyObject *(* | PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size) |
Functions | |
static PyObject * | PLyObject_FromJsonbContainer (JsonbContainer *jsonb) |
static JsonbValue * | PLyObject_ToJsonbValue (PyObject *obj, JsonbParseState **jsonb_state, bool is_elem) |
void | _PG_init (void) |
static PyObject * | PLyUnicode_FromJsonbValue (JsonbValue *jbv) |
static void | PLyUnicode_ToJsonbValue (PyObject *obj, JsonbValue *jbvElem) |
static PyObject * | PLyObject_FromJsonbValue (JsonbValue *jsonbValue) |
static JsonbValue * | PLyMapping_ToJsonbValue (PyObject *obj, JsonbParseState **jsonb_state) |
static JsonbValue * | PLySequence_ToJsonbValue (PyObject *obj, JsonbParseState **jsonb_state) |
static JsonbValue * | PLyNumber_ToJsonbValue (PyObject *obj, JsonbValue *jbvNum) |
PG_FUNCTION_INFO_V1 (plpython_to_jsonb) | |
Datum | plpython_to_jsonb (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (jsonb_to_plpython) | |
Datum | jsonb_to_plpython (PG_FUNCTION_ARGS) |
Variables | |
PG_MODULE_MAGIC | |
static PLyObject_AsString_t | PLyObject_AsString_p |
static PLy_elog_impl_t | PLy_elog_impl_p |
static PyObject * | decimal_constructor |
static PLyUnicode_FromStringAndSize_t | PLyUnicode_FromStringAndSize_p |
#define PLy_elog (PLy_elog_impl_p) |
Definition at line 58 of file jsonb_plpython.c.
#define PLyObject_AsString (PLyObject_AsString_p) |
Definition at line 55 of file jsonb_plpython.c.
#define PLyUnicode_FromStringAndSize (PLyUnicode_FromStringAndSize_p) |
Definition at line 56 of file jsonb_plpython.c.
typedef void(* PLy_elog_impl_t) (int elevel, const char *fmt,...) |
Definition at line 16 of file jsonb_plpython.c.
typedef char*(* PLyObject_AsString_t) (PyObject *plrv) |
Definition at line 13 of file jsonb_plpython.c.
typedef PyObject*(* PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size) |
Definition at line 29 of file jsonb_plpython.c.
void _PG_init | ( | void | ) |
Definition at line 37 of file jsonb_plpython.c.
References AssertVariableIsOfType, load_external_function(), PLy_elog_impl(), PLy_elog_impl_p, PLyObject_AsString, PLyObject_AsString_p, PLyUnicode_FromStringAndSize, and PLyUnicode_FromStringAndSize_p.
Datum jsonb_to_plpython | ( | PG_FUNCTION_ARGS | ) |
Definition at line 474 of file jsonb_plpython.c.
References Assert, decimal_constructor, ERROR, PG_GETARG_JSONB_P, PLy_elog, PLyObject_FromJsonbContainer(), PointerGetDatum(), and Jsonb::root.
PG_FUNCTION_INFO_V1 | ( | jsonb_to_plpython | ) |
PG_FUNCTION_INFO_V1 | ( | plpython_to_jsonb | ) |
Datum plpython_to_jsonb | ( | PG_FUNCTION_ARGS | ) |
Definition at line 456 of file jsonb_plpython.c.
References JsonbValueToJsonb(), PG_GETARG_POINTER, PG_RETURN_POINTER, and PLyObject_ToJsonbValue().
|
static |
Definition at line 262 of file jsonb_plpython.c.
References i, items, jbvString, sort-test::key, PG_END_TRY, PG_FINALLY, PG_TRY, PLyObject_ToJsonbValue(), PLyUnicode_ToJsonbValue(), pushJsonbValue(), JsonbValue::type, JsonbValue::val, value, WJB_BEGIN_OBJECT, WJB_END_OBJECT, and WJB_KEY.
Referenced by PLyObject_ToJsonbValue().
|
static |
Definition at line 357 of file jsonb_plpython.c.
References CStringGetDatum(), DatumGetNumeric(), DirectFunctionCall3, ereport, errcode(), errmsg(), ERROR, Int32GetDatum(), InvalidOid, jbvNumeric, numeric_in(), numeric_is_inf(), numeric_is_nan(), ObjectIdGetDatum(), pfree(), PG_CATCH, PG_END_TRY, PG_TRY, PLyObject_AsString, str, JsonbValue::type, and JsonbValue::val.
Referenced by PLyObject_ToJsonbValue().
|
static |
Definition at line 134 of file jsonb_plpython.c.
References elog, ERROR, JsonbIteratorInit(), JsonbIteratorNext(), sort-test::key, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PLyObject_FromJsonbValue(), PLyUnicode_FromJsonbValue(), JsonbValue::val, val, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_DONE, WJB_ELEM, WJB_END_ARRAY, WJB_KEY, and WJB_VALUE.
Referenced by jsonb_to_plpython(), and PLyObject_FromJsonbValue().
|
static |
Definition at line 92 of file jsonb_plpython.c.
References DatumGetCString(), decimal_constructor, DirectFunctionCall1, elog, ERROR, jbvBinary, jbvBool, jbvNull, jbvNumeric, jbvString, numeric_out(), NumericGetDatum(), PLyObject_FromJsonbContainer(), PLyUnicode_FromJsonbValue(), str, JsonbValue::type, and JsonbValue::val.
Referenced by PLyObject_FromJsonbContainer().
|
static |
Definition at line 407 of file jsonb_plpython.c.
References ereport, errcode(), errmsg(), ERROR, jbvBool, jbvNull, palloc(), PLyMapping_ToJsonbValue(), PLyNumber_ToJsonbValue(), PLyObject_AsString, PLySequence_ToJsonbValue(), PLyUnicode_ToJsonbValue(), pushJsonbValue(), JsonbValue::type, JsonbValue::val, WJB_ELEM, and WJB_VALUE.
Referenced by plpython_to_jsonb(), PLyMapping_ToJsonbValue(), and PLySequence_ToJsonbValue().
|
static |
Definition at line 319 of file jsonb_plpython.c.
References Assert, i, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PLyObject_ToJsonbValue(), pushJsonbValue(), value, WJB_BEGIN_ARRAY, and WJB_END_ARRAY.
Referenced by PLyObject_ToJsonbValue().
|
static |
Definition at line 66 of file jsonb_plpython.c.
References Assert, jbvString, PLyUnicode_FromStringAndSize, JsonbValue::type, and JsonbValue::val.
Referenced by PLyObject_FromJsonbContainer(), and PLyObject_FromJsonbValue().
|
static |
Definition at line 79 of file jsonb_plpython.c.
References jbvString, PLyObject_AsString, JsonbValue::type, and JsonbValue::val.
Referenced by PLyMapping_ToJsonbValue(), and PLyObject_ToJsonbValue().
|
static |
Definition at line 23 of file jsonb_plpython.c.
Referenced by jsonb_to_plpython(), PLyDecimal_FromNumeric(), and PLyObject_FromJsonbValue().
PG_MODULE_MAGIC |
Definition at line 10 of file jsonb_plpython.c.
|
static |
Definition at line 17 of file jsonb_plpython.c.
Referenced by _PG_init().
|
static |
Definition at line 14 of file jsonb_plpython.c.
Referenced by _PG_init().
|
static |
Definition at line 31 of file jsonb_plpython.c.
Referenced by _PG_init().