summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorhalfspawn <j.brauge@qualiac.com>2018-03-30 11:23:28 +0200
committerAlexander Barkov <bar@mariadb.com>2018-04-03 14:00:19 +0400
commit94ecd2314d74eb3a77cf5ba762a2fabe21f211ac (patch)
treed55e122809059a94a1a7ba5bfb5e3255b99371d5 /sql/item_strfunc.h
parent1eee986e0c6ef558422b820aa81a196b7f9a523e (diff)
downloadmariadb-git-94ecd2314d74eb3a77cf5ba762a2fabe21f211ac.tar.gz
MDEV-15739 sql_mode=ORACLE: Make LPAD and RPAD return NULL instead of empty string
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 4e1514c5476..18cda491efd 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1120,6 +1120,26 @@ public:
};
+class Item_func_rpad_oracle :public Item_func_rpad
+{
+ String *make_empty_result()
+ { null_value= 1; return NULL; }
+public:
+ Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3):
+ Item_func_rpad(thd, arg1, arg2, arg3) {}
+ Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2):
+ Item_func_rpad(thd, arg1, arg2) {}
+ void fix_length_and_dec()
+ {
+ Item_func_rpad::fix_length_and_dec();
+ maybe_null= true;
+ }
+ const char *func_name() const { return "rpad_oracle"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_rpad_oracle>(thd, this); }
+};
+
+
class Item_func_lpad :public Item_func_pad
{
public:
@@ -1134,6 +1154,26 @@ public:
};
+class Item_func_lpad_oracle :public Item_func_lpad
+{
+ String *make_empty_result()
+ { null_value= 1; return NULL; }
+public:
+ Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3):
+ Item_func_lpad(thd, arg1, arg2, arg3) {}
+ Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2):
+ Item_func_lpad(thd, arg1, arg2) {}
+ void fix_length_and_dec()
+ {
+ Item_func_lpad::fix_length_and_dec();
+ maybe_null= true;
+ }
+ const char *func_name() const { return "lpad_oracle"; }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_lpad_oracle>(thd, this); }
+};
+
+
class Item_func_conv :public Item_str_func
{
public: