mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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
This commit is contained in:
@ -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 (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);
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
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)
|
||||
|
Reference in New Issue
Block a user