summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-11-17 20:26:34 -0800
committerunknown <igor@rurik.mysql.com>2005-11-17 20:26:34 -0800
commit806482c7e45aceac81fe3999197d3a3724653c03 (patch)
treeca8541a960d83f3cbf7beb7e3bc30e40d3b224fe /sql/sql_prepare.cc
parent2e4045e45d764615d030eca79694d21e5034709e (diff)
parent57ad6b20ed8b22b010af1c354b23591570f12b09 (diff)
downloadmariadb-git-806482c7e45aceac81fe3999197d3a3724653c03.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2 sql/sql_prepare.cc: Auto merged
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index a5cf678aa3a..b3e558c94d0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1827,13 +1827,16 @@ static bool init_param_array(Prepared_statement *stmt)
void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
{
- Prepared_statement *stmt= new Prepared_statement(thd, &thd->protocol_prep);
+ Prepared_statement *stmt;
bool error;
DBUG_ENTER("mysql_stmt_prepare");
DBUG_PRINT("prep_query", ("%s", packet));
- if (stmt == 0)
+ /* First of all clear possible warnings from the previous command */
+ mysql_reset_thd_for_next_command(thd);
+
+ if (! (stmt= new Prepared_statement(thd, &thd->protocol_prep)))
DBUG_VOID_RETURN; /* out of memory: error is set in Sql_alloc */
if (thd->stmt_map.insert(stmt))
@@ -1842,7 +1845,6 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
DBUG_VOID_RETURN; /* out of memory */
}
- mysql_reset_thd_for_next_command(thd);
/* Reset warnings from previous command */
mysql_reset_errors(thd, 0);
sp_cache_flush_obsolete(&thd->sp_proc_cache);
@@ -2187,13 +2189,15 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
packet+= 9; /* stmt_id + 5 bytes of flags */
+ /* First of all clear possible warnings from the previous command */
+ mysql_reset_thd_for_next_command(thd);
+
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
DBUG_VOID_RETURN;
DBUG_PRINT("exec_query", ("%s", stmt->query));
DBUG_PRINT("info",("stmt: %p", stmt));
- mysql_reset_thd_for_next_command(thd);
sp_cache_flush_obsolete(&thd->sp_proc_cache);
sp_cache_flush_obsolete(&thd->sp_func_cache);
@@ -2313,6 +2317,8 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
Server_side_cursor *cursor;
DBUG_ENTER("mysql_stmt_fetch");
+ /* First of all clear possible warnings from the previous command */
+ mysql_reset_thd_for_next_command(thd);
statistic_increment(thd->status_var.com_stmt_fetch, &LOCK_status);
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_fetch")))
DBUG_VOID_RETURN;
@@ -2374,6 +2380,9 @@ void mysql_stmt_reset(THD *thd, char *packet)
Prepared_statement *stmt;
DBUG_ENTER("mysql_stmt_reset");
+ /* First of all clear possible warnings from the previous command */
+ mysql_reset_thd_for_next_command(thd);
+
statistic_increment(thd->status_var.com_stmt_reset, &LOCK_status);
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
DBUG_VOID_RETURN;
@@ -2388,7 +2397,6 @@ void mysql_stmt_reset(THD *thd, char *packet)
stmt->state= Query_arena::PREPARED;
- mysql_reset_thd_for_next_command(thd);
send_ok(thd);
DBUG_VOID_RETURN;