1#ifndef JSON_ERROR_HANDLER_INCLUDED
2#define JSON_ERROR_HANDLER_INCLUDED
35 std::function<void(
const char *parse_err,
size_t err_offset)>;
38 std::function<void(
const char *target_type,
int error_code)>;
84 size_t offset)
const = 0;
101 void operator()(
const char *parse_err,
size_t err_offset)
const;
138 size_t offset)
const override;
153 void operator()(
const char *target_type,
int error_code)
const;
166 void operator()(
const char *target_type,
int error_code)
const;
Callback function that checks if MYSQL_TIME_STATUS contains a deprecation warning.
Definition: json_error_handler.h:176
void operator()(MYSQL_TIME_STATUS &status) const
Definition: json_error_handler.cc:87
Callback function called when a coercion error occurs.
Definition: json_error_handler.h:150
const char * m_msgnam
The name of the field/expression being coerced to be used in error message if conversion failed.
Definition: json_error_handler.h:158
void operator()(const char *target_type, int error_code) const
Definition: json_error_handler.cc:69
JsonCoercionErrorHandler(const char *msgnam)
Definition: json_error_handler.h:152
Callback function called when a coercion error occurs.
Definition: json_error_handler.h:163
void operator()(const char *target_type, int error_code) const
Definition: json_error_handler.cc:75
JsonCoercionWarnHandler(const char *msgnam)
Definition: json_error_handler.h:165
const char * m_msgnam
The name of the field/expression being coerced to be used in error message if conversion failed.
Definition: json_error_handler.h:171
Definition: json_error_handler.h:96
const int m_arg_idx
Definition: json_error_handler.h:105
JsonParseDefaultErrorHandler(const char *func_name, int arg_idx)
Definition: json_error_handler.h:98
void operator()(const char *parse_err, size_t err_offset) const
Definition: json_error_handler.cc:36
const char * m_func_name
Definition: json_error_handler.h:104
The default error handler to be used when parsing JSON schemas and validating JSON objects using a JS...
Definition: json_error_handler.h:133
void InvalidJsonText(size_t arg_no, const char *wrong_string, size_t offset) const override
Called when an invalid JSON value is encountered.
Definition: json_error_handler.cc:92
void HandleStdExceptions() const override
Called if a std exception is thrown.
Definition: json_error_handler.cc:103
void InvalidJsonType() const override
Called if the provided JSON is not a JSON object.
Definition: json_error_handler.cc:107
JsonSchemaDefaultErrorHandler(const char *function_name)
Definition: json_error_handler.h:135
void NotSupported() const override
Called if a schema reference is encountered in the JSON document as MySQL does not support such const...
Definition: json_error_handler.cc:99
const char * m_calling_function_name
Used for error reporting and holds the name of the function.
Definition: json_error_handler.h:145
Error handler to be used when parsing JSON schemas and validating JSON objects using a JSON schema.
Definition: json_error_handler.h:79
virtual void InvalidJsonText(size_t arg_no, const char *wrong_string, size_t offset) const =0
Called when an invalid JSON value is encountered.
virtual void HandleStdExceptions() const =0
Called if a std exception is thrown.
virtual void NotSupported() const =0
Called if a schema reference is encountered in the JSON document as MySQL does not support such const...
virtual ~JsonSchemaErrorHandler()=default
virtual void InvalidJsonType() const =0
Called if the provided JSON is not a JSON object.
Error handler to be used when serializing JSON binary values in server code.
Definition: json_error_handler.h:115
void TooDeep() const override
Called when a JSON document has more nesting levels than supported.
Definition: json_error_handler.cc:52
const THD * m_thd
Definition: json_error_handler.h:126
void KeyTooBig() const override
Called when a JSON object contains a member with a name that is longer than supported by the JSON bin...
Definition: json_error_handler.cc:44
void InternalError(const char *message) const override
Called when an internal error occurs.
Definition: json_error_handler.cc:60
void ValueTooBig() const override
Called when a JSON document is too big to be stored in the JSON binary format.
Definition: json_error_handler.cc:48
bool CheckStack() const override
Check if the stack is about to be exhausted, and report the error.
Definition: json_error_handler.cc:65
void InvalidJson() const override
Called when an invalid JSON value is encountered.
Definition: json_error_handler.cc:56
JsonSerializationDefaultErrorHandler(const THD *thd)
Definition: json_error_handler.h:117
Error handler for the functions that serialize a JSON value in the JSON binary storage format.
Definition: json_error_handler.h:49
virtual void InvalidJson() const =0
Called when an invalid JSON value is encountered.
virtual void ValueTooBig() const =0
Called when a JSON document is too big to be stored in the JSON binary format.
virtual bool CheckStack() const =0
Check if the stack is about to be exhausted, and report the error.
virtual void KeyTooBig() const =0
Called when a JSON object contains a member with a name that is longer than supported by the JSON bin...
virtual ~JsonSerializationErrorHandler()=default
virtual void InternalError(const char *message) const =0
Called when an internal error occurs.
virtual void TooDeep() const =0
Called when a JSON document has more nesting levels than supported.
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
std::function< void(MYSQL_TIME_STATUS &status)> JsonCoercionDeprecatedHandler
Definition: json_error_handler.h:40
std::function< void(const char *target_type, int error_code)> JsonCoercionHandler
Definition: json_error_handler.h:38
void JsonDepthErrorHandler()
Definition: json_error_handler.cc:42
std::function< void()> JsonErrorHandler
Definition: json_error_handler.h:36
std::function< void(const char *parse_err, size_t err_offset)> JsonParseErrorHandler
Definition: json_error_handler.h:35
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
Definition: m_ctype.h:421
Structure to return status from str_to_datetime(), str_to_time(), number_to_datetime(),...
Definition: my_time.h:170