diff options
author | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2005-07-19 14:30:32 +0500 |
---|---|---|
committer | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2005-07-19 14:30:32 +0500 |
commit | a2df1eb821760daa0e3a57969be1e934b5b9abd9 (patch) | |
tree | 30ca1519d4fd16f9cd8b8a9907dc575ee4a9d0fb /sql/sql_show.cc | |
parent | b8497024cf3bc48ddb6d08db1cd1126895d9b9fd (diff) | |
download | mariadb-git-a2df1eb821760daa0e3a57969be1e934b5b9abd9.tar.gz |
Fix for bug#11057 information_schema: columns table has some questionable contents
fixed BLOB, TEXT(wrong maximum length), BIT and integer types(wrong numeric_precision value)
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1608999eaef..80e6bbdf388 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2377,6 +2377,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, { const char *tmp_buff; byte *pos; + bool is_blob; uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; char tmp1[MAX_FIELD_WIDTH]; @@ -2455,12 +2456,14 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, "NO" : "YES"); table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); - if (field->has_charset()) + is_blob= (field->type() == FIELD_TYPE_BLOB); + if (field->has_charset() || is_blob) { - table->field[8]->store((longlong) field->field_length/ - field->charset()->mbmaxlen); + longlong c_octet_len= is_blob ? (longlong) field->max_length() : + (longlong) field->max_length()/field->charset()->mbmaxlen; + table->field[8]->store(c_octet_len); table->field[8]->set_notnull(); - table->field[9]->store((longlong) field->field_length); + table->field[9]->store((longlong) field->max_length()); table->field[9]->set_notnull(); } @@ -2488,6 +2491,17 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, case FIELD_TYPE_LONG: case FIELD_TYPE_LONGLONG: case FIELD_TYPE_INT24: + { + table->field[10]->store((longlong) field->max_length() - 1); + table->field[10]->set_notnull(); + break; + } + case FIELD_TYPE_BIT: + { + table->field[10]->store((longlong) field->max_length()); + table->field[10]->set_notnull(); + break; + } case FIELD_TYPE_FLOAT: case FIELD_TYPE_DOUBLE: { |