summaryrefslogtreecommitdiff
path: root/sql/sp_pcontext.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-09-20 15:30:15 +0400
committerAlexander Barkov <bar@mariadb.org>2017-04-05 15:02:50 +0400
commitccb91eb3ce7bf9b5223931699b8de36154c330ad (patch)
tree3d4e84a01f5e97179ef2a5213c561ba233b60418 /sql/sp_pcontext.cc
parentc2c45c55cef121bbb0dcb841723fecf0e0676c36 (diff)
downloadmariadb-git-ccb91eb3ce7bf9b5223931699b8de36154c330ad.tar.gz
MDEV-10839 sql_mode=ORACLE: Predefined exceptions: TOO_MANY_ROWS, NO_DATA_FOUND, DUP_VAL_ON_INDEX
Diffstat (limited to 'sql/sp_pcontext.cc')
-rw-r--r--sql/sp_pcontext.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index db2d36978d4..6b796cb95e9 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -276,9 +276,7 @@ sp_condition_value *sp_pcontext::find_condition(const LEX_STRING name,
{
sp_condition *p= m_conditions.at(i);
- if (my_strnncoll(system_charset_info,
- (const uchar *) name.str, name.length,
- (const uchar *) p->name.str, p->name.length) == 0)
+ if (p->eq_name(name))
{
return p->value;
}
@@ -290,6 +288,32 @@ sp_condition_value *sp_pcontext::find_condition(const LEX_STRING name,
}
+static sp_condition_value
+ cond_no_data_found(ER_SP_FETCH_NO_DATA),
+ cond_dup_val_on_index(ER_DUP_ENTRY),
+ cond_too_many_rows(ER_TOO_MANY_ROWS);
+
+
+static sp_condition sp_predefined_conditions[3]=
+{
+ sp_condition(C_STRING_WITH_LEN("NO_DATA_FOUND"), &cond_no_data_found),
+ sp_condition(C_STRING_WITH_LEN("DUP_VAL_ON_INDEX"), &cond_dup_val_on_index),
+ sp_condition(C_STRING_WITH_LEN("TOO_MANY_ROWS"), &cond_too_many_rows)
+};
+
+
+sp_condition_value *
+sp_pcontext::find_predefined_condition(const LEX_STRING name) const
+{
+ for (uint i= 0; i < array_elements(sp_predefined_conditions) ; i++)
+ {
+ if (sp_predefined_conditions[i].eq_name(name))
+ return sp_predefined_conditions[i].value;
+ }
+ return NULL;
+}
+
+
sp_handler *sp_pcontext::add_handler(THD *thd,
sp_handler::enum_type type)
{