summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@alik.>2006-11-07 16:24:35 +0300
committerunknown <anozdrin/alik@alik.>2006-11-07 16:24:35 +0300
commite50678f1cea5b0888490710f2542568581b198ec (patch)
tree4c085423d9f65d9221f445b2bc03833ed5b266f0 /sql/sql_prepare.cc
parentda032b99eb7b0621e333dc2b6f423d376017a503 (diff)
parentdd72647032cf157b063fe9a7f02ed2994734b1c0 (diff)
downloadmariadb-git-e50678f1cea5b0888490710f2542568581b198ec.tar.gz
Merge alik.:/mnt/raid/alik/MySQL/devel/5.1
into alik.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged-2 configure.in: Auto merged include/my_time.h: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/kill.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/rename.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/rename.test: Auto merged mysql-test/t/view.test: Auto merged sql/Makefile.am: Auto merged sql/handler.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql-common/my_time.c: Auto merged sql/sql_select.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/time.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/mysql-test-run.pl: Manually merged. sql/sql_parse.cc: Manually merged.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 314d4ed5631..013c3a17fd6 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2287,6 +2287,14 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
#endif
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
+
+ /*
+ If the free_list is not empty, we'll wrongly free some externally
+ allocated items when cleaning up after validation of the prepared
+ statement.
+ */
+ DBUG_ASSERT(thd->free_list == NULL);
+
error= stmt->execute(&expanded_query,
test(flags & (ulong) CURSOR_TYPE_READ_ONLY));
if (!(specialflag & SPECIAL_NO_PRIOR))
@@ -2349,6 +2357,13 @@ void mysql_sql_stmt_execute(THD *thd)
DBUG_PRINT("info",("stmt: %p", stmt));
+ /*
+ If the free_list is not empty, we'll wrongly free some externally
+ allocated items when cleaning up after validation of the prepared
+ statement.
+ */
+ DBUG_ASSERT(thd->free_list == NULL);
+
if (stmt->set_params_from_vars(stmt, lex->prepared_stmt_params,
&expanded_query))
goto set_params_data_err;
@@ -2839,12 +2854,12 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
external changes when cleaning up after validation.
*/
DBUG_ASSERT(thd->change_list.is_empty());
- /*
- If the free_list is not empty, we'll wrongly free some externally
- allocated items when cleaning up after validation of the prepared
- statement.
+
+ /*
+ The only case where we should have items in the thd->free_list is
+ after stmt->set_params_from_vars(), which may in some cases create
+ Item_null objects.
*/
- DBUG_ASSERT(thd->free_list == NULL);
if (error == 0)
error= check_prepared_statement(this, name.str != 0);
@@ -2943,7 +2958,13 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
allocated items when cleaning up after execution of this statement.
*/
DBUG_ASSERT(thd->change_list.is_empty());
- DBUG_ASSERT(thd->free_list == NULL);
+
+ /*
+ The only case where we should have items in the thd->free_list is
+ after stmt->set_params_from_vars(), which may in some cases create
+ Item_null objects.
+ */
+
thd->set_n_backup_statement(this, &stmt_backup);
if (expanded_query->length() &&
alloc_query(thd, (char*) expanded_query->ptr(),