49#define DEFAULT_CHUNK_SIZE 60
110 while ((
c =
getopt(argc, argv,
"r:c:os")) != -1)
149 pg_fatal(
"error opening input: %m");
152 pg_fatal(
"error statting input: %m");
255 _state->elem_is_first =
true;
266 _state->elem_is_first =
false;
276 if (!
_state->elem_is_first)
281 _state->elem_is_first =
false;
301 _state->elem_is_first =
true;
312 _state->elem_is_first =
false;
322 if (!
_state->elem_is_first)
324 _state->elem_is_first =
false;
365 for (p =
str; *p; p++)
391 if ((
unsigned char) *p <
' ')
406 fprintf(
stderr,
" -c chunksize size of piece fed to parser (default 64)\n");
407 fprintf(
stderr,
" -o set JSONLEX_CTX_OWNS_TOKENS for leak checking\n");
static void cleanup(void)
#define fprintf(file, fmt, msg)
#define palloc_object(type)
JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, const JsonSemAction *sem, const char *json, size_t len, bool is_last)
JsonLexContext * makeJsonLexContextIncremental(JsonLexContext *lex, int encoding, bool need_escapes)
void setJsonLexContextOwnsTokens(JsonLexContext *lex, bool owned_by_context)
const JsonSemAction nullSemAction
char * json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
void freeJsonLexContext(JsonLexContext *lex)
void pg_logging_init(const char *argv0)
int getopt(int nargc, char *const *nargv, const char *ostr)
PGDLLIMPORT char * optarg
static char buf[DEFAULT_XLOG_SEG_SIZE]
StringInfo makeStringInfo(void)
void resetStringInfo(StringInfo str)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoString(StringInfo str, const char *s)
void initStringInfo(StringInfo str)
#define appendStringInfoCharMacro(str, ch)
json_struct_action object_start
static bool lex_owns_tokens
static JsonParseErrorType do_object_field_start(void *state, char *fname, bool isnull)
static JsonParseErrorType do_array_element_end(void *state, bool isnull)
static JsonParseErrorType do_array_element_start(void *state, bool isnull)
static JsonParseErrorType do_object_end(void *state)
static JsonParseErrorType do_scalar(void *state, char *token, JsonTokenType tokentype)
#define DEFAULT_CHUNK_SIZE
static JsonParseErrorType do_array_start(void *state)
static JsonParseErrorType do_object_start(void *state)
static JsonParseErrorType do_array_end(void *state)
static JsonParseErrorType do_object_field_end(void *state, char *fname, bool isnull)
static void escape_json(StringInfo buf, const char *str)