MySQL 8.4.3
Source Code Documentation
|
Path cache for JSON functions. More...
#include <item_json_func.h>
Classes | |
struct | Path_cell |
Struct that points to a cell in m_paths and tells its status. More... | |
Public Member Functions | |
Json_path_cache (THD *thd, uint size) | |
Json_path_cache. More... | |
~Json_path_cache () | |
bool | parse_and_cache_path (const THD *thd, Item **args, uint arg_idx, bool forbid_wildcards) |
Parse a path expression if necessary. More... | |
const Json_path * | get_path (uint arg_idx) const |
Return an already parsed path expression. More... | |
void | reset_cache () |
Reset the cache for re-use when a statement is re-executed. More... | |
Private Types | |
enum class | enum_path_status : uint8 { UNINITIALIZED , OK_NOT_NULL , OK_NULL } |
Enum that tells the status of a cell in m_paths. More... | |
Private Attributes | |
String | m_path_value |
Holder for path strings. More... | |
Prealloced_array< Json_path, 8 > | m_paths |
List of paths. More... | |
Mem_root_array< Path_cell > | m_arg_idx_to_vector_idx |
Map argument indexes to indexes into m_paths. More... | |
Path cache for JSON functions.
Caches parsed path objects for arguments which are string literals. Maintains a vector of path objects and an array of ints which map path argument numbers to slots in the array.
|
strongprivate |
Json_path_cache::Json_path_cache | ( | THD * | thd, |
uint | size | ||
) |
Json_path_cache.
|
default |
const Json_path * Json_path_cache::get_path | ( | uint | arg_idx | ) | const |
Return an already parsed path expression.
[in] | arg_idx | Index of the path_expression in the JSON function args |
bool Json_path_cache::parse_and_cache_path | ( | const THD * | thd, |
Item ** | args, | ||
uint | arg_idx, | ||
bool | forbid_wildcards | ||
) |
Parse a path expression if necessary.
Does nothing if the path expression is constant and it has already been parsed. Assumes that we've already verified that the path expression is not null. Raises an error if the path expression is syntactically incorrect. Raises an error if the path expression contains wildcard tokens but is not supposed to. Otherwise puts the parsed path onto the path vector.
[in] | thd | THD handle |
[in] | args | Array of args to a JSON function |
[in] | arg_idx | Index of the path_expression in args |
[in] | forbid_wildcards | True if the path shouldn't contain * or ** |
void Json_path_cache::reset_cache | ( | ) |
Reset the cache for re-use when a statement is re-executed.
|
private |
Map argument indexes to indexes into m_paths.
|
private |
Holder for path strings.
|
private |
List of paths.