1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Made multiple queries (SELECT without INTO) work in SPs.

This included bug fixes in the 4.1 protocol (actually send and receive the
server_status flags).


libmysql/libmysql.c:
  Pick up the server_status (with the 4.1 protocol) as well.
mysql-test/r/sp-error.result:
  Test for "bad selects" in non-CLIENT_MULTI_QUERIES clients (as mysqltest for the
  momen; this test will have to go away eventually).
mysql-test/t/sp-error.test:
  Test for "bad selects" in non-CLIENT_MULTI_QUERIES clients (as mysqltest for the
  momen; this test will have to go away eventually).
sql/protocol.cc:
  Actually send the server_status flags in send_eof() (4.1 protocol), not just zero.
sql/sp_head.cc:
  Made multiple queries (SELECT without INTO) work in SPs.
sql/sp_head.h:
  Made multiple queries (SELECT without INTO) work in SPs.
sql/sql_parse.cc:
  Made multiple queries (SELECT without INTO) work in SPs.
sql/sql_yacc.yy:
  Made multiple queries (SELECT without INTO) work in SPs.
This commit is contained in:
unknown
2003-04-23 09:22:54 +02:00
parent 4ed94fcd8e
commit f525047d1e
8 changed files with 107 additions and 43 deletions

View File

@@ -3043,8 +3043,8 @@ mysql_execute_command(THD *thd)
net_printf(thd, ER_SP_STORE_FAILED, SP_TYPE_STRING(lex), name);
goto error;
}
break;
}
break;
case SQLCOM_CALL:
{
sp_head *sp;
@@ -3057,17 +3057,40 @@ mysql_execute_command(THD *thd)
}
else
{
uint smrx;
LINT_INIT(smrx);
#ifndef EMBEDDED_LIBRARY
// When executing substatements, they're assumed to send_error when
// it happens, but not to send_ok.
my_bool nsok= thd->net.no_send_ok;
thd->net.no_send_ok= TRUE;
#endif
if (sp->m_multi_query)
{
if (! (thd->client_capabilities & CLIENT_MULTI_QUERIES))
{
send_error(thd, ER_SP_BADSELECT);
#ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok;
#endif
sp->destroy(); // QQ Free memory. Remove this when caching!!!
goto error;
}
smrx= thd->server_status & SERVER_MORE_RESULTS_EXISTS;
thd->server_status |= SERVER_MORE_RESULTS_EXISTS;
}
res= sp->execute_procedure(thd, &lex->value_list);
#ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok;
#endif
if (sp->m_multi_query)
{
if (! smrx)
thd->server_status &= ~SERVER_MORE_RESULTS_EXISTS;
}
sp->destroy(); // QQ Free memory. Remove this when caching!!!
@@ -3076,8 +3099,8 @@ mysql_execute_command(THD *thd)
else
goto error; // Substatement should already have sent error
}
break;
}
break;
case SQLCOM_ALTER_PROCEDURE:
case SQLCOM_ALTER_FUNCTION:
{
@@ -3099,8 +3122,8 @@ mysql_execute_command(THD *thd)
sp->destroy(); // QQ Free memory. Remove this when caching!!!
send_ok(thd);
}
break;
}
break;
case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION:
{
@@ -3149,8 +3172,8 @@ mysql_execute_command(THD *thd)
lex->udf.name.str);
goto error;
}
break;
}
break;
default: /* Impossible */
send_ok(thd);
break;