MySQL 8.4.0
Source Code Documentation
Json_table_column Class Reference

Column description for JSON_TABLE function. More...

#include <table_function.h>

Inheritance diagram for Json_table_column:

Public Member Functions

 Json_table_column (enum_jt_column type)
 Json_table_column (enum_jt_column col_type, Item *path, Json_on_response_type on_err, Item *error_default, Json_on_response_type on_miss, Item *missing_default)
 Json_table_column (Item *path, List< Json_table_column > *cols)
 ~Json_table_column ()
void cleanup ()
bool fill_column (Table_function_json *table_function, jt_skip_reason *skip)
 Fill a json table column. More...
- Public Member Functions inherited from Create_field
size_t max_display_width_in_codepoints () const
size_t max_display_width_in_bytes () const
size_t pack_length (bool dont_override=false) const
size_t key_length () const
bool explicit_display_width () const
void set_max_display_width_from_create_field (const Create_field &create_field)
 Set the maximum display width based on another Create_field. More...
 Create_field ()
 Create_field (Field *field, Field *orig_field)
 Constructs a column definition from an object representing an actual column. More...
Create_fieldclone (MEM_ROOT *mem_root) const
bool is_gcol () const
bool is_virtual_gcol () const
void init_for_tmp_table (enum_field_types sql_type_arg, uint32 max_length, uint32 decimals, bool is_nullable, bool is_unsigned, uint pack_length_override, const char *field_name="")
 Init for a tmp table field. More...
bool init (THD *thd, const char *field_name, enum_field_types type, const char *length, const char *decimals, uint type_modifier, Item *default_value, Item *on_update_value, const LEX_CSTRING *comment, const char *change, List< String > *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, uint uint_geom_type, Value_generator *gcol_info, Value_generator *default_val_expr, std::optional< gis::srid_t > srid, dd::Column::enum_hidden_type hidden, bool is_array=false)
 Initialize a column definition object. More...
ha_storage_media field_storage_type () const
column_format_type column_format () const

Public Attributes

enum_jt_column m_jtc_type
 Column type. More...
Json_on_response_type m_on_error {Json_on_response_type::IMPLICIT}
 Type of ON ERROR clause. More...
Json_on_response_type m_on_empty {Json_on_response_type::IMPLICIT}
 Type of ON EMPTY clause. More...
Itemm_default_empty_string {nullptr}
 Default value string for ON EMPTY clause. More...
Json_wrapper m_default_empty_json
 Parsed JSON for default value of ON MISSING clause. More...
Itemm_default_error_string {nullptr}
 Default value string for ON ERROR clause. More...
Json_wrapper m_default_error_json
 Parsed JSON string for ON ERROR clause. More...
List< Json_table_column > * m_nested_columns {nullptr}
 List of nested columns, valid only for NESTED PATH. More...
Itemm_path_string {nullptr}
 Nested path. More...
Json_path m_path_json {key_memory_JSON}
 parsed nested path More...
JT_data_sourcem_jds_elt {nullptr}
 An element in table function's data source array. More...
JT_data_sourcem_child_jds_elt {nullptr}
 Element in table function's data source array to feed data to child nodes. More...
Json_table_columnm_next_nested {nullptr}
 Next sibling NESTED PATH. More...
Json_table_columnm_prev_nested {nullptr}
 Previous sibling NESTED PATH. More...
int m_field_idx {-1}
 Index of field in the result table. More...
- Public Attributes inherited from Create_field
dd::Column::enum_hidden_type hidden
const char * field_name
const char * change
 Name of column modified by ALTER TABLE's CHANGE/MODIFY COLUMN clauses, NULL for columns added. More...
const char * after {nullptr}
 The declared default value, if any, otherwise NULL. More...
enum_field_types sql_type
uint decimals
uint flags {0}
uchar auto_flags {Field::NONE}
 Bitmap of flags indicating if field value should be auto-generated by default and/or on update, and in which way. More...
List< Stringinterval_list
const CHARSET_INFOcharset
bool is_explicit_collation
Field::geometry_type geom_type
uint offset
bool is_nullable
 Indicate whether column is nullable, zerofill or unsigned. More...
bool is_zerofill
bool is_unsigned
bool treat_bit_as_char
 Indicates that storage engine doesn't support optimized BIT field storage. More...
