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

    }

你可能感兴趣的:(android SQLite)