1. 1SQLiteDataBase对象的query()接口:
  2. public Cursor query (String table, String[] columns, String selection, String[] selectionArgs,
  3.                               String groupBy, String having,String orderBy,String limit)
  4.  
  5. Query the given table, returning a Cursor over the result set.
  6. Parameters
  7. table The table name to compile the query against.(要查询的表名.)
  8. 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.(想要显示的列,若为空则返回所有列,不建议设置为空,如果不是返回所有列)
  9. 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子句,声明要返回的行的要求,如果为空则返回表的所有行。)
  10. 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子句对应的条件值)
  11. 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.(分组方式,若为空则不分组.)
  12. 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条件,若为空则返回全部(不建议))
  13. 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.(排序方式,为空则为默认排序方式)
  14. limit Limits the number of rows returned by the query, formatted as LIMIT clause. Passing null denotes no LIMIT clause.(限制返回的记录的条数,为空则不限制)
  15. Returns
  16.  
  17. A Cursor object, which is positioned before the first entry. Note that Cursors are not synchronized, see the documentation for more details.
  18.  
  19. 示例:
  20. ContentValues cv = new ContentValues();
  21. String[] args = {String.valueOf("a")};
  22.  
  23. query("user", new String[] { "username","password" },"username=?", args, null,null, null, null);
  24.  
  25. 2、SQLiteDataBase对象的insert()接口:
  26. public long insert (String table, String nullColumnHack, ContentValues values)
  27.  
  28. Convenience method for inserting a row into the database.
  29. Parameters
  30. table the table to insert the row into(要插入数据的表的名称)
  31. nullColumnHack optional; may be null. SQL doesn't allow inserting a completely empty row without naming at least one column name. If your provided valuesis empty, no column names are known and an empty row can't be inserted. If not set to null, the nullColumnHack parameter provides the name of nullable column name to explicitly insert a NULL into in the case where your values is empty.( 当values参数为空或者里面没有内容的时候,我们insert是会失败的(底层数据库不允许插入一个空行),为了防止这种情况,我们要在这里指定一个 列名,到时候如果发现将要插入的行为空行时,就会将你指定的这个列名的值设为null,然后再向数据库中插入。)
  32. values this map contains the initial column values for the row. The keys should be the column names and the values the column values(一个ContentValues对象,类似一个map.通过键值对的形式存储值。)
  33. Returns
  34.  
  35. the row ID of the newly inserted row, or -1 if an error occurred
  36.  
  37. 示例:
  38. ContentValues cv = new ContentValues();
  39. cv.put("username", "a");
  40. cv.put("password", "b");
  41. insert("user", null, cv);
  42.  
  43. 3、SQLiteDataBase对象的update()接口:
  44. public int update (String table, ContentValues values, String whereClause, String[] whereArgs)
  45.  
  46. Convenience method for updating rows in the database.
  47. Parameters
  48. table the table to update in(要更新的表名)
  49. values a map from column names to new column values. null is a valid value that will be translated to NULL.(一个ContentValues对象,类似一个map.通过键值对的形式存储值。)
  50. whereClause
  51.  
  52. whereArgs the optional WHERE clause to apply when updating. Passing null will update all rows.(可选的where语句)
  53.  
  54. the group of args to deal with(whereClause语句中表达式的?占位参数列表)
  55. Returns
  56.  
  57. the number of rows affected
  58.  
  59. ContentValues cv = new ContentValues();
  60. cv.put("username", "c");
  61. cv.put("password", "d");
  62. String[] args = {String.valueOf("a")};
  63. update("user", cv, "username=?",args)
  64.  
  65. 4、SQLiteDataBase对象的delete()接口:
  66. public int delete (String table, String whereClause, String[] whereArgs)
  67.  
  68. Convenience method for deleting rows in the database.
  69. Parameters
  70. table the table to delete from
  71. whereClause
  72.  
  73. whereArgs the optional WHERE clause to apply when deleting. Passing null will delete all rows.(可选的where语句)
  74. the optional WHERE clause to apply when updating. Passing null will update all rows.(whereClause语句中表达式的?占位参数列表)
  75. Returns
  76.  
  77. 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.
  78.  
  79. 示例:
  80. ContentValues cv = new ContentValues();
  81. String[] args = {String.valueOf("c")};
  82. delete("user", "username=?", args);