uint pack_length_override {0}
 Row based replication code sometimes needs to create ENUM and SET fields with pack length which doesn't correspond to number of elements in interval TYPELIB. More...
Value_generatorgcol_info {nullptr}
bool stored_in_db
Value_generatorm_default_val_expr {nullptr}
 Holds the expression to be used to generate default values. More...
std::optional< gis::srid_tm_srid
bool is_array {false}
LEX_CSTRING m_engine_attribute = EMPTY_CSTR
LEX_CSTRING m_secondary_engine_attribute = EMPTY_CSTR

Detailed Description

Column description for JSON_TABLE function.

Constructor & Destructor Documentation

◆ Json_table_column() [1/3]

Json_table_column::Json_table_column ( enum_jt_column  type)

◆ Json_table_column() [2/3]

Json_table_column::Json_table_column ( enum_jt_column  col_type,
Item path,
Json_on_response_type  on_err,
Item error_default,
Json_on_response_type  on_miss,
Item missing_default 

◆ Json_table_column() [3/3]

Json_table_column::Json_table_column ( Item path,
List< Json_table_column > *  cols 

◆ ~Json_table_column()

Json_table_column::~Json_table_column ( )

Member Function Documentation

◆ cleanup()

void Json_table_column::cleanup ( void  )

◆ fill_column()

bool Json_table_column::fill_column ( Table_function_json table_function,
jt_skip_reason skip 

Fill a json table column.

Fills a column with data, according to specification in JSON_TABLE. This function handles all kinds of columns: Ordinality) just saves the counter into the column's field Path) extracts value, saves it to the column's field and handles ON ERROR/ON EMPTY clauses Exists) checks the path existence and saves either 1 or 0 into result field Nested path) matches the path expression against data source. If there're matches, this function sets NESTED PATH's iterator over those matches and resets ordinality counter.

[in]table_functionthe JSON table function
[out]skiptrue <=> it's a NESTED PATH node and its path expression didn't return any matches or a previous sibling NESTED PATH clause still producing records, thus all columns of this NESTED PATH node should be skipped
false column is filled true an error occurred, execution should be stopped

Member Data Documentation

◆ m_child_jds_elt

JT_data_source* Json_table_column::m_child_jds_elt {nullptr}

Element in table function's data source array to feed data to child nodes.

Valid only for NESTED PATH.

◆ m_default_empty_json

Json_wrapper Json_table_column::m_default_empty_json

Parsed JSON for default value of ON MISSING clause.

◆ m_default_empty_string

Item* Json_table_column::m_default_empty_string {nullptr}

Default value string for ON EMPTY clause.

◆ m_default_error_json

Json_wrapper Json_table_column::m_default_error_json

Parsed JSON string for ON ERROR clause.

◆ m_default_error_string

Item* Json_table_column::m_default_error_string {nullptr}

Default value string for ON ERROR clause.

◆ m_field_idx

int Json_table_column::m_field_idx {-1}

Index of field in the result table.

◆ m_jds_elt

JT_data_source* Json_table_column::m_jds_elt {nullptr}

An element in table function's data source array.

◆ m_jtc_type

enum_jt_column Json_table_column::m_jtc_type

Column type.

◆ m_nested_columns

List<Json_table_column>* Json_table_column::m_nested_columns {nullptr}

List of nested columns, valid only for NESTED PATH.

◆ m_next_nested

Json_table_column* Json_table_column::m_next_nested {nullptr}

Next sibling NESTED PATH.

◆ m_on_empty

Json_on_response_type Json_table_column::m_on_empty {Json_on_response_type::IMPLICIT}

Type of ON EMPTY clause.

◆ m_on_error

Json_on_response_type Json_table_column::m_on_error {Json_on_response_type::IMPLICIT}

Type of ON ERROR clause.

◆ m_path_json

Json_path Json_table_column::m_path_json {key_memory_JSON}

parsed nested path

◆ m_path_string

Item* Json_table_column::m_path_string {nullptr}

Nested path.

◆ m_prev_nested

Json_table_column* Json_table_column::m_prev_nested {nullptr}

Previous sibling NESTED PATH.

The documentation for this class was generated from the following files: