diff options
author | unknown <pem@mysql.com> | 2005-06-10 16:56:34 +0200 |
---|---|---|
committer | unknown <pem@mysql.com> | 2005-06-10 16:56:34 +0200 |
commit | 4b0264dffd689b4d688fb76671c395c02f31aec0 (patch) | |
tree | 0c98e814978a1dbcc67cf6961168656ef81da1f7 /sql/sp_rcontext.cc | |
parent | 03949f8ce8aba38e691bda665d277df8bc1fbee2 (diff) | |
parent | 846d6be749125abc43c847136cbe8fecdcf2c3e5 (diff) | |
download | mariadb-git-4b0264dffd689b4d688fb76671c395c02f31aec0.tar.gz |
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_rcontext.cc:
Auto merged
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r-- | sql/sp_rcontext.cc | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index daca6b38b46..61cd7a9300f 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "mysql_priv.h" #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif @@ -22,7 +23,6 @@ #undef SAFEMALLOC /* Problems with threads */ #endif -#include "mysql_priv.h" #include "mysql.h" #include "sp_head.h" #include "sp_rcontext.h" @@ -169,8 +169,22 @@ sp_rcontext::pop_cursors(uint count) * */ -// We have split this in two to make it easy for sp_instr_copen -// to reuse the sp_instr::exec_stmt() code. +/* + pre_open cursor + + SYNOPSIS + pre_open() + THD Thread handler + + NOTES + We have to open cursor in two steps to make it easy for sp_instr_copen + to reuse the sp_instr::exec_stmt() code. + If this function returns 0, post_open should not be called + + RETURN + 0 ERROR +*/ + sp_lex_keeper* sp_cursor::pre_open(THD *thd) { @@ -180,32 +194,31 @@ sp_cursor::pre_open(THD *thd) MYF(0)); return NULL; } - - bzero((char *)&m_mem_root, sizeof(m_mem_root)); init_alloc_root(&m_mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC); if ((m_prot= new Protocol_cursor(thd, &m_mem_root)) == NULL) return NULL; - m_oprot= thd->protocol; // Save the original protocol - thd->protocol= m_prot; - + /* Save for execution. Will be restored in post_open */ + m_oprot= thd->protocol; m_nseof= thd->net.no_send_eof; + + /* Change protocol for execution */ + thd->protocol= m_prot; thd->net.no_send_eof= TRUE; return m_lex_keeper; } + void sp_cursor::post_open(THD *thd, my_bool was_opened) { thd->net.no_send_eof= m_nseof; // Restore the originals thd->protocol= m_oprot; - if (was_opened) - { - m_isopen= was_opened; + if ((m_isopen= was_opened)) m_current_row= m_prot->data; - } } + int sp_cursor::close(THD *thd) { @@ -218,6 +231,7 @@ sp_cursor::close(THD *thd) return 0; } + void sp_cursor::destroy() { @@ -226,7 +240,6 @@ sp_cursor::destroy() delete m_prot; m_prot= NULL; free_root(&m_mem_root, MYF(0)); - bzero((char *)&m_mem_root, sizeof(m_mem_root)); } m_isopen= FALSE; } |