Dbunit中DatabaseOperation.DELETE和DatabaseOperation.DELETE_ALL的差别

DatabaseOperation.DELETE
This operation deletes only the dataset contents from the database. This operation does not delete the entire table contents but only data that are present in the dataset.

DatabaseOperation.DELETE_ALL  Deletes all rows of tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence.

DatabaseOperation.CLEAN_INSERT  This composite operation performs a DELETE_ALL operation followed by an INSERT operation. This is the safest approach to ensure that the database is in a known state. This is appropriate for tests that require the database to only contain a specific set of data.

以上信息来自 http://dbunit.sourceforge.net/components.html

从上开始看出,
DatabaseOperation.DELETE 只删除数据集文件中准备的数据.不删除你另外插入的数据
DatabaseOperation.DELETE_ALL 将删除数据集文件中出现的表中的所有数据,也就是如果你往数据集表中插入了数据,那么也会删除.表本身不会被删除.而且表会被trucate

另外:DatabaseOperation.CLEAN_INSERT是DELETE_ALL和 INSERT的绑定.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值