1#ifndef JSON_DIFF_INCLUDED
2#define JSON_DIFF_INCLUDED
106 std::unique_ptr<Json_dom>
value)
146 typedef std::vector<Json_diff, allocator_type>
vector;
164 std::unique_ptr<Json_dom> dom);
239 const char *field_name);
A field that stores a JSON value.
Definition: field.h:3987
Vector of logical diffs describing changes to a JSON column.
Definition: json_diff.h:141
std::vector< Json_diff, allocator_type > vector
Type of the underlying vector.
Definition: json_diff.h:146
size_t m_binary_length
Length in bytes of the binary representation, not counting the 4 bytes length.
Definition: json_diff.h:250
vector::iterator iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:148
const_iterator end() const
Definition: json_diff.h:188
static const size_t ENCODED_LENGTH_BYTES
The length of the field where the total length is encoded.
Definition: json_diff.h:253
size_t binary_length(bool include_metadata=true) const
Return the length of the binary representation of this Json_diff_vector.
Definition: json_diff.cc:256
Mem_root_allocator< Json_diff > allocator_type
Type of the allocator for the underlying invector.
Definition: json_diff.h:144
size_t size() const
Return the number of elements in the vector.
Definition: json_diff.h:175
vector::const_iterator const_iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:150
Json_diff_vector(allocator_type arg)
Constructor.
Definition: json_diff.cc:230
const_iterator begin() const
Definition: json_diff.h:185
Json_diff & at(size_t pos)
Return the element at the given position.
Definition: json_diff.h:182
vector m_vector
Definition: json_diff.h:246
bool write_binary(String *to) const
Serialize this Json_diff_vector into the given String.
Definition: json_diff.cc:260
static const Json_diff_vector EMPTY_JSON_DIFF_VECTOR
An empty diff vector (having no diffs).
Definition: json_diff.h:242
void clear()
Clear the vector.
Definition: json_diff.cc:251
bool read_binary(const char **from, const struct TABLE *table, const char *field_name)
De-serialize Json_diff objects from the given String into this Json_diff_vector.
Definition: json_diff.cc:282
void add_diff(const Json_seekable_path &path, enum_json_diff_operation operation, std::unique_ptr< Json_dom > dom)
Append a new diff at the end of this vector.
Definition: json_diff.cc:238
A class that represents a logical change to a JSON document.
Definition: json_diff.h:85
size_t binary_length() const
Definition: json_diff.cc:109
Json_wrapper value() const
Get a Json_wrapper representing the new value to add to the path.
Definition: json_diff.cc:52
static const size_t ENCODED_OPERATION_BYTES
The length of the operation when encoded in binary format.
Definition: json_diff.h:94
const Json_path & path() const
Get the path that is changed by this diff.
Definition: json_diff.h:114
std::unique_ptr< Json_dom > m_value
The new value to add to the changed path.
Definition: json_diff.h:91
Json_path m_path
The path that is changed.
Definition: json_diff.h:87
bool write_binary(String *to) const
Serialize this Json_diff object and append to the given string.
Definition: json_diff.cc:148
enum_json_diff_operation m_operation
The operation to perform on the changed path.
Definition: json_diff.h:89
enum_json_diff_operation operation() const
Get the operation that is performed on the path.
Definition: json_diff.h:117
Json_diff(const Json_seekable_path &path, enum_json_diff_operation operation, std::unique_ptr< Json_dom > value)
Construct a Json_diff object.
Definition: json_diff.h:105
JSON DOM abstract base class.
Definition: json_dom.h:173
One path leg in a JSON path expression.
Definition: json_path.h:150
A JSON path expression.
Definition: json_path.h:357
bool append(const Json_path_leg &leg)
Add a path leg to the end of this path.
Definition: json_path.h:415
A path expression which can be used to seek to a position inside a JSON value.
Definition: json_path.h:302
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1161
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:68
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
enum_json_diff_status apply_json_diffs(Field_json *field, const Json_diff_vector *diffs)
Apply a sequence of JSON diffs to the value stored in a JSON column.
Definition: json_diff.cc:403
enum_json_diff_status
The result of applying JSON diffs on a JSON value using apply_json_diffs().
Definition: json_diff.h:259
@ REJECTED
One of the diffs was rejected.
@ ERROR
An error was raised while applying one of the diffs.
@ SUCCESS
The JSON diffs were applied and the JSON value in the column was updated successfully.
enum_json_diff_operation
Enum that describes what kind of operation a Json_diff object represents.
Definition: json_diff.h:53
@ REPLACE
The JSON value in the given path is replaced with a new value.
@ INSERT
Add a new element at the given path.
@ REMOVE
The JSON value at the given path is removed from an array or object.
static const int JSON_DIFF_OPERATION_COUNT
The number of elements of the enumeration above.
Definition: json_diff.h:78
This file contains interface support for the JSON path abstraction.
static char * path
Definition: mysqldump.cc:137
Definition: gcs_xcom_synode.h:64
PSI_memory_key key_memory_JSON
Definition: psi_memory_key.cc:53