summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2005-03-05 21:44:15 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2005-03-05 21:44:15 +0200
commit2fc5d274e875fdcc00a3ee03835f0f964e63dc49 (patch)
tree262a483ed5b829f39f6334eb6c7eec7745249151 /sql
parent679088a2ae1353f14a970182fa64f58170e81b72 (diff)
downloadmariadb-git-2fc5d274e875fdcc00a3ee03835f0f964e63dc49.tar.gz
Fixing bug #8850 in such a way that when TRUNCATE is called within
stored procedure, it is converted to DELETE. mysql-test/r/sp.result: A result for the test case for bug #8850 mysql-test/t/sp.test: A test case for the bug #8850 sql/sql_delete.cc: A fix for bug #8850, plus adding a missing call to mysql_init_select(), which caused mem_root corruption. sql/sql_parse.cc: A fix for the bug #8850 BitKeeper/etc/ignore: Added acinclude.m4 to the ignore list
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_delete.cc3
-rw-r--r--sql/sql_parse.cc2
2 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index eddc6741be6..d49d654cb87 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -749,11 +749,12 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
table_list->db, table_list->table_name);
DBUG_RETURN(TRUE);
}
- if (!ha_supports_generate(table_type))
+ if (!ha_supports_generate(table_type) || thd->lex->sphead)
{
/* Probably InnoDB table */
table_list->lock_type= TL_WRITE;
ha_enable_transaction(thd, FALSE);
+ mysql_init_select(thd->lex);
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
HA_POS_ERROR, 0);
ha_enable_transaction(thd, TRUE);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2f38f96c976..b093a9d94e5 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3312,7 +3312,7 @@ unsent_create_error:
Don't allow this within a transaction because we want to use
re-generate table
*/
- if (thd->locked_tables || thd->active_transaction())
+ if ((thd->locked_tables && !lex->sphead) || thd->active_transaction())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));