Commit 1bd3cb73 authored by venu@myvenu.com's avatar venu@myvenu.com

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 7d24a792
...@@ -5430,12 +5430,15 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) ...@@ -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) static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{ {
MYSQL *mysql; MYSQL *mysql;
my_bool error= 0;
DBUG_ENTER("mysql_stmt_close"); DBUG_ENTER("mysql_stmt_close");
DBUG_ASSERT(stmt != 0); 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) if (mysql->status != MYSQL_STATUS_READY)
{ {
/* Clear the current execution status */ /* Clear the current execution status */
...@@ -5454,18 +5457,20 @@ static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list) ...@@ -5454,18 +5457,20 @@ static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{ {
char buff[4]; char buff[4];
int4store(buff, stmt->stmt_id); 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))
}
if (!error)
{ {
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno);
stmt->mysql= NULL; /* connection isn't valid anymore */
DBUG_RETURN(1);
}
}
mysql_free_result(stmt->result); mysql_free_result(stmt->result);
free_root(&stmt->mem_root, MYF(0)); free_root(&stmt->mem_root, MYF(0));
if (!skip_list) if (!skip_list)
mysql->stmts= list_delete(mysql->stmts, &stmt->list); mysql->stmts= list_delete(mysql->stmts, &stmt->list);
mysql->status= MYSQL_STATUS_READY; mysql->status= MYSQL_STATUS_READY;
my_free((gptr) stmt, MYF(MY_WME)); my_free((gptr) stmt, MYF(MY_WME));
} DBUG_RETURN(0);
DBUG_RETURN(error);
} }
my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) 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