SQLiteDatabase 增删改查参数说明
来源:互联网 发布:虚拟串口调试软件 编辑:程序博客网 时间:2024/05/21 20:29
SQLiteDataBase对象的query()接口:
public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy,String limit)
table The table name to compile the query against.(要查询的表名.)columns A list of which columns to return. Passing null will return all columns, which is discouraged to prevent reading data from storage that isn't going to be used.(想要显示的列,若为空则返回所有列,不建议设置为空,如果不是返回所有列)selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows for the given table.(where子句,声明要返回的行的要求,如果为空则返回表的所有行。)selectionArgs You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.( where子句对应的条件值 )groupBy A filter declaring how to group rows, formatted as an SQL GROUP BY clause (excluding the GROUP BY itself). Passing null will cause the rows to not be grouped.(分组方式,若为空则不分组.)having A filter declare which row groups to include in the cursor, if row grouping is being used, formatted as an SQL HAVING clause (excluding the HAVING itself). Passing null will cause all row groups to be included, and is required when row grouping is not being used.(having条件,若为空则返回全部(不建议))orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered.(排序方式,为空则为默认排序方式)limit Limits the number of rows returned by the query, formatted as LIMIT clause. Passing null denotes no LIMIT clause.(限制返回的记录的条数,为空则不限制)
Query the given table, returning a Cursor
Parameters
Returns
- A
Cursor
object, which is positioned before the first entry. Note that Cursor
s are not synchronized, see the documentation for more details.
示例:
ContentValues cv =
new
ContentValues();
String[] args = {String.valueOf("a")};
query("user", new String[] {
SQLiteDataBase对象的insert()接口:
public long insert (String table, String nullColumnHack, ContentValues values)
Convenience method for inserting a row into the database.
Parameters
null
. SQL doesn't allow inserting a completely empty row without naming at least one column name. If your provided values
is empty, no column names are known and an empty row can't be inserted. If not set to null, the nullColumnHack
values
Returns
- the row ID of the newly inserted row, or -1 if an error occurred
示例:
ContentValues cv =
new
ContentValues();
cv.put(
"username"
,
"a");cv.put(
"password"
,
"b");insert("user",
null
, cv);
SQLiteDataBase对象的update()接口:
public int update (String table, ContentValues values, String whereClause, String[] whereArgs)
Convenience method for updating rows in the database.
Parameters
whereArgs
the group of args to deal with(whereClause语句中表达式的?占位参数列表)
Returns
- the number of rows affected
ContentValues cv =
new
ContentValues();
cv.put(
"username"
,
"c");cv.put(
"password"
,
"d");String[] args = {String.valueOf("a")};
update("user", cv,
"username=?"
,args)
SQLiteDataBase对象的delete()接口:
public int delete (String table, String whereClause, String[] whereArgs)
Convenience method for deleting rows in the database.
Parameters
whereArgs
the optional WHERE clause to apply when updating. Passing null will update all rows.(whereClause语句中表达式的?占位参数列表)
Returns
- the number of rows affected if a whereClause is passed in, 0 otherwise. To remove all rows and get a count pass "1" as the whereClause.
示例:
ContentValues cv =
new
ContentValues();
String[] args = {String.valueOf("c")};
delete("user",
"username=?"
, args);
0 0
- SQLiteDatabase 增删改查参数说明
- SQLiteDataBase的增删改查方法参数
- SQLiteDatabase的增删查改
- ContentProvider-SqliteDatabase实现增删查改(1)
- Android SQLiteDataBase的另一种增删改查
- SqliteDatabase 对多个表增删改查
- SQLiteDatabase(数据库的增删改查)
- 关于数据库SQLiteDatabase的增删改查四个方法的参数详解
- Android对SQLite的"增删改查"——SQLiteDatabase
- map的增删改查说明
- Android开发(10)使用SQLiteDatabase操作SQLite数据库实现增删改查(源码)
- Android开发(10)使用SQLiteDatabase操作SQLite数据库实现增删改查(源码)
- Android SQLiteDatabase 数据库操作(建立数据表,增删改查操作)
- Android中使用Sqlite数据库(三) 使用 SQLiteDatabase类实现 增删改查
- 赵雅智_使用SQLiteDatabase提供的增删改查方法及事务
- 关于Android中SQLiteDataBase的增删改查的基本使用
- 往SQLiteDatabase利用API或普通SQL语句增删改查数据详解
- 使用mongoVUE对mongoDB进行增删改查说明
- MySQL cluster 7.X集群部署配置
- java Log4j 配置说明
- 结构体浅析
- 高数上1-3
- Linux/Unix shell 参数传递到SQL脚本
- SQLiteDatabase 增删改查参数说明
- Spring整合freemarker发送邮件
- 求大神给一些关于Jquery Hibernate 等等相关资料和小案例
- SQLPlus命令详细说明
- 在Hadoop分布式集群环境下Mahout安装和运行K-means、协同过滤实例
- 函数指针
- Codeforces 364B 背包+贪心
- mysql索引总结----mysql 索引类型以及创建
- 黑马程序员--网络编程