关于sqlite的学习小记,求各位大大指导

使用步骤:

1、继承sqlopenhelper

1.1、重载sqlopenhelper的oncerete和onupdate

2、主函数中,生成helper的实体对象,

1.1helper通过getdatabase方式获得数据库实体对象(database),此处分两种情况,如果数据库为空,则执行helper中oncreate函数,如果helper的版本比前一个数据库版本高,那么helper自动真系upgrade函数。

功能(增删查改CRUD):

1、更新数据

        contentvalues是一种以键值对的形势存储的数据结构,适用于int char double,string等几个通用数据类型 

database.insert("数据库名",null,contentvaluses)

database.updata("数据库名",contentvaluses,"name = ?",string),"name = ?",string这个表示插入的位置

database.updata("数据库名","条件",string),条件中有个?表示参数,string就是这个参数变量

database quary(表名,列名,约束条件,为约束条件中的占位符提供具体值,指定需要groupby的列(列名),对groupby的结果进行约束,指定结果排序方式,即order by)

,返回结果值cursor,这是一个“光标”,指向返回结构的第一行的首字母,关于cursor的解释http://blog.sina.com.cn/s/blog_618199e60101fskp.html

猜你喜欢

转载自blog.csdn.net/qq_23343197/article/details/78009104