SQLiteDatabase中query、insert、update、delete方法参数说明的更多相关文章

  1. SQL Server 2008中SQL增强之三:Merge(在一条语句中使用Insert,Update,Delete) 一条语句实现两表同步(添加、删除、修改)

    MERGE 目标表 USING 源表 ON 匹配条件 WHEN MATCHED THEN 语句 WHEN NOT MATCHED THEN 语句; http://www.chinaz.com/prog ...

  2. sql中同一个Trigger里同时包含Insert,Update,Delete

    sql中同一个Trigger里同时包含Insert,Update,Delete SQLServer是靠Inserted表和Deleted表来处理的,判断一下就可以了,只不过比ORACLE麻烦一点 cr ...

  3. PHP5: mysqli 插入, 查询, 更新和删除 Insert Update Delete Using mysqli (CRUD)

    原文: PHP5: mysqli 插入, 查询, 更新和删除  Insert Update Delete Using mysqli (CRUD) PHP 5 及以上版本建议使用以下方式连接 MySQL ...

  4. mysql数据恢复 insert\update\delete 工具MyFlash

    一.简介MyFlash是由美团点评公司技术工程部开发维护的一个回滚DML操作的工具.该工具通过解析v4版本的binlog,完成回滚操作.相对已有的回滚工具,其增加了更多的过滤选项,让回滚更加容易. 该 ...

  5. LINQ体验(9)——LINQ to SQL语句之Insert/Update/Delete操作

    我们继续讲解LINQ to SQL语句,这篇我们来讨论Insert/Update/Delete操作.这个在我们的程序中最为常用了.我们直接看例子. Insert/Update/Delete操作 插入( ...

  6. 关于MyBatis mapper的insert, update, delete返回值

    这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the Sql ...

  7. [Hive - LanguageManual] DML: Load, Insert, Update, Delete

    LanguageManual DML Hive Data Manipulation Language Hive Data Manipulation Language Loading files int ...

  8. insert update delete 语法 以及用法

    insert update delete 被称为 数据定义语句语句 也就是数据的增加 修改 删除 其中不包括查询 譬如: create database -创建数据库 alter database - ...

  9. mybatis select/insert/update/delete

    这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the Sql ...

  10. mysql 事务是专门用来管理insert,update,delete语句的,和select语句一点不相干

    1.mysql 事务是专门用来管理insert,update,delete语句的,和select语句一点不相干 2.一般来说,事务是必须满足4个条件(ACID): Atomicity(原子性).Con ...

随机推荐

  1. TestNG测试执行顺序

    1.preserve-order属性,之前一直认为preserve-order属性是控制配置方法的执行顺序的,其实不是,preserve-order主要是控制test下节点classes执行顺序的 例 ...

  2. readbook:自己设计mvc框架,java类似struts2的实现

    如果你不能简单说清楚,就是你还没有完全明白.——爱因斯坦 need things: 1.操作xml文档 dom4j 等开源类库 2. dtd的验证 等知识储备 * n到n次     ? 0到1次    ...

  3. C# 操作Excel,使用EPPlus

    EPPlus下载地址:http://www.codeplex.com/EPPlus 引用命名空间: using OfficeOpenXml; using OfficeOpenXml.Table; us ...

  4. [ CodeVS冲杯之路 ] P1166

    不充钱,你怎么AC? 题目:http://codevs.cn/problem/1166/ 有许久没有刷题了,忙着过中秋去了嘿嘿 首先它的每一行是独立的,我们可以直接把它拆分成 n 互不相关的子问题做 ...

  5. 翻煎饼_简单模拟_C++

    一.题目描述(懒人可直接跳过看题目概述) 题目来源: SWUST OJ  题目0254 http://acm.swust.edu.cn/problem/0254/ 二.问题概述 给出一列数,每次可将包 ...

  6. 转: wireshark过滤规则

    转: http://blog.sina.com.cn/s/blog_48a0f2740100ka71.html WireShark过滤语法 1.过 滤IP,如来源IP或者目标IP等于某个IP 例子: ...

  7. IE常见兼容问题

    图片有边框 CSS 增加 border:0; border,在IE 模式下不算在宽度内;

  8. Codeforces Round #299 (Div. 2) B. Tavas and SaDDas【DFS/*进制思维/位运算/一个数为幸运数,当且仅当它的每一位要么是4,要么是7 ,求小于等于n的幸运数个数】

    B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard ...

  9. Xamarin XAML语言教程通过ProgressTo方法对进度条设置

    Xamarin XAML语言教程通过ProgressTo方法对进度条设置 在ProgressBar中定义了一个ProgressTo方法,此方法也可以用来对进度条当前的进行进行设置,ProgressTo ...

  10. c#作业(2班)

    第二章 1.编写一个控制台程序,要求: 接受从控制台输入的姓名,如:张三 程序响应:你好,张三. 在代码中使用规范的注释,说明程序的功能 编译程序,并执行. 程序执行效果如下图: using Syst ...