diff options
author | jani@ua141d10.elisa.omakaista.fi <> | 2005-09-13 18:23:37 +0300 |
---|---|---|
committer | jani@ua141d10.elisa.omakaista.fi <> | 2005-09-13 18:23:37 +0300 |
commit | e512bddc2c8d72189f5cf473368ed7d4b68f0a82 (patch) | |
tree | d7d488c0852ade56030cf64f7f214858427a0dc3 /sql/sql_analyse.cc | |
parent | 5b8bfd4d95c95e8c04d2d12736c4d2026abd2b26 (diff) | |
parent | cb4f1320751df0f6155bad65f399f4c354f88e03 (diff) | |
download | mariadb-git-e512bddc2c8d72189f5cf473368ed7d4b68f0a82.tar.gz |
Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r-- | sql/sql_analyse.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 86a94cdf997..669f998cde5 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -879,24 +879,22 @@ void field_real::get_opt_type(String *answer, if (!max_notzero_dec_len) { + int len= (int) max_length - ((item->decimals == NOT_FIXED_DEC) ? + 0 : (item->decimals + 1)); + if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127)) - sprintf(buff, "TINYINT(%d)", (int) max_length - - ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); + sprintf(buff, "TINYINT(%d)", len); else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ? UINT_MAX16 : INT_MAX16)) - sprintf(buff, "SMALLINT(%d)", (int) max_length - - ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); + sprintf(buff, "SMALLINT(%d)", len); else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ? UINT_MAX24 : INT_MAX24)) - sprintf(buff, "MEDIUMINT(%d)", (int) max_length - - ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); + sprintf(buff, "MEDIUMINT(%d)", len); else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ? UINT_MAX32 : INT_MAX32)) - sprintf(buff, "INT(%d)", (int) max_length - - ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); + sprintf(buff, "INT(%d)", len); else - sprintf(buff, "BIGINT(%d)", (int) max_length - - ((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1))); + sprintf(buff, "BIGINT(%d)", len); answer->append(buff, (uint) strlen(buff)); if (min_arg >= 0) answer->append(" UNSIGNED"); |