diff options
author | Monty <monty@mariadb.org> | 2018-02-10 14:42:59 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-02-10 14:42:59 +0200 |
commit | a610badb5daf33cffd7a85822d2712eb0beee7b6 (patch) | |
tree | 1cd5819fd1eaf69adcd2ee9669ce304214b945cb /sql | |
parent | a801ba5ce6bda1c2dee41724307bf59f244dda14 (diff) | |
download | mariadb-git-bb-10.2-ext2.tar.gz |
Added Max_index_length and Temporary to SHOW TABLE STATUSbb-10.2-ext2
- Max_index_length is supported by MyISAM and Aria tables.
- Temporary is a placeholder to signal that a table is a
temporary table. For the moment this is always "N", except
"Y" for generated information_schema tables and NULL for
views. Full temporary table support will be done in another task.
(No reason to have to update a lot of result files twice in a row)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 1 | ||||
-rw-r--r-- | sql/handler.cc | 1 | ||||
-rw-r--r-- | sql/handler.h | 8 | ||||
-rw-r--r-- | sql/sql_show.cc | 17 |
4 files changed, 23 insertions, 4 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e0e4418ab22..f0cb7fead66 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -6798,6 +6798,7 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, stat_info->data_file_length= file->stats.data_file_length; stat_info->max_data_file_length= file->stats.max_data_file_length; stat_info->index_file_length= file->stats.index_file_length; + stat_info->max_index_file_length= file->stats.max_index_file_length; stat_info->delete_length= file->stats.delete_length; stat_info->create_time= file->stats.create_time; stat_info->update_time= file->stats.update_time; diff --git a/sql/handler.cc b/sql/handler.cc index a7b92fcc769..9148d9a65f2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4686,6 +4686,7 @@ void handler::get_dynamic_partition_info(PARTITION_STATS *stat_info, stat_info->data_file_length= stats.data_file_length; stat_info->max_data_file_length= stats.max_data_file_length; stat_info->index_file_length= stats.index_file_length; + stat_info->max_index_file_length=stats.max_index_file_length; stat_info->delete_length= stats.delete_length; stat_info->create_time= stats.create_time; stat_info->update_time= stats.update_time; diff --git a/sql/handler.h b/sql/handler.h index 38fe44b8ccd..3b5ce46c878 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1632,6 +1632,7 @@ typedef struct { ulonglong data_file_length; ulonglong max_data_file_length; ulonglong index_file_length; + ulonglong max_index_file_length; ulonglong delete_length; ha_rows records; ulong mean_rec_length; @@ -2581,9 +2582,10 @@ public: ha_statistics(): data_file_length(0), max_data_file_length(0), - index_file_length(0), delete_length(0), auto_increment_value(0), - records(0), deleted(0), mean_rec_length(0), create_time(0), - check_time(0), update_time(0), block_size(0), mrr_length_per_rec(0) + index_file_length(0), max_index_file_length(0), delete_length(0), + auto_increment_value(0), records(0), deleted(0), mean_rec_length(0), + create_time(0), check_time(0), update_time(0), block_size(0), + mrr_length_per_rec(0) {} }; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 604b228b263..fb0d871e7b8 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5288,7 +5288,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs); } - for (int i= 4; i < 20; i++) + for (uint i= 4; i < table->s->fields; i++) { if (i == 7 || (i > 12 && i < 17) || i == 18) continue; @@ -5466,8 +5466,15 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, { table->field[10]->store((longlong) file->stats.max_data_file_length, TRUE); + table->field[10]->set_notnull(); } table->field[11]->store((longlong) file->stats.index_file_length, TRUE); + if (file->stats.max_index_file_length) + { + table->field[21]->store((longlong) file->stats.max_index_file_length, + TRUE); + table->field[21]->set_notnull(); + } table->field[12]->store((longlong) file->stats.delete_length, TRUE); if (show_table->found_next_number_field) { @@ -5502,6 +5509,11 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, table->field[18]->set_notnull(); } } + /* If table is a temporary table */ + LEX_CSTRING tmp= { STRING_WITH_LEN("N") }; + if (show_table->s->tmp_table != NO_TMP_TABLE) + tmp.str= "Y"; + table->field[22]->store(tmp.str, tmp.length, cs); } err: @@ -8685,6 +8697,9 @@ ST_FIELD_INFO tables_fields_info[]= OPEN_FULL_TABLE}, {"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, + {"MAX_INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, + (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_index_length", OPEN_FULL_TABLE}, + {"TEMPORARY", 1, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, "Temporary", OPEN_FRM_ONLY}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; |