sql - android SQLiteDatabase.Update() is returning 2, why? -
i have database , query items.
the list of items are:
type- coffee: name- cafe latte type- coffee: name- flavoured latte type- coffee: name- mocha type- coffee: name- americano type- coffee: name- short black type- coffee: name- flat white type- coffee: name- espresso type- coffee: name- espresso con panna type- coffee: name- espresso machiato type- coffee: name- espresso affogato type- coffee: name- pot of coffee
and when call function:
public int edititem(menuitem menuitem){ contentvalues itemnewvalues = new contentvalues(); //itemnewvalues.put(item_type,menuitem.gettype()); itemnewvalues.put(item_name,menuitem.getname()); itemnewvalues.put(item_regprice,menuitem.getregprice()); itemnewvalues.put(item_largeprice,menuitem.getlargeprice()); string[] args = new string[1]; args[0]= menuitem.getname(); return db.update(database_table, itemnewvalues,item_name+"=?", args); } log.i("tag","updating (no of entries edited: " +localdbhandler.edititem(new menuitem("coffee", "flavoured latte", "9.90","2.45")));
it returns "no of entries edited: 2"
but when print out table again same.
oh heres create table statment:
// sql statement create new database. private static final string database_create = "create table " + database_table + " (" + item_type + " text not null, " + item_name + " text not null, " + item_regprice + " text not null, " + item_largeprice + " text not null);";
its bothering me don't want unwanted changes showing further down line i'm not seeing now.
take @ schema. if db.update()
returning 2
, updated 2 rows in table, , whereclause
matches 2 rows. debugging purposes, query table same whereclause
, see returns. may have revise schema and/or add search criterion narrow down result set.
Comments
Post a Comment