| 9142 | */ |
| 9143 | |
| 9144 | TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) |
| 9145 | { |
| 9146 | uint field_count= 0; |
| 9147 | TABLE *table; |
| 9148 | ST_SCHEMA_TABLE *schema_table= table_list->schema_table; |
| 9149 | ST_FIELD_INFO *fields= schema_table->fields_info; |
| 9150 | bool need_all_fields= table_list->schema_table_reformed || // SHOW command |
| 9151 | thd->lex->only_view_structure(); // need table structure |
| 9152 | bool keep_row_order; |
| 9153 | TMP_TABLE_PARAM *tmp_table_param; |
| 9154 | SELECT_LEX *select_lex; |
| 9155 | DBUG_ENTER("create_schema_table"); |
| 9156 | |
| 9157 | for (; !fields->end_marker(); fields++) |
| 9158 | field_count++; |
| 9159 | |
| 9160 | tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM; |
| 9161 | tmp_table_param->init(); |
| 9162 | tmp_table_param->table_charset= system_charset_info_for_i_s; |
| 9163 | tmp_table_param->field_count= field_count; |
| 9164 | tmp_table_param->schema_table= 1; |
| 9165 | select_lex= table_list->select_lex; |
| 9166 | keep_row_order= is_show_command(thd); |
| 9167 | if (!(table= |
| 9168 | create_tmp_table_for_schema(thd, tmp_table_param, *schema_table, |
| 9169 | (select_lex->options | |
| 9170 | thd->variables.option_bits | |
| 9171 | TMP_TABLE_ALL_COLUMNS), |
| 9172 | table_list->alias, !need_all_fields, |
| 9173 | keep_row_order))) |
| 9174 | DBUG_RETURN(0); |
| 9175 | my_bitmap_map* bitmaps= |
| 9176 | (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count)); |
| 9177 | my_bitmap_init(&table->def_read_set, bitmaps, field_count); |
| 9178 | table->read_set= &table->def_read_set; |
| 9179 | bitmap_clear_all(table->read_set); |
| 9180 | table_list->schema_table_param= tmp_table_param; |
| 9181 | DBUG_RETURN(table); |
| 9182 | } |
| 9183 | |
| 9184 | |
| 9185 | #ifdef HAVE_REPLICATION |
no test coverage detected