MCPcopy Create free account
hub / github.com/MariaDB/server / add_table_options

Function add_table_options

sql/sql_show.cc:2012–2177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2010*/
2011
2012static void add_table_options(THD *thd, TABLE *table,
2013 Table_specification_st *create_info_arg,
2014 bool schema_table, bool sequence,
2015 String *packet)
2016{
2017 sql_mode_t sql_mode= thd->variables.sql_mode;
2018 TABLE_SHARE *share= table->s;
2019 handlerton *hton;
2020 HA_CREATE_INFO create_info;
2021 bool check_options= (!(sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
2022 (!create_info_arg ||
2023 create_info_arg->used_fields &
2024 HA_CREATE_PRINT_ALL_OPTIONS));
2025
2026#ifdef WITH_PARTITION_STORAGE_ENGINE
2027 if (table->part_info)
2028 hton= table->part_info->default_engine_type;
2029 else
2030#endif
2031 hton= table->file->storage_ht();
2032
2033 bzero((char*) &create_info, sizeof(create_info));
2034 /* Allow update_create_info to update row type, page checksums and options */
2035 create_info.row_type= share->row_type;
2036 create_info.page_checksum= share->page_checksum;
2037 create_info.options= share->db_create_options;
2038 table->file->update_create_info(&create_info);
2039
2040 /*
2041 IF check_create_info
2042 THEN add ENGINE only if it was used when creating the table
2043 */
2044 if (!create_info_arg ||
2045 (create_info_arg->used_fields & HA_CREATE_USED_ENGINE))
2046 {
2047 LEX_CSTRING *engine_name= table->file->engine_name();
2048
2049 if (sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
2050 packet->append(STRING_WITH_LEN(" TYPE="));
2051 else
2052 packet->append(STRING_WITH_LEN(" ENGINE="));
2053
2054 packet->append(engine_name->str, engine_name->length);
2055 }
2056
2057 if (sequence)
2058 goto end_options;
2059
2060 /*
2061 Add AUTO_INCREMENT=... if there is an AUTO_INCREMENT column,
2062 and NEXT_ID > 1 (the default). We must not print the clause
2063 for engines that do not support this as it would break the
2064 import of dumps, but as of this writing, the test for whether
2065 AUTO_INCREMENT columns are allowed and wether AUTO_INCREMENT=...
2066 is supported is identical, !(file->table_flags() & HA_NO_AUTO_INCREMENT))
2067 Because of that, we do not explicitly test for the feature,
2068 but may extrapolate its existence from that of an AUTO_INCREMENT column.
2069 */

Callers 2

show_create_table_exFunction · 0.85
show_create_sequenceFunction · 0.85

Calls 12

CharsetClass · 0.85
append_unescapedFunction · 0.85
append_create_optionsFunction · 0.85
append_directoryFunction · 0.85
storage_htMethod · 0.45
update_create_infoMethod · 0.45
engine_nameMethod · 0.45
appendMethod · 0.45
append_ulonglongMethod · 0.45
append_create_infoMethod · 0.45

Tested by

no test coverage detected