diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-09-27 10:13:08 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-04-05 15:02:51 +0400 |
commit | 76714a5c9a4c05fa7084f2c562a9eb50a0b7bd17 (patch) | |
tree | fc0e93ef9195d89d4079c8608e102012deb3b5e7 /sql/sp_rcontext.cc | |
parent | 4bb87996b915a9383c7bf33c8683f128d3791014 (diff) | |
download | mariadb-git-76714a5c9a4c05fa7084f2c562a9eb50a0b7bd17.tar.gz |
MDEV-10582 sql_mode=ORACLE: explicit cursor attributes %ISOPEN, %ROWCOUNT, %FOUND, %NOTFOUND
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r-- | sql/sp_rcontext.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 8873b87d989..ff5ecc5e6c6 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -425,7 +425,10 @@ sp_cursor::sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, sp_instr_cpush *i) result(thd_arg), m_lex_keeper(lex_keeper), server_side_cursor(NULL), - m_i(i) + m_i(i), + m_fetch_count(0), + m_row_count(0), + m_found(false) { /* currsor can't be stored in QC, so we should prevent opening QC for @@ -470,6 +473,8 @@ int sp_cursor::close(THD *thd) MYF(0)); return -1; } + m_row_count= m_fetch_count= 0; + m_found= false; destroy(); return 0; } @@ -497,6 +502,7 @@ int sp_cursor::fetch(THD *thd, List<sp_variable> *vars) return -1; } + m_fetch_count++; DBUG_EXECUTE_IF("bug23032_emit_warning", push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, @@ -514,10 +520,15 @@ int sp_cursor::fetch(THD *thd, List<sp_variable> *vars) */ if (! server_side_cursor->is_open()) { + m_found= false; + if (thd->variables.sql_mode & MODE_ORACLE) + return 0; my_message(ER_SP_FETCH_NO_DATA, ER_THD(thd, ER_SP_FETCH_NO_DATA), MYF(0)); return -1; } + m_found= true; + m_row_count++; return 0; } |