Re: function return 1 > 0 ??
That line is likely part of a method that returns a boolean, right? So what will the above statement return if db.update(...) returns 1? What about if db.update(...) returns 0, what does the method that contains the line above return?
Re: function return 1 > 0 ??
This is the entire function
Code:
public boolean updateUser(long id, String name, String pass){
ContentValues args = new ContentValues();
args.put(KEY_NAME, name);
args.put(KEY_PASS, pass);
return db.update(DBTABLE, args, KEY_ID + "=" + id, null) > 0;
}
Thanks!
Re: function return 1 > 0 ??
Its very simple,
if Code:
db.update(DBTABLE, args, KEY_ID + "=" + id, null)
returns number greater than 0 (zero), method updateUser will return true.
if Code:
db.update(DBTABLE, args, KEY_ID + "=" + id, null)
returns number lower or equal to 0 ( zero), method updateUser will return false.
Re: function return 1 > 0 ??
[QUOTE=garnachito;321736]This is the entire function
Code:
public boolean updateUser(long id, String name, String pass){
ContentValues args = new ContentValues();
args.put(KEY_NAME, name);
args.put(KEY_PASS, pass);
return db.update(DBTABLE, args, KEY_ID + "=" + id, null) > 0;
}
If the row affected return statement will return 1 or return 0