summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2005-11-19 10:43:28 +0100
committerunknown <guilhem@mysql.com>2005-11-19 10:43:28 +0100
commit380690316f2b14b80376d18da189505de35568f4 (patch)
tree50c76691f3d387a96de6c97132369326378c35ab /sql/sql_prepare.cc
parenta06f394e68a2aa0207a908198ef3fbdb938725da (diff)
parent6ba79a251681a765f491db1428a467a0a06a69bd (diff)
downloadmariadb-git-380690316f2b14b80376d18da189505de35568f4.tar.gz
Merge mysql.com:/home/mysql_src/mysql-5.0-van
into mysql.com:/home/mysql_src/mysql-5.1-merge-of-5.0 (2nd try; Pekka kindly accepted to fix storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp and storage/ndb/src/kernel/vm/SimulatedBlock.cpp after I push). configure.in: Auto merged mysql-test/r/ndb_charset.result: Auto merged mysql-test/t/view.test: Auto merged mysys/base64.c: Auto merged sql/ha_archive.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/lock.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/myisam/ft_parser.c: Auto merged storage/ndb/include/kernel/AttributeDescriptor.hpp: Auto merged storage/ndb/src/kernel/vm/SimulatedBlock.hpp: Auto merged storage/ndb/tools/ndb_size.pl: Auto merged storage/ndb/tools/ndb_size.tmpl: Auto merged mysql-test/t/disabled.def: merge storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: used "ul", Pekka said he'll fix storage/ndb/src/kernel/vm/SimulatedBlock.cpp: used "ul", Pekka said he'll fix
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 d7c9ad54931..d5282ef6b7f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1829,13 +1829,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))
@@ -1844,7 +1847,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);
@@ -2188,13 +2190,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);
@@ -2314,6 +2318,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;
@@ -2375,6 +2381,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;
@@ -2389,7 +2398,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;