MySQL 9.4.0
Source Code Documentation
jdv Namespace Reference

Classes

class  Content_tree_node
 
class  Key_column_info
 Class to represent each key and column information from JSON duality object. More...
 
class  View_lex_handler
 Class to handle view Lex. More...
 

Enumerations

enum  Duality_view_tags : int {
  DVT_INVALID = 0 , DVT_INSERT = 1 , DVT_UPDATE = 2 , DVT_DELETE = 4 ,
  DVT_NOUPDATE = 8
}
 

Functions

static const char * get_primary_key_column_name (const Table_ref *table_ref)
 Returns primary key name given table. More...
 
static Fieldget_field_for_column (const Table_ref *table_ref, const char *fld_name)
 Get the field instance of a column. More...
 
static bool set_join_column_index_for_node (Content_tree_node *child_node, Content_tree_node *parent_node, Item_ident *side_ident, bool is_parent)
 Helper function to set join column index for a given node. More...
 
static bool prepare_join_condition (THD *thd, Query_block *sl, Content_tree_node *node)
 Helper function to prepare join condition for sub-object. More...
 
static bool prepare_content_tree_node (THD *thd, Content_tree_node *node)
 
Content_tree_nodeprepare_content_tree (THD *thd, LEX *view_lex)
 Constructs the content tree for given JSON duality view. More...
 
void destroy_content_tree (Content_tree_node *root)
 Deletes the content tree for given JSON duality view. More...
 
static bool validate_view_syntax (THD *thd, Query_expression *qe, const char *object_name, bool root_query)
 Performs syntax validation of a given JSON DUALITY VIEW. More...
 
static bool meets_relationship_rules (Content_tree_node *node)
 Performs validation of below semantic rules: More...
 
static bool is_column_with_unsupported_type_projected (Content_tree_node *node)
 Performs validation of below semantic rules: More...
 
static bool meets_all_semantic_rules (Content_tree_node *node, std::map< std::string, Mem_root_array< Key_column_info > * > &table_columns_map)
 Apply duality view create rules. More...
 
static bool validate_view_semantics (Content_tree_node *root, std::map< std::string, Mem_root_array< Key_column_info > * > &table_columns_map)
 Performs semantic validation of a given JSON DUALITY VIEW. More...
 
bool is_prepare_required (THD *thd, Table_ref *table_ref)
 Check if duality view prepared is required. More...
 
bool prepare (THD *thd, Table_ref *table_ref)
 Performs Syntax validation, parepares metadata tree and performs Semantic validation of a given JSON DUALITY VIEW. More...
 
bool jdv_prepare_insert (THD *, const Table_ref *, Sql_cmd_insert_base *)
 
bool jdv_prepare_update (THD *, const Table_ref *, bool)
 
bool jdv_prepare_delete (THD *, const Table_ref *, bool)
 
bool jdv_insert (THD *, const Table_ref *, const mem_root_deque< List_item * > &)
 Entry point called from sql_insert.cc, bool Sql_cmd_insert_values::execute_inner(THD *thd);. More...
 
bool jdv_update (THD *, const Table_ref *, const mem_root_deque< Item * > *, const mem_root_deque< Item * > *, ulonglong *)
 Entry point called from sql_update.cc bool Sql_cmd_update::update_single_table(THD *thd);. More...
 
bool jdv_delete (THD *, const Table_ref *, ulonglong *)
 Entry point called from sql_delete.cc, bool Sql_cmd_delete::delete_from_single_table(THD *thd);. More...
 
void get_i_s_properties (Content_tree_node *root, const char *i_s_view_name, String *properties)
 Get the requested properies for the JSON duality view represented by the submitted content tree root. More...
 
void append_identifier (std::string *sbuf, std::string_view id, String *bufp)
 Append an identifier to a string using backtick quotes. More...
 
void append_identifier (std::string *sbuf, std::string_view id)
 Append an identifier to a string using backtick quotes using a String on the stack as buffer. More...
 

Variables

constexpr std::size_t VOID_COLUMN_INDEX
 

Enumeration Type Documentation

◆ Duality_view_tags

Enumerator
DVT_INVALID 
DVT_INSERT 
DVT_UPDATE 
DVT_DELETE 
DVT_NOUPDATE 

Function Documentation

◆ append_identifier() [1/2]

void jdv::append_identifier ( std::string *  sbuf,
std::string_view  id 
)

Append an identifier to a string using backtick quotes using a String on the stack as buffer.

◆ append_identifier() [2/2]

void jdv::append_identifier ( std::string *  sbuf,
std::string_view  id,
String bufp 
)

Append an identifier to a string using backtick quotes.

Pointer to String to use as buffer passed in.

◆ destroy_content_tree()

void jdv::destroy_content_tree ( Content_tree_node root)

Deletes the content tree for given JSON duality view.

Parameters
[in]rootRoot object of content tree

◆ get_field_for_column()

static Field * jdv::get_field_for_column ( const Table_ref table_ref,
const char *  fld_name 
)
static

Get the field instance of a column.

Parameters
[in]table_refTable_ref instance of a table.
[in]fld_nameField name.
Returns
Field instance if found, nullptr otherwise.

◆ get_i_s_properties()

void jdv::get_i_s_properties ( Content_tree_node root,
const char *  i_s_view_name,
String properties 
)

Get the requested properies for the JSON duality view represented by the submitted content tree root.

The i_s_view_name will imply which properties are requested. The properties are filled into a JSON document which is serialized into a string returned to the UDF invoked from the view, and is used there to join with the JSON duality view name retrieved from the DD tables.

Parameters
rootContent tree root.
i_s_view_nameName of the I_S view.
propertiesString containing the requested properties.

◆ get_primary_key_column_name()

