diff options
author | unknown <pem@mysql.comhem.se> | 2003-11-27 16:48:21 +0100 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2003-11-27 16:48:21 +0100 |
commit | 919b5ba6b5c04bbad477a7722d67213953223cf8 (patch) | |
tree | 3a86abe034e95159e4c892c732cf94688e9f0710 /sql | |
parent | 35eca8e13d56ab4e4dc54b52d0b8b0d4270aceb1 (diff) | |
download | mariadb-git-919b5ba6b5c04bbad477a7722d67213953223cf8.tar.gz |
Fixed BUG#1965: Opening a cursor hangs client when malformed select fails
and BUG#1966: "select 1 into a" on top-level hangs client
include/mysql_com.h:
Added no_send_eof flag to NET for SP cursors (the simple read-only version).
mysql-test/r/sp-error.result:
Added tests for BUG#1965 and BUG#1966.
mysql-test/t/sp-error.test:
Added tests for BUG#1965 and BUG#1966.
sql/net_serv.cc:
Added no_send_eof flag to NET for SP cursors (the simple read-only version).
sql/protocol.cc:
Added no_send_eof flag to NET for SP cursors (the simple read-only version).
sql/sp_rcontext.cc:
Use net->no_send_eof flag to prevent eofs during cursor open (instead of
the dirty vio=0 which didn't work).
sql/sp_rcontext.h:
Use net->no_send_eof flag to prevent eofs during cursor open (instead of
the dirty vio=0 which didn't work).
sql/sql_yacc.yy:
Give error message if doing SELECT ... INTO localvar even if it's outside an SP.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/net_serv.cc | 1 | ||||
-rw-r--r-- | sql/protocol.cc | 2 | ||||
-rw-r--r-- | sql/sp_rcontext.cc | 6 | ||||
-rw-r--r-- | sql/sp_rcontext.h | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 7 |
5 files changed, 9 insertions, 9 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 7944a528b83..0120ad80c0a 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -123,6 +123,7 @@ my_bool my_net_init(NET *net, Vio* vio) net->buff_end=net->buff+net->max_packet; net->vio = vio; net->no_send_ok = 0; + net->no_send_eof = 0; net->error=0; net->return_errno=0; net->return_status=0; net->pkt_nr=net->compress_pkt_nr=0; net->write_pos=net->read_pos = net->buff; diff --git a/sql/protocol.cc b/sql/protocol.cc index 1b2e4bc0203..c28c1e1abb8 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -347,7 +347,7 @@ send_eof(THD *thd, bool no_flush) static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */ NET *net= &thd->net; DBUG_ENTER("send_eof"); - if (net->vio != 0) + if (net->vio != 0 && !net->no_send_eof) { if (!no_flush && (thd->client_capabilities & CLIENT_PROTOCOL_41)) { diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 07fd08b0074..a25cd9ee63e 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -149,15 +149,15 @@ sp_cursor::pre_open(THD *thd) m_oprot= thd->protocol; // Save the original protocol thd->protocol= m_prot; - m_ovio= thd->net.vio; // Prevent send_eof() - thd->net.vio= 0; + m_nseof= thd->net.no_send_eof; + thd->net.no_send_eof= TRUE; return m_lex; } void sp_cursor::post_open(THD *thd, my_bool isopen) { - thd->net.vio= m_ovio; // Restore the originals + thd->net.no_send_eof= m_nseof; // Restore the originals thd->protocol= m_oprot; m_isopen= isopen; m_current_row= m_prot->data; diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index e69ac9bf4b4..6526ed58575 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -240,7 +240,7 @@ private: LEX *m_lex; Protocol_cursor *m_prot; my_bool m_isopen; - Vio *m_ovio; // Original vio + my_bool m_nseof; // Original no_send_eof Protocol *m_oprot; // Original protcol MYSQL_ROWS *m_current_row; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2d25301fc0b..1b06b7f34f3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4555,12 +4555,11 @@ select_var_ident: | ident_or_text { LEX *lex=Lex; - if (!lex->spcont) - YYABORT; sp_pvar_t *t; - if (!(t=lex->spcont->find_pvar(&$1))) + + if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1))) { - send_error(lex->thd, ER_SP_UNDECLARED_VAR); + net_printf(YYTHD, ER_SP_UNDECLARED_VAR, $1.str); YYABORT; } if (! lex->result) |