summaryrefslogtreecommitdiff
path: root/sql/item_create.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r--sql/item_create.cc52
1 files changed, 31 insertions, 21 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 3f8c71cbe00..ac82bc4428f 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -606,7 +606,7 @@ public:
{
if (unlikely(!item_list || item_list->elements < 3))
{
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ Item_func::wrong_param_count_error(oracle_schema_ref.name(), *name);
return NULL;
}
return new (thd->mem_root) Item_func_decode_oracle(thd, *item_list);
@@ -626,12 +626,9 @@ public:
virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
- if (thd->variables.sql_mode & MODE_ORACLE)
- return Create_func_decode_oracle::s_singleton.create_native(thd, name,
- item_list);
if (unlikely(!item_list || item_list->elements != 2))
{
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ Item_func::wrong_param_count_error(mariadb_schema.name(), *name);
return NULL;
}
Item_args args(thd, *item_list);
@@ -2302,9 +2299,7 @@ public:
virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
- return thd->variables.sql_mode & MODE_ORACLE ?
- create_native_oracle(thd, name, item_list) :
- create_native_std(thd, name, item_list);
+ return create_native_std(thd, name, item_list);
}
static Create_func_lpad s_singleton;
@@ -2780,9 +2775,7 @@ public:
virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
- return thd->variables.sql_mode & MODE_ORACLE ?
- create_native_oracle(thd, name, item_list) :
- create_native_std(thd, name, item_list);
+ return create_native_std(thd, name, item_list);
}
static Create_func_rpad s_singleton;
@@ -4075,9 +4068,7 @@ Create_func_concat::create_native(THD *thd, const LEX_CSTRING *name,
return NULL;
}
- return thd->variables.sql_mode & MODE_ORACLE ?
- new (thd->mem_root) Item_func_concat_operator_oracle(thd, *item_list) :
- new (thd->mem_root) Item_func_concat(thd, *item_list);
+ return new (thd->mem_root) Item_func_concat(thd, *item_list);
}
Create_func_concat_operator_oracle
@@ -5922,10 +5913,7 @@ Create_func_length Create_func_length::s_singleton;
Item*
Create_func_length::create_1_arg(THD *thd, Item *arg1)
{
- if (thd->variables.sql_mode & MODE_ORACLE)
- return new (thd->mem_root) Item_func_char_length(thd, arg1);
- else
- return new (thd->mem_root) Item_func_octet_length(thd, arg1);
+ return new (thd->mem_root) Item_func_octet_length(thd, arg1);
}
Create_func_octet_length Create_func_octet_length::s_singleton;
@@ -6143,7 +6131,7 @@ Create_func_ltrim Create_func_ltrim::s_singleton;
Item*
Create_func_ltrim::create_1_arg(THD *thd, Item *arg1)
{
- return Lex_trim(TRIM_LEADING, arg1).make_item_func_trim(thd);
+ return Lex_trim(TRIM_LEADING, arg1).make_item_func_trim_std(thd);
}
@@ -6705,7 +6693,7 @@ Create_func_rtrim Create_func_rtrim::s_singleton;
Item*
Create_func_rtrim::create_1_arg(THD *thd, Item *arg1)
{
- return Lex_trim(TRIM_TRAILING, arg1).make_item_func_trim(thd);
+ return Lex_trim(TRIM_TRAILING, arg1).make_item_func_trim_std(thd);
}
@@ -7635,9 +7623,25 @@ const Native_func_registry func_array[] =
};
+const Native_func_registry func_array_oracle_overrides[] =
+{
+ { { STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat_operator_oracle)},
+ { { STRING_WITH_LEN("DECODE") }, BUILDER(Create_func_decode_oracle)},
+ { { STRING_WITH_LEN("LENGTH") }, BUILDER(Create_func_char_length)},
+ { { STRING_WITH_LEN("LPAD") }, BUILDER(Create_func_lpad_oracle)},
+ { { STRING_WITH_LEN("LTRIM") }, BUILDER(Create_func_ltrim_oracle)},
+ { { STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad_oracle)},
+ { { STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim_oracle)},
+
+ { {0, 0}, NULL}
+};
+
+
const size_t func_array_length= sizeof(func_array) / sizeof(Native_func_registry) - 1;
Native_functions_hash native_functions_hash;
+Native_functions_hash native_functions_hash_oracle;
+
extern "C" uchar*
get_native_fct_hash_key(const uchar *buff, size_t *length,
@@ -7749,13 +7753,19 @@ Native_functions_hash::find(THD *thd, const LEX_CSTRING &name) const
int item_create_init()
{
- return native_functions_hash.init(func_array, array_elements(func_array));
+ return
+ native_functions_hash.init(func_array, array_elements(func_array)) ||
+ native_functions_hash_oracle.init(array_elements(func_array) +
+ array_elements(func_array_oracle_overrides)) ||
+ native_functions_hash_oracle.append(func_array) ||
+ native_functions_hash_oracle.replace(func_array_oracle_overrides);
}
void item_create_cleanup()
{
native_functions_hash.cleanup();
+ native_functions_hash_oracle.cleanup();
}