summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 089314078a6..59008b1b77f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2623,12 +2623,15 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
field->real_type() == MYSQL_TYPE_STRING) // For binary type
{
+ uint32 octet_max_length= field->max_length();
+ if (octet_max_length != (uint32) 4294967295U)
+ octet_max_length /= field->charset()->mbmaxlen;
longlong char_max_len= is_blob ?
- (longlong) field->max_length() / field->charset()->mbminlen :
- (longlong) field->max_length() / field->charset()->mbmaxlen;
+ (longlong) octet_max_length / field->charset()->mbminlen :
+ (longlong) octet_max_length / field->charset()->mbmaxlen;
table->field[8]->store(char_max_len, TRUE);
table->field[8]->set_notnull();
- table->field[9]->store((longlong) field->max_length(), TRUE);
+ table->field[9]->store((longlong) octet_max_length, TRUE);
table->field[9]->set_notnull();
}
@@ -2887,7 +2890,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
int res= 0;
TABLE *table= tables->table;
bool full_access;
- char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
+ char definer[USER_HOST_BUFF_SIZE];
Open_tables_state open_tables_state_backup;
DBUG_ENTER("fill_schema_proc");
@@ -3029,7 +3032,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
{
CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_views_record");
- char definer[HOSTNAME_LENGTH + USERNAME_LENGTH + 2];
+ char definer[USER_HOST_BUFF_SIZE];
uint definer_len;
if (tables->view)
@@ -3213,7 +3216,7 @@ static int get_schema_triggers_record(THD *thd, struct st_table_list *tables,
LEX_STRING trigger_name;
LEX_STRING trigger_stmt;
ulong sql_mode;
- char definer_holder[HOSTNAME_LENGTH + USERNAME_LENGTH + 2];
+ char definer_holder[USER_HOST_BUFF_SIZE];
LEX_STRING definer_buffer;
definer_buffer.str= definer_holder;
if (triggers->get_trigger_info(thd, (enum trg_event_type) event,