static const char * jdv::get_primary_key_column_name ( const Table_ref table_ref)
static

Returns primary key name given table.

Parameters
[in]table_refTable_ref instance of a table. current THD
Returns
primary key column name if exists, otherwise nullptr.

◆ is_column_with_unsupported_type_projected()

static bool jdv::is_column_with_unsupported_type_projected ( Content_tree_node node)
static

Performs validation of below semantic rules:

  1. Projection of JSON, GEOMETRY columns/fields is not supported
  2. Projection of Virtual columns/fields is not supported
Parameters
[in]nodecurrent node of metadata tree
Return values
truein case if unsupported column is projected

◆ is_prepare_required()

bool jdv::is_prepare_required ( THD thd,
Table_ref table_ref 
)

Check if duality view prepared is required.

Parameters
thdThread handle.
table_refTable_ref* object for given JSON duality view.
Returns
true If JDV prepare should be performed.
false Otherwise.

◆ jdv_delete()

bool jdv::jdv_delete ( THD ,
const Table_ref ,
ulonglong  
)

Entry point called from sql_delete.cc, bool Sql_cmd_delete::delete_from_single_table(THD *thd);.

◆ jdv_insert()

bool jdv::jdv_insert ( THD ,
const Table_ref ,
const mem_root_deque< List_item * > &   
)

Entry point called from sql_insert.cc, bool Sql_cmd_insert_values::execute_inner(THD *thd);.

◆ jdv_prepare_delete()

bool jdv::jdv_prepare_delete ( THD ,
const Table_ref ,
bool   
)

◆ jdv_prepare_insert()

bool jdv::jdv_prepare_insert ( THD ,
const Table_ref ,
Sql_cmd_insert_base  
)

◆ jdv_prepare_update()

bool jdv::jdv_prepare_update ( THD ,
const Table_ref ,
bool   
)

◆ jdv_update()

bool jdv::jdv_update ( THD ,
const Table_ref ,
const mem_root_deque< Item * > *  ,
const mem_root_deque< Item * > *  ,
ulonglong  
)

Entry point called from sql_update.cc bool Sql_cmd_update::update_single_table(THD *thd);.

◆ meets_all_semantic_rules()

static bool jdv::meets_all_semantic_rules ( Content_tree_node node,
std::map< std::string, Mem_root_array< Key_column_info > * > &  table_columns_map 
)
static

Apply duality view create rules.

Parameters
[in]nodecurrent object of metadata tree
[in,out]table_columns_mapmap of table name to column projections
Return values
truein case of success, false in case of failure

◆ meets_relationship_rules()

static bool jdv::meets_relationship_rules ( Content_tree_node node)
static

Performs validation of below semantic rules:

Rule: If child object is a singleton descendent, then primary key column of a child object's table should part of a join condition. If child is a nested descendent, then primary key column of a parent object should be part of a join condition.

Parameters
[in]nodeCurrent content tree node.
Return values
truein case of success, false in case of failure.

◆ prepare()

bool jdv::prepare ( THD thd,
Table_ref table_ref 
)

Performs Syntax validation, parepares metadata tree and performs Semantic validation of a given JSON DUALITY VIEW.

Parameters
[in]thdCurrent THD object
[in,out]table_refTable_ref* object for given JSON DUALITY VIEW
Return values
falsein case of success, true in case of failure

◆ prepare_content_tree()

Content_tree_node * jdv::prepare_content_tree ( THD thd,
LEX view_lex 
)

Constructs the content tree for given JSON duality view.

Parameters
[in]thdTHD context.
[in]view_lexLEX* object for the current query
Returns
Content_tree on success, nullptr otherwise.

◆ prepare_content_tree_node()

static bool jdv::prepare_content_tree_node ( THD thd,
Content_tree_node node 
)
static

◆ prepare_join_condition()

static bool jdv::prepare_join_condition ( THD thd,
Query_block sl,
Content_tree_node node 
)
static

Helper function to prepare join condition for sub-object.

Parameters
thdThread Handle.
slSub-object's query block.
nodeContent tree node for a sub-object.
Returns
true On failure.
false On success.

◆ set_join_column_index_for_node()

static bool jdv::set_join_column_index_for_node ( Content_tree_node child_node,
Content_tree_node parent_node,
Item_ident side_ident,
bool  is_parent 
)
static

Helper function to set join column index for a given node.

Parameters
child_nodeContent_tree_node object representing the current node
parent_nodeContent_tree_node object representing the parent node
side_identItem_ident object representing one side of equality condition
is_parentspecifies whether current node is to be processed or parent
Returns
true On failure.
false On success.

◆ validate_view_semantics()

static bool jdv::validate_view_semantics ( Content_tree_node root,
std::map< std::string, Mem_root_array< Key_column_info > * > &  table_columns_map 
)
static

Performs semantic validation of a given JSON DUALITY VIEW.

Parameters
[in]rootObject of metadata tree
[in,out]table_columns_mapmap of table name to column projections
Return values
falsein case of success, true in case of failure

◆ validate_view_syntax()

static bool jdv::validate_view_syntax ( THD thd,
Query_expression qe,
const char *  object_name,
bool  root_query 
)
static

Performs syntax validation of a given JSON DUALITY VIEW.

Parameters
[in]thdCurrent THD object
[in]qeRoot object of metadata tree
[in]object_namekey name for sub-objects, "Root Node" for root node
[in]root_querydoes given qe represent root query expression?
Return values
falsein case of success, true in case of failure

Variable Documentation

◆ VOID_COLUMN_INDEX

constexpr std::size_t jdv::VOID_COLUMN_INDEX
constexpr
Initial value:
=
ValueType max(X &&first)
Definition: gtid.h:103