Clear database table

Asked

Viewed 1,508 times

0

use this method to delete a record from the bank

public boolean delete(String id) {
    String where = "id = ?";
    String[] whereArgs = new String[] {id};

    int retorno = this.banco.delete("pessoa", where, whereArgs);

    if(retorno != 0)
        return true;
    else
        return false;
}

now I need to create one that erases all records , someone knows?

1 answer

1


Try this, remove where it is different from NULL. Since every record should probably have an id, then remove all.

String where = "id IS NOT NULL";

public boolean deleteAll() {
    String where = "id IS NOT NULL";
    this.banco.delete("pessoa", where, null);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.