/** * Deletes all records with details given if they match a set of conditions * supplied. This method constructs a single SQL DELETE statement and sends * it to the database. * * <pre> * LitePal.deleteAll(Person.class, "name = ? and age = ?", "Tom", "14"); * </pre> * * This means that all the records which name is Tom and age is 14 will be * removed.<br> * * @param modelClass * Which table to delete from by class. * @param conditions * A string array representing the WHERE part of an SQL * statement. First parameter is the WHERE clause to apply when * deleting. The way of specifying place holders is to insert one * or more question marks in the SQL. The first question mark is * replaced by the second element of the array, the next question * mark by the third, and so on. Passing empty string will update * all rows. * @return The number of rows affected. */ public static int deleteAll(Class<?> modelClass, String... conditions) { return Operator.deleteAll(modelClass, conditions); }
/** * Deletes all records with details given if they match a set of conditions * supplied. This method constructs a single SQL DELETE statement and sends * it to the database. * * <pre> * LitePal.deleteAll("person", "name = ? and age = ?", "Tom", "14"); * </pre> * * This means that all the records which name is Tom and age is 14 will be * removed.<br> * * Note that this method won't delete the referenced data in other tables. * You should remove those values by your own. * * @param tableName * Which table to delete from. * @param conditions * A string array representing the WHERE part of an SQL * statement. First parameter is the WHERE clause to apply when * deleting. The way of specifying place holders is to insert one * or more question marks in the SQL. The first question mark is * replaced by the second element of the array, the next question * mark by the third, and so on. Passing empty string will update * all rows. * @return The number of rows affected. */ public static int deleteAll(String tableName, String... conditions) { return Operator.deleteAll(tableName, conditions); }
@Override public void run() { synchronized (LitePalSupport.class) { final int rowsAffected = deleteAll(modelClass, conditions); if (executor.getListener() != null) { Operator.getHandler().post(new Runnable() { @Override public void run() { executor.getListener().onFinish(rowsAffected); } }); } } } };
@Override public void run() { synchronized (LitePalSupport.class) { final int rowsAffected = deleteAll(tableName, conditions); if (executor.getListener() != null) { Operator.getHandler().post(new Runnable() { @Override public void run() { executor.getListener().onFinish(rowsAffected); } }); } } } };