From c0c1c3200a1dc23e12ef1135f549ad1ec8e524de Mon Sep 17 00:00:00 2001
From: "ram@gw.mysql.r18.ru" <>
Date: Tue, 29 Jun 2004 13:49:50 +0500
Subject: [PATCH] a fix (bug #4304: TRUNCATE
, wrong
result).
---
mysql-test/r/bdb.result | 7 +++++++
mysql-test/t/bdb.test | 11 +++++++++++
sql/handler.h | 3 ++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index cc6a974b192..87bc36fb215 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1210,3 +1210,10 @@ a b
3 three
4 four
drop table t1, t2;
+create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
+insert into t1 values (1,'one');
+commit;
+truncate t1;
+select * from t1;
+a b
+drop table t1;
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 42729034d41..de156cc2305 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -850,3 +850,14 @@ insert into t2 (a, b)
select a, b from t1 where (a, b) in (select a, b from t1);
select * from t2;
drop table t1, t2;
+
+#
+# Bug #4304: TRUNCATE , wrong result
+#
+
+create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
+insert into t1 values (1,'one');
+commit;
+truncate t1;
+select * from t1;
+drop table t1;
diff --git a/sql/handler.h b/sql/handler.h
index fb728ef6999..431cf3f3f98 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -515,7 +515,8 @@ extern TYPELIB tx_isolation_typelib;
#define ha_commit(thd) (ha_commit_trans((thd), &((thd)->transaction.all)))
#define ha_rollback(thd) (ha_rollback_trans((thd), &((thd)->transaction.all)))
-#define ha_supports_generate(T) (T != DB_TYPE_INNODB)
+#define ha_supports_generate(T) (T != DB_TYPE_INNODB && \
+ T != DB_TYPE_BERKELEY_DB)
bool ha_caching_allowed(THD* thd, char* table_key,
uint key_length, uint8 cache_type);