![]() |
MySQL 8.1.0
Source Code Documentation
|
Error context to validate given JSON object which represents a histogram. More...
#include <histogram.h>
Public Member Functions | |
Error_context () | |
Default constructor. More... | |
Error_context (THD *thd, Field *field, TABLE *table, results_map *results) | |
Constructor. More... | |
~Error_context () | |
Destructor. More... | |
void | report_global (Message err_code) |
Report a global error to this context. More... | |
void | report_missing_attribute (const std::string &name) |
Report to this context that a required attribute is missing. More... | |
void | report_node (const Json_dom *dom, Message err_code) |
Report to this context that an error occurs on the given dom node. More... | |
template<typename T > | |
bool | check_value (T *v) |
Check if the value is in the field definition domain. More... | |
bool | binary () const |
Tell whether the input json is an internal persisted copy or a user-defined input. More... | |
Field * | field () const |
Return data-type of field in context if present. More... | |
Private Attributes | |
THD * | m_thd |
Thread context for error handlers. More... | |
uchar | m_buffer [MAX_FIELD_WIDTH] |
Buffer for m_field. More... | |
Field * | m_field |
The field for checking endpoint values. More... | |
results_map * | m_results |
Where reported errors are stored. More... | |
bool | m_binary |
Whether or not the JSON object to process is in binary format. More... | |
Error context to validate given JSON object which represents a histogram.
A validation error consists of two pieces of information:
1) error code - what kind of error it is 2) JSON path - where the error occurs
Errors are classified into a few conceptual categories, namely
1) absence of required attributes 2) unexpected JSON type of attributes 3) value encoding corruption 4) value out of domain 5) breaking bucket sequence semantics 6) breaking certain constraint between pieces of information
|
inline |
Default constructor.
histograms::Error_context::Error_context | ( | THD * | thd, |
Field * | field, | ||
TABLE * | table, | ||
results_map * | results | ||
) |
Constructor.
The context will create a copy of the Field so that Field::store can be used to check validity of bucket values. Results will be saved to the given results store
thd | Thread context |
field | The field for values on which the histogram is built |
table | The table on which the histogram is built |
results | Where reported errors are stored |
|
inline |
Destructor.
Destroy the copy of the Field and set all pointers to nullptr
|
inline |
Tell whether the input json is an internal persisted copy or a user-defined input.
If the input is an internal copy, there should never be type/format errors. If it is a user-defined input, errors may occur and should be handled, and some type casting may be needed.
template bool histograms::Error_context::check_value | ( | T * | v | ) |
Check if the value is in the field definition domain.
v | Pointer to the value. |
|
inline |
Return data-type of field in context if present.
Used to enforce that histogram datatype matches column datatype for user-defined histograms.
void histograms::Error_context::report_global | ( | Message | err_code | ) |
Report a global error to this context.
err_code | The global error code |
void histograms::Error_context::report_missing_attribute | ( | const std::string & | name | ) |
Report to this context that a required attribute is missing.
name | Name of the missing attribute |
Report to this context that an error occurs on the given dom node.
dom | The given dom node |
err_code | The error code |
|
private |
Whether or not the JSON object to process is in binary format.
|
private |
Buffer for m_field.
|
private |
The field for checking endpoint values.
|
private |
Where reported errors are stored.
|
private |
Thread context for error handlers.