i want to delete rows from a table based on condition. like
"delete from Table where Name='Value'"
here i am using greenDAO database.
i want to delete rows from a table based on condition. like
"delete from Table where Name='Value'"
here i am using greenDAO database.
1 Check the documentation.
2 Create a DeleteQuery for your Table
3 Execute it
4 Clear the session so that all caches lose the deleted objects too.
final DeleteQuery<Table> tableDeleteQuery = daoSession.queryBuilder(Table.class)
.where(TableDao.Properties.Name.eq("Value"))
.buildDelete();
tableDeleteQuery.executeDeleteWithoutDetachingEntities();
daoSession.clear();
If you need to execute the query multiple times, save the query object to avoid re-instantiating it.
Btw greenDAO is an ORM, not a database (here it's SQLite).
© 2022 - 2024 — McMap. All rights reserved.