diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-11-28 15:44:11 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-11-28 15:44:11 +0200 |
commit | 9221a5482bb39be7391f46d81e1e85dc41b47729 (patch) | |
tree | fa4c02c70637d0f12ec543e10f073cc0738788a3 /sql/item_sum.cc | |
parent | 1019dd404c273b722daa4039d42b1a920439e6b1 (diff) | |
download | mariadb-git-9221a5482bb39be7391f46d81e1e85dc41b47729.tar.gz |
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
When implicitly converting string fields to numbers the
string-to-number conversion error was not sent to the client.
Added code to send the conversion error as warning.
We also need to prevent generation of warnings from the places
where val_xxx() methods are called for the sole purpose of updating
the Item::null_value flag.
To achieve that a special function is added (and called) :
update_null_value(). This function will set the no_errors flag and
will call val_xxx(). The warning generation in Field_string::val_xxx()
will use the flag when generating the conversion warnings.
mysql-test/r/compare.result:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- non-convertible strings in arithmetic operations
mysql-test/r/func_gconcat.result:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- non-convertible strings in arithmetic operations
mysql-test/r/func_group.result:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- non-convertible strings in arithmetic operations
mysql-test/r/type_varchar.result:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- test case
mysql-test/t/type_varchar.test:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- test case
sql/field.cc:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- send conversion warning to the client
sql/item.cc:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- send conversion warning to the client
sql/item.h:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- added a special function to explicitly update the null_value
sql/item_func.h:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- added a special function to explicitly update the null_value
sql/item_subselect.h:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- added a special function to explicitly update the null_value
sql/item_sum.cc:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- added a special function to explicitly update the null_value
sql/item_sum.h:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- added a special function to explicitly update the null_value
sql/sql_string.h:
BUG#11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
- send conversion warning to the client
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index fccbdfa7925..c6f29efa5ca 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1050,7 +1050,7 @@ bool Item_sum_count::add() count++; else { - (void) args[0]->val_int(); + args[0]->update_null_value(); if (!args[0]->null_value) count++; } @@ -1956,7 +1956,7 @@ void Item_sum_count::reset_field() nr=1; else { - (void) args[0]->val_int(); + args[0]->update_null_value(); if (!args[0]->null_value) nr=1; } @@ -2066,7 +2066,7 @@ void Item_sum_count::update_field() nr++; else { - (void) args[0]->val_int(); + args[0]->update_null_value(); if (!args[0]->null_value) nr++; } @@ -2546,7 +2546,7 @@ bool Item_sum_count_distinct::setup(THD *thd) return TRUE; // End of memory if (item->const_item()) { - (void) item->val_int(); + item->update_null_value(); if (item->null_value) always_null=1; } |