I am using DBFlow in my Android project and I would like to know if there is a way to update the entire object instead of specifying each column as shown below
// Native SQL wrapper
SQLite.update(Ant.class)
.set(Ant_Table.type.eq("other"))
.where(Ant_Table.type.is("worker"))
.and(Ant_Table.isMale.is(true))
.async()
.execute(); // non-UI blocking
From the guide https://agrosner.gitbooks.io/dbflow/content/SQLiteWrapperLanguage.html
The 'Set' part of the Update supports different kinds of values:
- ContentValues -> converts to key/value as a SQLOperator of is()/eq()
- SQLOperator, which are grouped together as part of the SET statement.
Based on this, I tried to pass in a ContentValues into the set method
// Native SQL wrapper
SQLite.update(Ant.class)
.set(contentValues)
.where(Ant_Table.type.is("worker"))
.and(Ant_Table.isMale.is(true))
.async()
.execute(); // non-UI blocking
and I get a compile error
set (com.raizlabs....SQLOperator...) in Update cannot be applied
to (android.content.ContentValues)
You need to call it like this:
It's not clear from the documentation niether from the source code but it should work this way.