diff options
author | unknown <hf@deer.(none)> | 2005-04-06 15:49:55 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-04-06 15:49:55 +0500 |
commit | acd0dbd2703b6691acce6ff67278384f5ea5700d (patch) | |
tree | 42e6003f2a14a4294997321b48667f07293772d1 | |
parent | ec6ce01565bbb1a56b342a2dd4607869c0d93278 (diff) | |
download | mariadb-git-acd0dbd2703b6691acce6ff67278384f5ea5700d.tar.gz |
Stupid error message for 'insert "aaa"' into decimal column fixed
mysql-test/r/row.result:
test result fixed
sql/item.cc:
error message for the case of bad decimal value added
duplicated code removed
-rw-r--r-- | mysql-test/r/row.result | 2 | ||||
-rw-r--r-- | sql/item.cc | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 40a31563604..9734efb0797 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -15,7 +15,7 @@ select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')); row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a')) 1 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: 'a' select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)); row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3)) 1 diff --git a/sql/item.cc b/sql/item.cc index 48faa3509f4..b7d9f177c53 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -260,8 +260,15 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) return 0; // NULL or EOM end_ptr= (char*) res->ptr()+ res->length(); - str2my_decimal(E_DEC_FATAL_ERROR, res->ptr(), res->length(), res->charset(), - decimal_value); + if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, + res->ptr(), res->length(), res->charset(), + decimal_value) & E_DEC_BAD_NUM) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL", + str_value.c_ptr()); + } return decimal_value; } @@ -1457,10 +1464,7 @@ void Item_string::print(String *str) my_decimal *Item_string::val_decimal(my_decimal *decimal_value) { - /* following assert is redundant, because fixed=1 assigned in constructor */ - DBUG_ASSERT(fixed == 1); - string2my_decimal(E_DEC_FATAL_ERROR, &str_value, decimal_value); - return (decimal_value); + return val_decimal_from_string(decimal_value); } |