![]() |
MySQL 9.7.0
Source Code Documentation
|
Classes | |
| class | Content_tree_node |
| struct | Json_type_traits |
| struct | Json_type_traits< Json_array > |
| struct | Json_type_traits< Json_object > |
| class | Key_column_info |
| Class to represent each key and column information from JSON duality object. More... | |
| struct | Resolve_column |
| Represents columns in the base table which will be populated based on the Json document passed in. More... | |
| struct | Resolve_row |
| Holds the resolved values for a row of a base table. More... | |
| struct | Single_object_binding |
| Binds a single Json_object and a jdv::Content_tree_node. More... | |
| struct | Size_first_comparator |
| Comparator which orders in the same way as Json_object orders its keys. More... | |
| struct | Two_object_binding |
| Binds two Json_objects (existing_object and new_object) and a jdv::Content_tree_node. More... | |
| class | View_lex_handler |
| Class to handle view Lex. More... | |
Typedefs | |
| using | Resolve_column_vec = std::vector< Resolve_column > |
| template<typename T > | |
| using | Index_entry = std::reference_wrapper< T > |
| Convenience alias. More... | |
| template<typename T > | |
| using | Index = std::span< Index_entry< T > > |
| Convenience alias. More... | |
Enumerations | |
| enum | Duality_view_tags : int { DVT_INVALID = 0 , DVT_INSERT = 1 , DVT_UPDATE = 2 , DVT_DELETE = 4 , DVT_NOINSERT = 8 , DVT_NOUPDATE = 16 , DVT_NODELETE = 32 } |
| enum class | Stmt_state { EXECUTE = 0 , SKIP = 1 , ERROR = 2 } |
Functions | |
| static const char * | get_primary_key_column_name (const Table_ref *table_ref) |
| Returns primary key name given table. More... | |
| static Field * | get_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_node * | prepare_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... | |
| static const char * | em_wrap (const char *arg) |
| static int | em_wrap (int arg) |
| static std::string | em_wrap (std::string_view sv) |
| Overload which wraps string_views in strings which are guaranteed to be null-terminated. More... | |
| static std::string | em_wrap (const Json_path &jp) |
| Overload which wraps Json_paths in strings, after first creating string representation in String buffer. More... | |
| static decltype(auto) | em_unwrap (auto arg) |
| Identity unwrapper. More... | |
| static const char * | em_unwrap (const std::string &str) |
| Overload which unwraps strings by calling c_str()-. More... | |
| template<int CODE, typename... Args> | |
| static void | my_jdv_error (Args... args_to_wrap) |
| Wraps calls to my_error() unwrapping wrapped arguments. More... | |
| template<typename JT > | |
| static JT * | inspect_valid_dom (Json_dom *valid_dom) |
| Inspects an assumed valid Json_dom (typically an exising value in UPDATE). More... | |
| template<typename JT > | |
| static std::pair< enum_json_type, JT * > | inspect_dom (Json_dom *dom) |
| Inspects a Json_dom which may or may not have the expected type and may also be nullptr, (typically a value provided as user input). More... | |
| static std::string | json_wrapper_to_string (const Json_wrapper &jw) |
| Formats a Json_wrapper as string for debugging. More... | |
| static std::string | json_dom_to_string (Json_dom *jdom) |
| Formats a Json_dom as string for debugging. More... | |
| static bool | is_nil_dom (Json_dom *jdom) |
| Predicate to determine if a dom does not represent a valid value i.e. More... | |
| static bool | is_auto_increment (const Field &fld) |
| Convenience wrapper predicate which returns true for AUTO_INCREMENT columns. More... | |
| static int | compare_doms (Json_dom *ajd, Json_dom *bjd) |
| Compares Json_dom pointers which may be nullptr by considering nullptrs to be greater than all non-nullptr values. More... | |
| static bool | expect_b64_dom (enum_field_types ft, const CHARSET_INFO &csi) |
| Predicate to determine if json dom is expected to be base64 encoded based on SQL type and charset-. More... | |
| static bool | col_expects_b64 (const Key_column_info &kci) |
| Predicate to determine if base column expects json values to be base64 encoded. More... | |
| static bool | append_b64_dom (std::string *sbufp, const String &buf, Json_dom *jd) |
| Converts base64 string to its binary representation, escapes this to be a string literal, wraps in single quotes, prepends character set introducer _binary before appending to statement. More... | |
| static bool | append_json_dom (std::string *sbufp, Json_dom *jd, bool b64=false) |
| Append a Json_dom to a string. More... | |
| static bool | do_in_substatement_context (THD *thd, auto &&f) |
| Sets up the environment for using Regular_statement_handle for JDVs. More... | |
| static Json_dom * | get_val (const Json_object *jo, std::string_view k) |
| Convenience function for obtaining the member of a Json_object. More... | |
| static bool | is_zero (Json_dom *doc) |
| Convenience function for comparing a Json document to unsigned 0. More... | |
| static bool | auto_generate_on_zero (THD *thd) |
| Convenience function for checking if the connection supports using 0 to request explicit generation of AUTO_INCREMENT values. More... | |
| static bool | field_will_be_auto_generated (THD *thd, const Field &fld, Json_dom *doc) |
| Convenience function which checks if a Json document value inserted in a field will result in a generated AUTO_INCREMENT value. More... | |
| static std::ostream & | operator<< (std::ostream &os, const Resolve_column &rc) |
| static std::ostream & | operator<< (std::ostream &os, const Resolve_row &rr) |
| template<typename BIN > | |
| static int | compare_bindings (const BIN &abin, const BIN &bbin) |
| Compares bindings based on: More... | |
| static std::ostream & | operator<< (std::ostream &os, const Single_object_binding &bin) |
| static Json_dom * | get_pk_dom (const Two_object_binding &bin) |
| Returns either the existing or the resolved pk value for a Two_object_binding. More... | |
| static std::ostream & | operator<< (std::ostream &os, const Two_object_binding &bin) |
| template<typename T > | |
| static int | operator<=> (const Index_entry< T > &a, const Index_entry< T > &b) |
| Spaceship operator which forwards to the indexed type. More... | |
| template<typename T > | |
| static bool | operator== (const Index_entry< T > &a, const Index_entry< T > &b) |
| Equality operator which forwards to the indexed type. More... | |
| static const TABLE_SHARE * | get_share (const auto &bin) |
| Convenience function which returns the TABLE_SHARE* for the binding. More... | |
| static std::string_view | get_table_cache_key (const auto &bin) |
| Convenience function which returns the table_cache_key of the binding as a std::string_view. More... | |
| template<typename RT , typename BIN > | |
| static Index< RT > | make_mr_index (THD *thd, BIN &bindings) |
| Create an index over the bindings vector which is allocated on THD::mem_root. More... | |
| static bool | resolve_column_range (const std::ranges::random_access_range auto &bindings) |
| Goes through the input json (bound_object) and uses the join condition to infer column values which are not provided explicitly. More... | |
| static bool | resolve_columns (const std::ranges::random_access_range auto &bindings) |
| Iterates over a range of bindings and initializes the resolve_columns vector. More... | |
| static Json_dom * | get_pk_dom (const Single_object_binding &bin) |
| Returns the resolved pk value for a Single_object binding. More... | |
| static const Resolve_column & | get_pk_rc (const auto &bin) |
| Returns a const ref to the Resolve_row of the primary key column. More... | |
| static int | get_deferred_resolve_weight (const auto &bin) |
| Returns an integer weight which allows sorting bindings with deferred_resolve for the primary key after non-generated values. More... | |
| template<typename BV > | |
| static bool | check_for_share_pk_duplicates (THD *thd, BV &bindings) |
| Creates an index over the bindings sorted on TABLE_SHARE* and pk-dom value. More... | |
| static void | merge_bindings_for_update (Index< Two_object_binding > &bindings) |
| Merges bindings for existing and input rows when doing UPDATE. More... | |
| static bool | check_for_unmatched_input_keys (THD *thd, Json_object *input_obj, const Content_tree_node &ct_node) |
| Check Json_object being passed in for keys which are not present in the JDV definition (including _metadata for the root object), and report error if that is the case. More... | |
| static bool | is_equal (Json_dom *ajd, Json_dom *bjd) |
| Compare Json_doms for equality using a Json_wrapper. More... | |
| static std::unique_ptr< Resolve_row > | make_rr_up (Resolve_row *parent) |
| Helper function to create unique_ptr to Resolve_row. More... | |
| static bool | push_object_child_bindings (std::size_t pbx, const Content_tree_node *child_ct_node, std::vector< Single_object_binding > *stack) |
| Overload for Single_object_binding (INSERT/DELETE) with Json_object (JSON_OBJECT). More... | |
| static bool | push_array_child_bindings (std::size_t pbx, const Content_tree_node *child_ct_node, std::vector< Single_object_binding > *stack) |
| Overload for Single_object_binding (INSERT/DELETE) with Json_array (JSON_ARRAYAGG). More... | |
| static bool | push_object_child_bindings (std::size_t pbx, const Content_tree_node *child_ct_node, std::vector< Two_object_binding > *stack) |
| Overload for Two_object_binding (UPDATE) with Json_object (JSON_OBJECT). More... | |
| static bool | push_array_child_bindings (std::size_t pbx, const Content_tree_node *child_ct_node, std::vector< Two_object_binding > *stack) |
| Overload for Two_object_binding (UPDATE) with Json_array (JSON_ARRAY_AGG). More... | |
| template<typename BIN > | |
| static bool | flatten (std::vector< BIN > *stack) |
| Takes a stack (std::vector) with a single binding at the top. More... | |
| static std::optional< std::vector< bool > > | select_diff_vector (THD *thd, const auto &binding) |
| Check if the row represented by the binding already exists, and if so return a diff vector (true for columns which currently does not have the value of the binding). More... | |
| static bool | run_substmt (THD *thd, Diagnostics_area *caller_da, std::string_view stmt, ulonglong *affected_rows) |
| Uses a Regular_statement_handle to execute a single statement passed as argument. More... | |
| static Stmt_state | make_insert (THD *thd, const auto &binding, auto *sbufp) |
| Produces an INSERT statement from a binding. More... | |
| static Stmt_state | make_delete (THD *, const Single_object_binding &binding, auto *sbufp) |
| Produces a delete statement from a Single_object_binding. More... | |
| static Json_dom * | etag_dom (Json_object *root_object) |
| Obtains the dom of the etag sub-object. More... | |
| static bool | check_etag (const Two_object_binding &binding) |
| Checks if etags in existing and bound objects match. More... | |
| static Stmt_state | make_update (THD *thd, const Two_object_binding &binding, auto *sbufp) |
| Produces an UPDATE statement from a Two_object_binding. More... | |
| static bool | check_input_json (Json_dom *input_dom) |
| static bool | jdv_handle_insert (THD *thd, Json_wrapper *jw, Content_tree_node *ct_node, ulonglong *affected_rows) |
| Creates bindings from inserted Json_object, orders them, creates and executes INSERT statements against the base tables. More... | |
| static bool | jdv_handle_update (THD *thd, Json_wrapper *jw, Json_wrapper *existing, Content_tree_node *ct_node, ulonglong *affected_rows) |
| Creates bindings from existing and updated Json_object, orders them, creates and executes UPDATE/INSERT/DELETE statements against the base tables. More... | |
| static bool | jdv_handle_delete (THD *thd, Json_wrapper *jw, Content_tree_node *ct_node, ulonglong *affected_rows) |
| Creates bindings from deleted Json_object, orders them, creates and executes DELETE statements against the base tables. More... | |
| static bool | jdv_prepare_base (THD *thd, const Table_ref *view, bool is_single_table_plan) |
| Performs common sanity checks. More... | |
| bool | jdv_prepare_insert (THD *thd, const Table_ref *view, Sql_cmd_insert_base *sql_insert_cmd) |
| Performs sanity checks specific to insert. More... | |
| bool | jdv_prepare_update (THD *thd, const Table_ref *view, bool is_single_table_plan) |
| Performs sanity checks specific to update. More... | |
| bool | jdv_prepare_delete (THD *thd, const Table_ref *view, bool is_single_table_plan) |
| Performs sanity checks specific to delete. More... | |
| static decltype(auto) | create_sctx_guard (THD *thd, const Table_ref *dvtr) |
| Installs the view's security context if it exists and creates a scope guard to restore the original context. More... | |
| static bool | write_binlog (THD *thd) |
| Performs statement-based binlogging for DML operations on a JSON Duality view. More... | |
| bool | jdv_insert (THD *thd, const Table_ref *dvtr, const mem_root_deque< List_item * > &values) |
| Entry point called from sql_insert.cc, bool Sql_cmd_insert_values::execute_inner(THD *thd);. More... | |
| bool | jdv_update (THD *thd, const Table_ref *dvtr, const mem_root_deque< Item * > *seldq, const mem_root_deque< Item * > *upddq, ulonglong *affected_rows) |
| Entry point called from sql_update.cc bool Sql_cmd_update::update_single_table(THD *thd);. More... | |
| bool | jdv_delete (THD *thd, const Table_ref *dvtr, ulonglong *affected_rows) |
| 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... | |
| const char * | str (const Content_tree_node::Type &ctnt) |
| std::ostream & | operator<< (std::ostream &os, const Content_tree_node &ctn) |
| std::ostream & | operator<< (std::ostream &os, const Key_column_info &kci) |
| std::string | path_str (const Json_dom *doc) |
| decltype(auto) | func_or (auto *p, auto f, auto val) |
| 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 | |
| static thread_local uint | next_id = 0 |
| constexpr std::size_t | VOID_COLUMN_INDEX |
| static constexpr std::string_view | metadatakey = "_metadata" |
| static constexpr std::string_view | etagkey = "etag" |
| constexpr Size_first_comparator | size_less |
| static constexpr std::string_view | TYPE_HEADER_PREFIX = "base64:type" |
| static constexpr std::size_t | TYPE_HEADER_MAXSZ |
| static constexpr auto | ERROR_INDICATOR = static_cast<std::size_t>(-1) |
| static Json_uint | ZERO {0} |
| Reusable object to simplify comparisons against uint 0 (explicit generation request) More... | |
| static const Json_wrapper | ZEROW {&ZERO, true} |
| Reusable Json_wrapper around ZERO object to simplify comparisons against uint 0 (explicit generation request) More... | |
| template<typename T > | |
| static auto | unwrap_index_entry |
| Lambda object to unwrap an index entry. More... | |
| static auto | share_pk_less |
| Less comparator which compares Index_entry objects based on their TABLE_SHARE and primary key column value. More... | |
| constexpr std::size_t | STMT_RESERVE_SIZE = 512 |
| constexpr std::size_t | BINDINGS_RESERVE_SIZE = 48 |
| using jdv::Index = typedef std::span<Index_entry<T> > |
Convenience alias.
| using jdv::Index_entry = typedef std::reference_wrapper<T> |
Convenience alias.
| using jdv::Resolve_column_vec = typedef std::vector<Resolve_column> |
| enum jdv::Duality_view_tags : int |
|
strong |
Converts base64 string to its binary representation, escapes this to be a string literal, wraps in single quotes, prepends character set introducer _binary before appending to statement.
Checks to see if input is valid base64.
| sbufp | statement buffer |
| buf | string representation of dom |
| jd | dom (for error reporting) |
| 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.
| 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.
|
static |
Append a Json_dom to a string.
If the Json_dom pointer is nullptr 'DEFAULT' is appended. If the json type is J_NULL, 'NULL' is appended. For numeric values the bare to_string value is appended. For other non-base64 types the to_string value is quote escaped and wrapped in single quotes with the character set introducer _utf8mb4.
If the base table column returns values as base64 the raw string representation of the dom is expected to be a type header followed by a base64 encoded payload. This is handled by append_b64_dom().
| sbufp | statement buffer |
| jd | dom to convert to string and append |
| b64 | true if resulting string is expected to be base64 encoded |
|
static |
Convenience function for checking if the connection supports using 0 to request explicit generation of AUTO_INCREMENT values.
| thd | THD |
|
static |
Checks if etags in existing and bound objects match.
Succeeds with warning if etag is not provided in bound object.
| binding | root binding |
|
static |
Creates an index over the bindings sorted on TABLE_SHARE* and pk-dom value.
Verifies that duplicates are identical for all columns and marks it as empty. Otherwise reports error.
| thd | THD |
| bindings | bindings vector |
|
static |
Check Json_object being passed in for keys which are not present in the JDV definition (including _metadata for the root object), and report error if that is the case.
| thd | Thread handle. |
| input_obj | input object |
| ct_node | jdv definition |
|
static |
|
static |
Predicate to determine if base column expects json values to be base64 encoded.
| kci | base table column |
|
static |
Compares bindings based on:
| abin | lhs |
| bbin | rhs |
Compares Json_dom pointers which may be nullptr by considering nullptrs to be greater than all non-nullptr values.
This convention is chosen so that sorting with {compare_doms(a,b) < 0} places nullptr entries last (the assumption being that searches into the sorted range most often are for a non-nullptr elements).
| ajd | lhs |
| bjd | rhs |
Installs the view's security context if it exists and creates a scope guard to restore the original context.
| thd | THD |
| dvtr | duality view reference |
| void jdv::destroy_content_tree | ( | Content_tree_node * | root | ) |
Deletes the content tree for given JSON duality view.
| [in] | root | Root object of content tree |
|
static |
Sets up the environment for using Regular_statement_handle for JDVs.
The creation and usage of the Regular_statement_handle is done in the callable F passed in which returns true to indicate errors. The caller DA is passed as an argument to F. The callable f is responsible for copying information back to caller_da if/when needed.
| thd | THD |
| f | callable to invoke |
|
static |
Identity unwrapper.
| arg | argument to return |
|
static |
Overload which unwraps strings by calling c_str()-.
| str | string to call c_str() on |
|
static |
|
static |
Overload which wraps Json_paths in strings, after first creating string representation in String buffer.
This allows passing Json_paths directly to error message function as const char *without having to worry about ownership.
| jp | Json_path to wrap |
|
static |
|
static |
Overload which wraps string_views in strings which are guaranteed to be null-terminated.
| sv | string view to wrap. |
|
static |
Obtains the dom of the etag sub-object.
| root_object | containing the etag sub-object |
|
static |
Predicate to determine if json dom is expected to be base64 encoded based on SQL type and charset-.
| ft | actual field type |
| csi | character set object |
|
static |
Convenience function which checks if a Json document value inserted in a field will result in a generated AUTO_INCREMENT value.
| thd | THD |
| fld | Field object describing column |
| doc | Json_dom value to insert |
|
static |
Takes a stack (std::vector) with a single binding at the top.
Creates bindings for all the children of that binding by combining each Json child with the corresponding CTN child and place these on the stack. Proceeds with the next element now on the stack. When there are no more element left on the stack the process is complete and the stack contains a flattened sequence of bindings for each Json_object in the input which corresponds to a jdv::Content_tree_node. This flattened sequence can then be sorted and traversed in either direction as needed when generating statements for the base tables.
| stack | binding stack |
| decltype(auto) jdv::func_or | ( | auto * | p, |
| auto | f, | ||
| auto | val | ||
| ) |
|
static |
Returns an integer weight which allows sorting bindings with deferred_resolve for the primary key after non-generated values.
| bin | Binding |
|
static |
Get the field instance of a column.
| [in] | table_ref | Table_ref instance of a table. |
| [in] | fld_name | Field name. |
| 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.
| root | Content tree root. |
| i_s_view_name | Name of the I_S view. |
| properties | String containing the requested properties. |
|
static |
Returns the resolved pk value for a Single_object binding.
| bin | binding to get pk dom for |
|
static |
Returns either the existing or the resolved pk value for a Two_object_binding.
| bin | binding to get pk dom for |
|
static |
Returns a const ref to the Resolve_row of the primary key column.
| bin | Binding |
|
static |
Returns primary key name given table.
| [in] | table_ref | Table_ref instance of a table. current THD |
|
static |
Convenience function which returns the TABLE_SHARE* for the binding.
| bin | binding |
|
static |
Convenience function which returns the table_cache_key of the binding as a std::string_view.
| bin | binding |
|
static |
Convenience function for obtaining the member of a Json_object.
Returns nullptr if the Json_object argument is nullptr or does not have the requested key.
|
static |
Inspects a Json_dom which may or may not have the expected type and may also be nullptr, (typically a value provided as user input).
Returns {J_NULL,nullptr} if the argument is nullptr or has type J_NULL. Returns {J_ERROR, nullptr} if the argument does not have type JT. Otherwise returns {enum_json_type of JT, argument cast to JT*}.
| JT | the expected actual type of the argument |
| dom | dom that may not have the expected type |
|
static |
Inspects an assumed valid Json_dom (typically an exising value in UPDATE).
Returns nullptr if the argument is nullptr or has type J_NULL. Otherwise returns the dom cast JT*. Asserts if the type is not JT.
| JT | the expected actual type of the argument |
| valid_dom | assumed valid Json_dom |
|
static |
Convenience wrapper predicate which returns true for AUTO_INCREMENT columns.
| fld | column to report for. |
|
static |
Performs validation of below semantic rules:
| [in] | node | current node of metadata tree |
| true | in case if unsupported column is projected |
Compare Json_doms for equality using a Json_wrapper.
| ajd | left-hand side of comparison |
| bjd | right-hand side of comparison |
|
static |
Predicate to determine if a dom does not represent a valid value i.e.
that either the pointer itself is nullptr, or that the dom is a Json_null (has type enum_json_type::J_NULL).
| jdom | dom to check |
Check if duality view prepared is required.
| thd | Thread handle. |
| table_ref | Table_ref* object for given JSON duality view. |
|
static |
Convenience function for comparing a Json document to unsigned 0.
| doc | Json document to test |
Entry point called from sql_delete.cc, bool Sql_cmd_delete::delete_from_single_table(THD *thd);.
| thd | THD | |
| dvtr | duality view | |
| [out] | affected_rows | Number of affected rows. |
|
static |
Creates bindings from deleted Json_object, orders them, creates and executes DELETE statements against the base tables.
| thd | THD | |
| jw | existing JSON object to delete | |
| ct_node | content tree root node | |
| [out] | affected_rows | affected base table rows |
|
static |
Creates bindings from inserted Json_object, orders them, creates and executes INSERT statements against the base tables.
| thd | THD | |
| jw | JSON object to insert | |
| ct_node | content tree root node of view | |
| [out] | affected_rows | number of affected base table rows |
|
static |
Creates bindings from existing and updated Json_object, orders them, creates and executes UPDATE/INSERT/DELETE statements against the base tables.
| thd | THD | |
| jw | updated JSON object | |
| existing | existing JSON object | |
| ct_node | content tree root node | |
| [out] | affected_rows | affected base table rows |
| bool jdv::jdv_insert | ( | THD * | thd, |
| const Table_ref * | dvtr, | ||
| const mem_root_deque< List_item * > & | values | ||
| ) |
Entry point called from sql_insert.cc, bool Sql_cmd_insert_values::execute_inner(THD *thd);.
| thd | Thread handle. |
| dvtr | Table_ref instance of a duality view. |
| values | Values. |
|
static |
Performs common sanity checks.
| thd | THD |
| view | JDV to check |
| is_single_table_plan | true if single table plan |
Performs sanity checks specific to delete.
| thd | THD |
| view | JDV to check |
| is_single_table_plan | true if single table plan |
| bool jdv::jdv_prepare_insert | ( | THD * | thd, |
| const Table_ref * | view, | ||
| Sql_cmd_insert_base * | sql_insert_cmd | ||
| ) |
Performs sanity checks specific to insert.
| thd | THD |
| view | JDV to check |
| sql_insert_cmd | insert command object |
Performs sanity checks specific to update.
| thd | THD |
| view | JDV to check |
| is_single_table_plan | true if single table plan |
| bool jdv::jdv_update | ( | THD * | thd, |
| const Table_ref * | dvtr, | ||
| const mem_root_deque< Item * > * | seldq, | ||
| const mem_root_deque< Item * > * | upddq, | ||
| ulonglong * | affected_rows | ||
| ) |
Entry point called from sql_update.cc bool Sql_cmd_update::update_single_table(THD *thd);.
| thd | THD | |
| dvtr | duality view | |
| seldq | selected items | |
| upddq | updated items | |
| [out] | affected_rows | Number of affected rows. |
|
static |
Formats a Json_dom as string for debugging.
| jdom | Json_dom to format |
|
static |
Formats a Json_wrapper as string for debugging.
| jw | Json_wrapper to format |
|
static |
Produces a delete statement from a Single_object_binding.
When an update decays into a DELETE, this function is called a with a Single_object_binding created on the fly from the Two_object_binding - which is only possible because DELETE does not require a populated resolve_row.
| binding | deletee |
| sbufp | statement text buffer |
|
static |
Produces an INSERT statement from a binding.
For INSERT this is a Single_object_binding, but when an update decays into an INSERT, this function is also invoked with a Two_object_binding.
| thd | THD |
| binding | insertee |
| sbufp | statement text buffer |
|
static |
Create an index over the bindings vector which is allocated on THD::mem_root.
The index is a span over the memory buffer allocated on the mem_root.
| thd | THD |
| bindings | vector of bindings |
|
static |
Helper function to create unique_ptr to Resolve_row.
(On mac std::make_unique() does not do init-list initialization).
| parent | parent |
|
static |
Produces an UPDATE statement from a Two_object_binding.
If there is no existing object an INSERT is generated. If there is no bound object a DELETE statement is generated.
| thd | THD |
| binding | updatee |
| sbufp | statement text buffer |
|
static |
Apply duality view create rules.
| [in] | node | current object of metadata tree |
| [in,out] | table_columns_map | map of table name to column projections |
| true | in case of success, false in case of failure |
|
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.
| [in] | node | Current content tree node. |
| true | in case of success, false in case of failure. |
|
static |
Merges bindings for existing and input rows when doing UPDATE.
This cannot be done when binding as the pk value for the input row may not be known until after resolving.
| bindings | Binding index to merge |
|
static |
Wraps calls to my_error() unwrapping wrapped arguments.
| CODE | error code to report |
| args_to_wrap | arguments for format specifiers in error message |
| std::ostream & jdv::operator<< | ( | std::ostream & | os, |
| const Content_tree_node & | ctn | ||
| ) |
| std::ostream & jdv::operator<< | ( | std::ostream & | os, |
| const Key_column_info & | kci | ||
| ) |
|
static |
|
static |
|
static |
|
static |
|
static |
Spaceship operator which forwards to the indexed type.
|
static |
Equality operator which forwards to the indexed type.
| std::string jdv::path_str | ( | const Json_dom * | doc | ) |
Performs Syntax validation, parepares metadata tree and performs Semantic validation of a given JSON DUALITY VIEW.
| [in] | thd | Current THD object |
| [in,out] | table_ref | Table_ref* object for given JSON DUALITY VIEW |
| false | in case of success, true in case of failure |
| Content_tree_node * jdv::prepare_content_tree | ( | THD * | thd, |
| LEX * | view_lex | ||
| ) |
Constructs the content tree for given JSON duality view.
| [in] | thd | THD context. |
| [in] | view_lex | LEX* object for the current query |
|
static |
|
static |
Helper function to prepare join condition for sub-object.
| thd | Thread Handle. |
| sl | Sub-object's query block. |
| node | Content tree node for a sub-object. |
|
static |
Overload for Single_object_binding (INSERT/DELETE) with Json_array (JSON_ARRAYAGG).
The Json_array* argument is used as tag for choosing the correct overload, (instead of creating a separate tag type).
| pbx | parent binding index |
| child_ct_node | child content tree node |
| stack | binding stack |
|
static |
Overload for Two_object_binding (UPDATE) with Json_array (JSON_ARRAY_AGG).
The Json_array* argument is used as tag for choosing the correct overload, (instead of creating a separate tag type).
| pbx | parent binding index |
| child_ct_node | child content tree node |
| stack | binding stack |
|
static |
Overload for Single_object_binding (INSERT/DELETE) with Json_object (JSON_OBJECT).
The Json_object* argument is used as tag for choosing the correct overload, (instead of creating a separate tag type).
| pbx | parent binding index |
| child_ct_node | child content tree node |
| stack | binding stack |
|
static |
Overload for Two_object_binding (UPDATE) with Json_object (JSON_OBJECT).
The Json_object* argument is used as tag for choosing the correct overload, (instead of creating a separate tag type).
| pbx | parent binding index |
| child_ct_node | child content tree node |
| stack | binding stack |
|
static |
Goes through the input json (bound_object) and uses the join condition to infer column values which are not provided explicitly.
Reports error if the values provided in the input do not match what is expressed by the join condition.
| bindings | range of bindings |
|
static |
Iterates over a range of bindings and initializes the resolve_columns vector.
Then calls resolve_range to do the actual resolving.
| bindings | vector of bindings |
|
static |
Uses a Regular_statement_handle to execute a single statement passed as argument.
| thd | THD | |
| caller_da | DA in which to accumulate diagnostics | |
| stmt | statement text | |
| [out] | affected_rows | Number of affected rows. |
|
static |
Check if the row represented by the binding already exists, and if so return a diff vector (true for columns which currently does not have the value of the binding).
This function can only be called when already inside do_in_substatement_context().
| thd | THD |
| binding | checkee |
|
static |
Helper function to set join column index for a given node.
| child_node | Content_tree_node object representing the current node |
| parent_node | Content_tree_node object representing the parent node |
| side_ident | Item_ident object representing one side of equality condition |
| is_parent | specifies whether current node is to be processed or parent |
| const char * jdv::str | ( | const Content_tree_node::Type & | ctnt | ) |
|
static |
Performs semantic validation of a given JSON DUALITY VIEW.
| [in] | root | Object of metadata tree |
| [in,out] | table_columns_map | map of table name to column projections |
| false | in case of success, true in case of failure |
|
static |
Performs syntax validation of a given JSON DUALITY VIEW.
| [in] | thd | Current THD object |
| [in] | qe | Root object of metadata tree |
| [in] | object_name | key name for sub-objects, "Root Node" for root node |
| [in] | root_query | does given qe represent root query expression? |
| false | in case of success, true in case of failure |
|
static |
Performs statement-based binlogging for DML operations on a JSON Duality view.
| thd | THD |
|
constexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
static |
Less comparator which compares Index_entry objects based on their TABLE_SHARE and primary key column value.
|
constexpr |
|
constexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
Lambda object to unwrap an index entry.
Useful to create transform_views or use as projection in algorithms.
|
constexpr |
|
static |
Reusable object to simplify comparisons against uint 0 (explicit generation request)
|
static |
Reusable Json_wrapper around ZERO object to simplify comparisons against uint 0 (explicit generation request)