summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-06-29 18:25:51 +0400
committerAlexander Barkov <bar@mariadb.org>2016-06-29 18:25:51 +0400
commitafbd28aeff370aafe29e50ddadcfd6c55d3c89cd (patch)
treed4edc99a1df766dd8a794d3cdee1b6dc937c45b8 /sql/item_strfunc.h
parent8bec9746f0d5b363f385713035ca3f2daff34e1c (diff)
downloadmariadb-git-afbd28aeff370aafe29e50ddadcfd6c55d3c89cd.tar.gz
Preparing the CAST(..AS [UN]SIGNED) related code to fix a number
of bugs easier (MDEV-8919, MDEV-10304, MDEV-10305, MDEV-10307) - Adding Item::push_note_converted_to_negative_complement() and Item::push_note_converted_to_positive_complement() - Adding virtual methods Item::val_int_signed_typecast() and Item::val_int_unsigned_typecast() - Moving COLUMN_GET() related code from Item_func_signed::val_int() and Item_func_unsigned::val_int() to Item_dyncol_get::val_int_signed_typecast() and Item_dyncol_get::val_int_unsigned_typecast() - Moving Item_func_signed::val_int_from_str() to Item::val_int_from_str() and changing it to get the value from "this" instead of args[0]. The patch does not change behaviour. It's only to simplify fixing of the mentioned bugs. It will also simplify switching the CAST related code to use the type handler infrastructure easier (soon).
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 0ff38157c25..72cdf06adde 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1254,6 +1254,22 @@ public:
const char *func_name() const { return "column_get"; }
String *val_str(String *);
longlong val_int();
+ longlong val_int_signed_typecast()
+ {
+ unsigned_flag= false; // Mark that we want to have a signed value
+ longlong value= val_int(); // val_int() can change unsigned_flag
+ if (!null_value && unsigned_flag && value < 0)
+ push_note_converted_to_negative_complement(current_thd);
+ return value;
+ }
+ longlong val_int_unsigned_typecast()
+ {
+ unsigned_flag= true; // Mark that we want to have an unsigned value
+ longlong value= val_int(); // val_int() can change unsigned_flag
+ if (!null_value && unsigned_flag == 0 && value < 0)
+ push_note_converted_to_positive_complement(current_thd);
+ return value;
+ }
double val_real();
my_decimal *val_decimal(my_decimal *);
bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp);