ActiveAndroid icon indicating copy to clipboard operation
ActiveAndroid copied to clipboard

How i can delete all record in a table ?

Open qu4sar opened this issue 8 years ago • 2 comments

How i can delete all record in a table ? i try with new Delete().from(MyClass.class); but nothing

qu4sar avatar Aug 14 '17 17:08 qu4sar

I created this function to clear all table records. public static void clearTable(Class<? extends Model> type) { TableInfo tableInfo = Cache.getTableInfo(type); ActiveAndroid.execSQL(String.format("DELETE FROM %s;", tableInfo.getTableName())); ActiveAndroid.execSQL( String.format("DELETE FROM sqlite_sequence WHERE name='%s';", tableInfo.getTableName())); }

Hope it helps.

havenvo avatar Aug 23 '17 02:08 havenvo

How to delete one record from Table using Where Clause?

hasnain-ahmad avatar Apr 21 '20 10:04 hasnain-ahmad