diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-10-04 11:29:16 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-10-04 11:29:16 -0400 |
commit | 978989a5ac25bcad8d73b282d45754826d18dd0d (patch) | |
tree | df205404378267df0e8915390da8f19d7cd0f33d /sql/sql_prepare.cc | |
parent | efd91571fbf97809b32db5f715deddeae8c1c501 (diff) | |
parent | f60ea28841ee37627e1997850ad0a5c5bd311bc2 (diff) | |
download | mariadb-git-978989a5ac25bcad8d73b282d45754826d18dd0d.tar.gz |
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug19356/my50-bug19356
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug19356/my51-bug19356
BitKeeper/etc/collapsed:
auto-union
sql/sql_prepare.cc:
Auto merged
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 63a129918d0..fa33cafdab1 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; @@ -2827,12 +2842,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); @@ -2930,7 +2945,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(), |