android ormlite 清空表

delete from TableName;  //清空数据
update sqlite_sequence SET seq = 0 where name ='TableName';//自增长ID为0

Sample:
DatabaseHelper helper = DatabaseHelper.getHelper(context);
itemDaoOpe = helper.getDao(Item.class);
itemDaoOpe.queryRaw("delete from item");
itemDaoOpe.queryRaw("update sqlite_sequence SET seq = 0 where name ='item'");

 

posted @ 2017-11-17 14:10  星辰之力  阅读(573)  评论(0编辑  收藏  举报