1#ifndef JSON_DIFF_INCLUDED
2#define JSON_DIFF_INCLUDED
105 std::unique_ptr<Json_dom>
value)
145 typedef std::vector<Json_diff, allocator_type>
vector;
163 std::unique_ptr<Json_dom> dom);
238 const char *field_name);
A field that stores a JSON value.
Definition: field.h:3992
Vector of logical diffs describing changes to a JSON column.
Definition: json_diff.h:140
std::vector< Json_diff, allocator_type > vector
Type of the underlying vector.
Definition: json_diff.h:145
size_t m_binary_length
Length in bytes of the binary representation, not counting the 4 bytes length.
Definition: json_diff.h:249
vector::iterator iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:147
const_iterator end() const
Definition: json_diff.h:187
static const size_t ENCODED_LENGTH_BYTES
The length of the field where the total length is encoded.
Definition: json_diff.h:252
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:273
Mem_root_allocator< Json_diff > allocator_type
Type of the allocator for the underlying invector.
Definition: json_diff.h:143
size_t size() const
Return the number of elements in the vector.
Definition: json_diff.h:174
vector::const_iterator const_iterator
Type of iterator over the underlying vector.
Definition: json_diff.h:149
Json_diff_vector(allocator_type arg)
Constructor.
Definition: json_diff.cc:247
const_iterator begin() const
Definition: json_diff.h:184
Json_diff & at(size_t pos)
Return the element at the given position.
Definition: json_diff.h:181
vector m_vector
Definition: json_diff.h:245
bool write_binary(String *to) const
Serialize this Json_diff_vector into the given String.
Definition: json_diff.cc:277
static const Json_diff_vector EMPTY_JSON_DIFF_VECTOR
An empty diff vector (having no diffs).
Definition: json_diff.h:241
void clear()
Clear the vector.
Definition: json_diff.cc:268
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:299
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:255
A class that represents a logical change to a JSON document.
Definition: json_diff.h:84
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:93
const Json_path & path() const
Get the path that is changed by this diff.
Definition: json_diff.h:113
std::unique_ptr< Json_dom > m_value
The new value to add to the changed path.
Definition: json_diff.h:90
Json_path m_path
The path that is changed.
Definition: json_diff.h:86
bool write_binary(String *to) const
Serialize this Json_diff object and append to the given string.
Definition: json_diff.cc:157
enum_json_diff_operation m_operation
The operation to perform on the changed path.
Definition: json_diff.h:88
enum_json_diff_operation operation() const
Get the operation that is performed on the path.
Definition: json_diff.h:116
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:104
JSON DOM abstract base class.
Definition: json_dom.h:174
One path leg in a JSON path expression.
Definition: json_path.h:149
A JSON path expression.
Definition: json_path.h:356
bool append(const Json_path_leg &leg)
Add a path leg to the end of this path.
Definition: json_path.h:414
A path expression which can be used to seek to a position inside a JSON value.
Definition: json_path.h:301
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1168
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:67
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
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:420
enum_json_diff_status
The result of applying JSON diffs on a JSON value using apply_json_diffs().
Definition: json_diff.h:258
@ 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:52
@ 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:77
This file contains interface support for the JSON path abstraction.
static char * path
Definition: mysqldump.cc:148
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: varlen_sort.h:183
PSI_memory_key key_memory_JSON
Definition: psi_memory_key.cc:52