????update????????????????????????????????????????? ContentValues ????????? WHERE ????????????? WHERE ?????????????Щ????????滻 WHERE ?????е?“??”????update() ??????????????????е?????????? execSQL() ??????????????????
????WHERE ??????????????ù??????? SQL APIs ????????磺
????String[] parms=new String[] {"this is a string"};
????db.update("widgets"?? replacements?? "name=?"?? parms);
????delete() ????????ú? update() ?????????????????? WHERE ?????????????? WHERE ?????????????
????????????
???????? INSERT?? UPDATE?? DELETE?????????????? SELECT ?? SQLite ?????????????
????1 ????? rawQuery() ?????? SELECT ???
??????? query() ????????????????
????Raw Queries
???????? API ?????rawQuery() ??????????????????????????????? SQL SELECT ??????磺
????Cursor c=db.rawQuery(
????"SELECT name FROM sqlite_master WHERE type='table' AND name='mytable'"?? null);
???????????????У??????? SQLite ?????sqlite_master????? table ??????????????????? cursor ??????????????????????????????
???????????????????????????????????????磬????????????????????????????????????????? query() ??????????
????Regular Queries
????query() ?????? SELECT ???ι????????SELECT ?????????? query() ??????????????磺????????????????????????WHERE ???????????????λ?ò????????? WHERE ??????λ?ò????????GROUP BY ??????HAVING ??????
??????????????????????????? null???????????????ο????д???

 

String[] columns={"ID"?? "inventory"};
String[] parms={"snicklefritz"};
Cursor result=db.query("widgets"?? columns?? "name=?"??parms?? null?? null?? null);

????????α?
???????????????в????????????? Cursor?????? Android ?? SQLite ??????α?????α???????
?????????? getCount() ???????????????ж???????
??????? moveToFirst()?? moveToNext()?? ?? isAfterLast() ???????????м????
??????? getColumnNames() ??????????
??????? getColumnIndex() ???????κ??
??????? getString()??getInt() ??????????????ε??????????
??????? requery() ??????????в??????α?
??????? close() ????????α??????
???????磬?????????? mytable ??

 

Cursor result=db.rawQuery("SELECT ID?? name?? inventory FROM mytable");
result.moveToFirst();
while (!result.isAfterLast()) {
int id=result.getInt(0);
String name=result.getString(1);
int inventory=result.getInt(2);
// do something useful with these
result.moveToNext();
}
result.close();

?????? Android ????? SQLite ???????????
??????????????????????????????ù????????????????????????????????????????? API????? Android ?????????????????????????????????
?????????????????? sqlite3 ???????????????? adb shell ?????????????????????????????? shell??????????·????? sqlite3 ??????????????????????????
????/data/data/your.app.package/databases/your-db-name
????????????????????????????????????????????????????? SQLite-aware ????????????????????????????????????????????????????????????????????豸?????????????????????
?????????????豸????????????????? adb pull ?????????? IDE ????????????????洢???????????????豸?????? adb push ???