MySQL  8.0.27
Source Code Documentation
json_diff.cc File Reference
#include "sql/json_diff.h"
#include <sys/types.h>
#include "lex_string.h"
#include "my_alloc.h"
#include "my_byteorder.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/field.h"
#include "sql/json_binary.h"
#include "sql/json_dom.h"
#include "sql/json_path.h"
#include "sql/log_event.h"
#include "sql/psi_memory_key.h"
#include "sql/sql_const.h"
#include "sql/table.h"
#include "sql_string.h"
#include "template_utils.h"

Functions

static size_t length_of_length_and_string (size_t length)
 Return the total size of a data field, plus the size of the preceding integer that describes the length, when the integer is stored in net_field_length() format. More...
 
static bool write_length_and_string (String *to, const String &from)
 Encode a String as (length, data) pair, with length being stored in net_field_length() format. More...
 
static Json_domseek_exact_path (Json_dom *dom, const Json_path_iterator &first_leg, const Json_path_iterator &last_leg)
 Find the value at the specified path in a JSON DOM. More...
 
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. More...
 

Variables

static MEM_ROOT empty_json_diff_vector_mem_root (PSI_NOT_INSTRUMENTED, 256)
 

Function Documentation

◆ apply_json_diffs()

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.

Parameters
fieldthe column to update
diffsthe diffs to apply
Returns
an enum_json_diff_status value that tells if the diffs were applied successfully

◆ length_of_length_and_string()

static size_t length_of_length_and_string ( size_t  length)
static

Return the total size of a data field, plus the size of the preceding integer that describes the length, when the integer is stored in net_field_length() format.

Parameters
lengthThe length of the data
Returns
The length of the data plus the length of the length field.

◆ seek_exact_path()

static Json_dom* seek_exact_path ( Json_dom dom,
const Json_path_iterator first_leg,
const Json_path_iterator last_leg 
)
static

Find the value at the specified path in a JSON DOM.

The path should not contain any wildcard or ellipsis, only simple array cells or member names. Auto-wrapping is not performed.

Parameters
domthe root of the DOM
first_legthe first path leg
last_legthe last path leg (exclusive)
Returns
the JSON DOM at the given path, or nullptr if the path is not found

◆ write_length_and_string()

static bool write_length_and_string ( String to,
const String from 
)
static

Encode a String as (length, data) pair, with length being stored in net_field_length() format.

Parameters
toBuffer where length and data will be stored.
fromSource string containing the data.
Returns
true on out of memory, false on success.

Variable Documentation

◆ empty_json_diff_vector_mem_root

MEM_ROOT empty_json_diff_vector_mem_root(PSI_NOT_INSTRUMENTED, 256) ( PSI_NOT_INSTRUMENTED  ,
256   
)
static