diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-09-25 21:33:50 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-09-25 21:33:50 +0400 |
commit | 30711c6650fc7e2f166f29d0bc59eeab64dadb3e (patch) | |
tree | bd9a209f1e339c73a2d23c22c9c078ea992ebd08 /sql/item.h | |
parent | 26e4403f649839e82dd26f7a6b31165063eb2871 (diff) | |
download | mariadb-git-30711c6650fc7e2f166f29d0bc59eeab64dadb3e.tar.gz |
MDEV-8806 Numeric CAST produce different warnings for strings literals vs functions
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/sql/item.h b/sql/item.h index 13f65b36404..4654c4ac1cc 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1278,7 +1278,38 @@ public: /* Make sure the null_value member has a correct value. */ - virtual void update_null_value () { (void) val_int(); } + virtual void update_null_value () + { + switch (cmp_type()) { + case INT_RESULT: + (void) val_int(); + break; + case REAL_RESULT: + (void) val_real(); + break; + case DECIMAL_RESULT: + { + my_decimal tmp; + (void) val_decimal(&tmp); + } + break; + case TIME_RESULT: + { + MYSQL_TIME ltime; + (void) get_temporal_with_sql_mode(<ime); + } + break; + case STRING_RESULT: + { + StringBuffer<MAX_FIELD_WIDTH> tmp; + (void) val_str(&tmp); + } + break; + case ROW_RESULT: + DBUG_ASSERT(0); + null_value= true; + } + } /* Inform the item that there will be no distinction between its result @@ -3231,18 +3262,12 @@ public: longlong val_int() { DBUG_ASSERT(fixed == 1); - return longlong_from_string_with_check(str_value.charset(), - str_value.ptr(), - str_value.ptr()+ - str_value.length()); + return longlong_from_string_with_check(&str_value); } double val_real() { DBUG_ASSERT(fixed == 1); - return double_from_string_with_check(str_value.charset(), - str_value.ptr(), - str_value.ptr() + - str_value.length()); + return double_from_string_with_check(&str_value); } my_decimal *val_decimal(my_decimal *decimal_value) { |