android - OrmLite: check if CreateOrUpdate did change any values -
is there way, without building custom sql statement, check if ormlite's createorupdate call did change values in database or not?
dao.createorupdatestatus.getnumlineschanged()
returns rows affected value, result 1 if object updated did not change @ all.
i added below methods class, , call 1 of these methods in every setxxx method.
private boolean objectchanged = false; private void checkchanged(object ob1, object ob2) { if (ob1 == null && ob2 == null) { // both null = same, nothing return; } else if (ob1 == null || ob2 == null) { // 1 null objectchanged = true; } else if (ob2.equals(ob1)) { // same, nothing return; } else { objectchanged = true; } } private void checkchanged(int int1, int int2) { if (int1 != int2) { objectchanged = true; } }
it solution works, not it. if has better solution, without making database call, let me know.
Comments
Post a Comment