diff options
author | jani@a193-229-222-105.elisa-laajakaista.fi <> | 2005-09-11 11:07:56 +0300 |
---|---|---|
committer | jani@a193-229-222-105.elisa-laajakaista.fi <> | 2005-09-11 11:07:56 +0300 |
commit | 91b6fe26790d657d9c27ce11674cf66331403589 (patch) | |
tree | 5fb26e6699aed3dd96fa79e30a386ce520cb5de5 /sql/sql_analyse.cc | |
parent | 1e1c04ff91db26307ebca8e9655bf0bb18ad9a3b (diff) | |
parent | 27373d1d117d41e3de28b668d72bc5687a357182 (diff) | |
download | mariadb-git-91b6fe26790d657d9c27ce11674cf66331403589.tar.gz |
Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-4.1
into a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r-- | sql/sql_analyse.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 6706cee8e9d..86a94cdf997 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -880,18 +880,23 @@ void field_real::get_opt_type(String *answer, if (!max_notzero_dec_len) { if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127)) - sprintf(buff, "TINYINT(%d)", (int) max_length - (item->decimals + 1)); + sprintf(buff, "TINYINT(%d)", (int) max_length - + ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ? UINT_MAX16 : INT_MAX16)) - sprintf(buff, "SMALLINT(%d)", (int) max_length - (item->decimals + 1)); + sprintf(buff, "SMALLINT(%d)", (int) max_length - + ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ? UINT_MAX24 : INT_MAX24)) - sprintf(buff, "MEDIUMINT(%d)", (int) max_length - (item->decimals + 1)); + sprintf(buff, "MEDIUMINT(%d)", (int) max_length - + ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ? UINT_MAX32 : INT_MAX32)) - sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1)); + sprintf(buff, "INT(%d)", (int) max_length - + ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); else - sprintf(buff, "BIGINT(%d)", (int) max_length - (item->decimals + 1)); + sprintf(buff, "BIGINT(%d)", (int) max_length - + ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) answer->append(" UNSIGNED"); |