summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorhalfspawn <j.brauge@qualiac.com>2018-03-13 10:34:28 +0100
committerhalfspawn <j.brauge@qualiac.com>2018-03-13 10:34:28 +0100
commit3e6893e29a4298e9bb11bd91c6f8f88c7c1191d0 (patch)
tree1d0ef44bf4e628b913cc5e73d6d3b7fd3e6336ee /sql/item_strfunc.h
parent1c4b6afbaaf7dbcee4b035d1bf79156fa68a6475 (diff)
downloadmariadb-git-3e6893e29a4298e9bb11bd91c6f8f88c7c1191d0.tar.gz
MDEV-10574 / SUBSTR - sql_mode=Oracle: return null instead of empty string
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index a357c03bda5..3c8a699fffe 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -35,7 +35,7 @@ protected:
character set. No memory is allocated.
@retval A pointer to the str_value member.
*/
- String *make_empty_result()
+ virtual String *make_empty_result()
{
/*
Reset string length to an empty string. We don't use str_value.set() as
@@ -500,11 +500,18 @@ class Item_func_substr_oracle :public Item_func_substr
protected:
longlong get_position()
{ longlong pos= args[1]->val_int(); return pos == 0 ? 1 : pos; }
+ String *make_empty_result()
+ { null_value= 1; return NULL; }
public:
Item_func_substr_oracle(THD *thd, Item *a, Item *b):
Item_func_substr(thd, a, b) {}
Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c):
Item_func_substr(thd, a, b, c) {}
+ void fix_length_and_dec()
+ {
+ Item_func_substr::fix_length_and_dec();
+ maybe_null= true;
+ }
const char *func_name() const { return "substr_oracle"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_substr_oracle>(thd, mem_root, this); }