MySQL  8.0.17
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:
Create_field

Public Member Functions

 Json_table_column (enum_jt_column type)
 
 Json_table_column (enum_jt_column col_type, const LEX_STRING &path, enum_jtc_on on_err, const LEX_STRING error_def, enum_jtc_on on_miss, const LEX_STRING &missing_def)
 
 Json_table_column (LEX_STRING path, List< Json_table_column > *cols)
 
void cleanup ()
 
bool fill_column (Field *fld, jt_skip_reason *skip)
 Process JSON_TABLE's 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 maybe_null, 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, 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, Nullable< 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...
 
enum_jtc_on m_on_error {enum_jtc_on::JTO_IMPLICIT}
 Type of ON ERROR clause. More...
 
enum_jtc_on m_on_empty {enum_jtc_on::JTO_IMPLICIT}
 Type of ON EMPTY clause. More...
 
LEX_STRING m_default_empty_str
 Default value string for ON EMPTY clause. More...
 
Json_wrapper m_default_empty_json
 Parsed JSON for default value of ON MISSING clause. More...
 
LEX_STRING m_default_error_str
 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
 List of nested columns, valid only for NESTED PATH. More...
 
LEX_STRING m_path_str
 Nested path. More...
 
Json_path m_path_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
 
LEX_CSTRING comment
 
Itemconstant_default
 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...
 
TYPELIBinterval
 
List< Stringinterval_list
 
const CHARSET_INFOcharset
 
bool is_explicit_collation
 
Field::geometry_type geom_type
 
Fieldfield
 
uint offset
 
bool maybe_null
 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...
 
Nullable< gis::srid_tm_srid
 
bool is_array {false}
 

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)
inline

◆ Json_table_column() [2/3]

Json_table_column::Json_table_column ( enum_jt_column  col_type,
const LEX_STRING path,
enum_jtc_on  on_err,
const LEX_STRING  error_def,
enum_jtc_on  on_miss,
const LEX_STRING missing_def 
)
inline

◆ Json_table_column() [3/3]

Json_table_column::Json_table_column ( LEX_STRING  path,
List< Json_table_column > *  cols 
)
inline

Member Function Documentation

◆ cleanup()

void Json_table_column::cleanup ( void  )

◆ fill_column()

bool Json_table_column::fill_column ( Field fld,
jt_skip_reason skip 
)

Process JSON_TABLE's column.

Fill a json table column.

Parameters
fldfield to save data to, if applicable, NULL otherwise
[out]skipwhether current NESTED PATH column should be completely skipped
Returns
true on error false on success

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.

Parameters
[in]fldColumn's field to save data to
[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
Returns
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_str

LEX_STRING Json_table_column::m_default_empty_str

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_str

LEX_STRING Json_table_column::m_default_error_str

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

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

enum_jtc_on Json_table_column::m_on_empty {enum_jtc_on::JTO_IMPLICIT}

Type of ON EMPTY clause.

◆ m_on_error

enum_jtc_on Json_table_column::m_on_error {enum_jtc_on::JTO_IMPLICIT}

Type of ON ERROR clause.

◆ m_path_json

Json_path Json_table_column::m_path_json

parsed nested path

◆ m_path_str

LEX_STRING Json_table_column::m_path_str

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: