diff options
-rw-r--r-- | sql/ha_innodb.cc | 20 | ||||
-rw-r--r-- | sql/ha_innodb.h | 5 | ||||
-rw-r--r-- | sql/handler.h | 6 | ||||
-rw-r--r-- | sql/sql_show.cc | 29 |
4 files changed, 56 insertions, 4 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b4f3f9e9dfd..82a9f44c9ed 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1715,6 +1715,26 @@ innobase_close_connection( *****************************************************************************/ /******************************************************************** +Get the record format from the data dictionary. */ +enum row_type +ha_innobase::get_row_type() const +/*=============================*/ + /* out: ROW_TYPE_REDUNDANT or ROW_TYPE_COMPACT */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + + if (prebuilt && prebuilt->table) { + if (prebuilt->table->comp) { + return(ROW_TYPE_COMPACT); + } else { + return(ROW_TYPE_REDUNDANT); + } + } + ut_ad(0); + return(ROW_TYPE_NOT_USED); +} + +/******************************************************************** Gives the file extension of an InnoDB single-table tablespace. */ const char** diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index cca33cbbe1c..0672485f4fe 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -96,6 +96,11 @@ class ha_innobase: public handler { } ~ha_innobase() {} + /* + Get the row type from the storage engine. If this method returns + ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used. + */ + enum row_type get_row_type() const; const char* table_type() const { return("InnoDB");} const char *index_type(uint key_number) { return "BTREE"; } diff --git a/sql/handler.h b/sql/handler.h index 8ad49456bf6..64deab48b7d 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -385,6 +385,12 @@ public: virtual ha_rows estimate_rows_upper_bound() { return records+EXTRA_RECORDS; } + /* + Get the row type from the storage engine. If this method returns + ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used. + */ + virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; } + virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";} int ha_index_init(uint idx) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 5abfe44f51b..90e099f0528 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2046,10 +2046,31 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, tmp_buff= file->table_type(); table->field[4]->store(tmp_buff, strlen(tmp_buff), cs); table->field[5]->store((longlong) share->frm_version); - tmp_buff= ((share->db_options_in_use & - HA_OPTION_COMPRESS_RECORD) ? "Compressed" : - (share->db_options_in_use & HA_OPTION_PACK_RECORD) ? - "Dynamic" : "Fixed"); + enum row_type row_type = file->get_row_type(); + switch (row_type) { + case ROW_TYPE_NOT_USED: + case ROW_TYPE_DEFAULT: + tmp_buff= ((share->db_options_in_use & + HA_OPTION_COMPRESS_RECORD) ? "Compressed" : + (share->db_options_in_use & HA_OPTION_PACK_RECORD) ? + "Dynamic" : "Fixed"); + break; + case ROW_TYPE_FIXED: + tmp_buff= "Fixed"; + break; + case ROW_TYPE_DYNAMIC: + tmp_buff= "Dynamic"; + break; + case ROW_TYPE_COMPRESSED: + tmp_buff= "Compressed"; + break; + case ROW_TYPE_REDUNDANT: + tmp_buff= "Redundant"; + break; + case ROW_TYPE_COMPACT: + tmp_buff= "Compact"; + break; + } table->field[6]->store(tmp_buff, strlen(tmp_buff), cs); if (!tables->schema_table) { |