Commit bc953f05 authored by unknown's avatar unknown

Fix for mysql_stmt_close(), so that the PHP layer can map it easily to know...

Fix for mysql_stmt_close(), so that the PHP layer can map it easily to know whether the 'stmt' is really freed, so that they can free their internal stmts

parent 139267a5
......@@ -5430,12 +5430,15 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{
MYSQL *mysql;
my_bool error= 0;
DBUG_ENTER("mysql_stmt_close");
DBUG_ASSERT(stmt != 0);
mysql= stmt->mysql;
if (!(mysql= stmt->mysql))
{
my_free((gptr) stmt, MYF(MY_WME));
DBUG_RETURN(0);
}
if (mysql->status != MYSQL_STATUS_READY)
{
/* Clear the current execution status */
......@@ -5454,18 +5457,20 @@ static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{
char buff[4];
int4store(buff, stmt->stmt_id);
error= simple_command(mysql, COM_CLOSE_STMT, buff, 4, 1);
}
if (!error)
{
mysql_free_result(stmt->result);
free_root(&stmt->mem_root, MYF(0));
if (!skip_list)
mysql->stmts= list_delete(mysql->stmts, &stmt->list);
mysql->status= MYSQL_STATUS_READY;
my_free((gptr) stmt, MYF(MY_WME));
if (simple_command(mysql, COM_CLOSE_STMT, buff, 4, 1))
{
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno);
stmt->mysql= NULL; /* connection isn't valid anymore */
DBUG_RETURN(1);
}
}
DBUG_RETURN(error);
mysql_free_result(stmt->result);
free_root(&stmt->mem_root, MYF(0));
if (!skip_list)
mysql->stmts= list_delete(mysql->stmts, &stmt->list);
mysql->status= MYSQL_STATUS_READY;
my_free((gptr) stmt, MYF(MY_WME));
DBUG_RETURN(0);
}
my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment