summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-14 23:08:12 +0200
committerunknown <serg@serg.mylan>2005-04-14 23:08:12 +0200
commite2e51911556d17f96a824cefbe7672d105dc26da (patch)
tree6ffbc43e275e098105f34da0e77d527e52897bdb
parentce22ebd02dcb85f9b88b934162c0ec52e6dd1658 (diff)
parentc8723e7f95fa716484e0e84e179e2f4deb5fbc2a (diff)
downloadmariadb-git-e2e51911556d17f96a824cefbe7672d105dc26da.tar.gz
Merge serg@bk-internal.mysql.com:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
-rw-r--r--mysql-test/r/innodb.result1
-rw-r--r--mysql-test/t/innodb.test1
-rw-r--r--sql/sql_delete.cc3
3 files changed, 5 insertions, 0 deletions
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 53a788ca824..6117b0a9a00 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -878,6 +878,7 @@ truncate table t1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit;
truncate table t1;
+truncate table t1;
select * from t1;
a
insert into t1 values(1),(2);
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 770221f5238..7501889127a 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -574,6 +574,7 @@ insert into t1 values(1),(2);
truncate table t1;
commit;
truncate table t1;
+truncate table t1;
select * from t1;
insert into t1 values(1),(2);
delete from t1;
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index cecdf8d1c62..0752105bcae 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -649,11 +649,14 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
if (!ha_supports_generate(table_type))
{
/* Probably InnoDB table */
+ ulong save_options= thd->options;
table_list->lock_type= TL_WRITE;
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
ha_enable_transaction(thd, FALSE);
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
HA_POS_ERROR, 0);
ha_enable_transaction(thd, TRUE);
+ thd->options= save_options;
DBUG_RETURN(error);
}
if (lock_and_wait_for_table_name(thd, table_list))