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/sp_pcontext.h | |
parent | 76714a5c9a4c05fa7084f2c562a9eb50a0b7bd17 (diff) | |
download | mariadb-git-7fa1ad14dca4850caee52e75d69eae441af3f824.tar.gz |
MDEV-10840 sql_mode=ORACLE: RAISE statement for predefined exceptions
Diffstat (limited to 'sql/sp_pcontext.h')
-rw-r--r-- | sql/sp_pcontext.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h index 808143d832c..4f4595899fb 100644 --- a/sql/sp_pcontext.h +++ b/sql/sp_pcontext.h @@ -129,6 +129,10 @@ public: class sp_condition_value : public Sql_alloc { + void init_sql_state() + { + sql_state[0]= '\0'; + } public: enum enum_type { @@ -153,11 +157,21 @@ public: :Sql_alloc(), type(ERROR_CODE), mysqlerr(_mysqlerr) - { } + { init_sql_state(); } + + sp_condition_value(uint _mysqlerr, const char *_sql_state) + :Sql_alloc(), + type(ERROR_CODE), + mysqlerr(_mysqlerr) + { + memcpy(sql_state, _sql_state, SQLSTATE_LENGTH); + sql_state[SQLSTATE_LENGTH]= 0; + } sp_condition_value(const char *_sql_state) :Sql_alloc(), - type(SQLSTATE) + type(SQLSTATE), + mysqlerr(0) { memcpy(sql_state, _sql_state, SQLSTATE_LENGTH); sql_state[SQLSTATE_LENGTH]= 0; @@ -165,9 +179,11 @@ public: sp_condition_value(enum_type _type) :Sql_alloc(), - type(_type) + type(_type), + mysqlerr(0) { DBUG_ASSERT(type != ERROR_CODE && type != SQLSTATE); + init_sql_state(); } /// Check if two instances of sp_condition_value are equal or not. @@ -176,6 +192,8 @@ public: /// /// @return true if the instances are equal, false otherwise. bool equals(const sp_condition_value *cv) const; + + bool has_sql_state() const { return sql_state[0] != '\0'; } }; /////////////////////////////////////////////////////////////////////////// |