Closed Rainer-Lang closed 9 years ago
You can do this like this:
class UsersTable {
@NonNull
public static UpdateQuery createUpdateQuery(@NonNull User user) {
return UpdateQuery.builder()
.table(TABLE_NAME)
.where(COLUMN_ID + "=?")
.whereArgs(user.id())
.build();
}
}
class User {
@NonNull
public ContentValues toContentValues() {
ContentValue cv = new ContentValues();
// fill values
return cv;
}
And then use this methods where required :)
I don't think that we will do this for you in StorIO because it's pretty hard to satisfy requirements of all users of these feature, so we will leave it up to the user code :)
I'm closing it, feel free to comment!
now:
I have many different update-statements, so I want to move them (like the query-statements) into to the table-definition class.
What I want or better what will be helpful: I want to have the whole "update"-statement part (UpdateQuery AND ContentValues") encapsulate in the table-definition class. My aim is to move all sql-queries to separate files/classes, so my code will be clean and more robust.