SQLiteDatabase中queryinsertupdatedelete方法参数说明
Posted IT成长助手
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQLiteDatabase中queryinsertupdatedelete方法参数说明相关的知识,希望对你有一定的参考价值。
1、SQLiteDataBase对象的query()接口
public Cursor query (String table, String[] columns, String selection, String[] selectionArgs,String groupBy, String having,String orderBy,String limit)
示例:
ContentValues cv = new ContentValues();
String[] args = {String.valueOf("a")};
query("user",new String[] { "username","password" },"username=?", args,null,null,null, null);
2、SQLiteDataBase对象的insert()接口:
publiclong insert (String table, String nullColumnHack, ContentValues values)
示例:
ContentValues cv = new ContentValues();
cv.put("username", "lanxiaofang");
cv.put("password", "123456");
insert("user", null,cv);
3、SQLiteDataBase对象的update()接口:
publicint update (String table, ContentValues values, String whereClause, String[] whereArgs)
示例:
ContentValues cv = new ContentValues();
cv.put("username", "lanxiao");
cv.put("password", "123456");
String[] args = {String.valueOf("lanxiaofang")};
update("user",cv, "username=?",args)
4、SQLiteDataBase对象的delete()接口:
publicint delete (String table, String whereClause, String[] whereArgs)
示例:
ContentValues cv = new ContentValues();
String[] args = {String.valueOf("lanxiaofang")};
delete("user", "username=?",args);
以上是关于SQLiteDatabase中queryinsertupdatedelete方法参数说明的主要内容,如果未能解决你的问题,请参考以下文章
在 SQLiteDatabase.query() 中使用 String[] selectionArgs
拖放从 SQLiteDatabase 填充的 RecyclerView
在 SQliteDatabase 中保存图像时出现 OutOfMemoryError
SQLiteDatabase.openDatabase(...) 与 getWritableDatabase