android中清空一个表---类似truncate table 表名 这样的功能 android sqlite 清空数据库的某个表

 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.free();

    }

posted @ 2014-12-18 15:51  kobe8  Views(4623)  Comments(0Edit  收藏  举报