diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-09-27 13:22:38 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-04-05 15:02:51 +0400 |
commit | 7fa1ad14dca4850caee52e75d69eae441af3f824 (patch) | |
tree | 6da9a4b31390a3e83b1e2282e1b55cefd46d9cb8 /sql/sql_signal.cc | |
parent | 76714a5c9a4c05fa7084f2c562a9eb50a0b7bd17 (diff) | |
download | mariadb-git-7fa1ad14dca4850caee52e75d69eae441af3f824.tar.gz |
MDEV-10840 sql_mode=ORACLE: RAISE statement for predefined exceptions
Diffstat (limited to 'sql/sql_signal.cc')
-rw-r--r-- | sql/sql_signal.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index 1b7edbee54a..4765cebc355 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -102,7 +102,7 @@ void Sql_cmd_common_signal::eval_defaults(THD *thd, Sql_condition *cond) /* SIGNAL is restricted in sql_yacc.yy to only signal SQLSTATE conditions. */ - DBUG_ASSERT(m_cond->type == sp_condition_value::SQLSTATE); + DBUG_ASSERT(m_cond->has_sql_state()); sqlstate= m_cond->sql_state; cond->set_sqlstate(sqlstate); } @@ -117,19 +117,25 @@ void Sql_cmd_common_signal::eval_defaults(THD *thd, Sql_condition *cond) { /* SQLSTATE class "01": warning. */ assign_defaults(cond, set_defaults, - Sql_condition::WARN_LEVEL_WARN, ER_SIGNAL_WARN); + Sql_condition::WARN_LEVEL_WARN, + m_cond && m_cond->mysqlerr ? m_cond->mysqlerr : + ER_SIGNAL_WARN); } else if ((sqlstate[0] == '0') && (sqlstate[1] == '2')) { /* SQLSTATE class "02": not found. */ assign_defaults(cond, set_defaults, - Sql_condition::WARN_LEVEL_ERROR, ER_SIGNAL_NOT_FOUND); + Sql_condition::WARN_LEVEL_ERROR, + m_cond && m_cond->mysqlerr ? m_cond->mysqlerr : + ER_SIGNAL_NOT_FOUND); } else { /* other SQLSTATE classes : error. */ assign_defaults(cond, set_defaults, - Sql_condition::WARN_LEVEL_ERROR, ER_SIGNAL_EXCEPTION); + Sql_condition::WARN_LEVEL_ERROR, + m_cond && m_cond->mysqlerr ? m_cond->mysqlerr : + ER_SIGNAL_EXCEPTION); } } |