清空表,还原序列

public void clearFeedTable(){
  String sql = "DELETE FROM " + FEED_TABLE_NAME +";";
        SQLiteDatabase db =  dbHelper.getSQLiteDatabase();
  db.execSQL(sql);
  revertSeq();
  dbHelper.free();
 }

 private void revertSeq() {
  String sql = "update sqlite_sequence set seq=0 where name='"+FEED_TABLE_NAME+"'";
  SQLiteDatabase db =  dbHelper.getSQLiteDatabase();
  db.execSQL(sql);
  dbHelper.close();
 }
 

 

你可能感兴趣的:(序列)