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

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/media/sda1/mysql/mysql-5.0-9478
This commit is contained in:
konstantin@mysql.com
2005-05-12 11:17:38 +04:00
9 changed files with 294 additions and 94 deletions

View File

@@ -135,7 +135,8 @@ find_prepared_statement(THD *thd, ulong id, const char *where)
if (stmt == 0 || stmt->type() != Item_arena::PREPARED_STATEMENT)
{
char llbuf[22];
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where);
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf), llstr(id, llbuf),
where);
return 0;
}
return (Prepared_statement *) stmt;
@@ -1965,7 +1966,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{
ulong stmt_id= uint4korr(packet);
ulong flags= (ulong) ((uchar) packet[4]);
Cursor *cursor= 0;
Cursor *cursor;
/*
Query text for binary log, or empty string if the query is not put into
binary log.
@@ -1991,6 +1992,13 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
DBUG_VOID_RETURN;
}
cursor= stmt->cursor;
if (cursor && cursor->is_open())
{
my_error(ER_EXEC_STMT_WITH_OPEN_CURSOR, MYF(0));
DBUG_VOID_RETURN;
}
DBUG_ASSERT(thd->free_list == NULL);
mysql_reset_thd_for_next_command(thd);
if (flags & (ulong) CURSOR_TYPE_READ_ONLY)
@@ -2009,7 +2017,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
else
{
DBUG_PRINT("info",("Using READ_ONLY cursor"));
if (!stmt->cursor &&
if (!cursor &&
!(cursor= stmt->cursor= new (&stmt->main_mem_root) Cursor()))
DBUG_VOID_RETURN;
/* If lex->result is set, mysql_execute_command will use it */
@@ -2204,13 +2212,15 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
Statement *stmt;
DBUG_ENTER("mysql_stmt_fetch");
if (!(stmt= thd->stmt_map.find(stmt_id)) ||
!stmt->cursor ||
!stmt->cursor->is_open())
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
DBUG_VOID_RETURN;
if (!stmt->cursor || !stmt->cursor->is_open())
{
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch");
my_error(ER_STMT_HAS_NO_OPEN_CURSOR, MYF(0));
DBUG_VOID_RETURN;
}
thd->current_arena= stmt;
thd->set_n_backup_statement(stmt, &thd->stmt_backup);
stmt->cursor->init_thd(thd);
@@ -2262,6 +2272,9 @@ void mysql_stmt_reset(THD *thd, char *packet)
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
DBUG_VOID_RETURN;
if (stmt->cursor && stmt->cursor->is_open())
stmt->cursor->close();
stmt->state= Item_arena::PREPARED;
/*