如表结构
表名:usersconfig
表的列名(字段) uid
userName
active
sToken
credit_fp
lets
一条数据的组成,由 表的列名(字段) = 值 组成
如下 称为一条数据
{
表的列名1(字段1) = 值,
表的列名2(字段2) = 值,
表的列名3(字段3) = 值,
表的列名4(字段4) = 值,
表的列名5(字段5) = 值
}
创建表的命令语句为
@"create table if not exists usersconfig(ID INTEGER PRIMARY KEY AUTOINCREMENT,uid verchar(20) not null,userName verchar(20) not null,active int not null,sToken verchar(50) not null,credit_fp verchar(50),lets text not null)"
对应的增删查改
方法列如下
--数据库的建立
create table team
(
-- 创建名字为team的table
stu_id integer primary key autoincrement,
stu_name varchar(100),
stu_password varchar(100),
stu_login varchar(100)
)
--添加信息
insert into team(stu_name,stu_password,stu_login) values('xiaming','123456','xm')
insert into team(stu_name,stu_password,stu_login) values('zhangsan','123456',' zs')
--查询信息
select *from team
--删除信息
delete from team where stu_id=3
对应的 usersconfig 表 操作命令如下
查列表数量 (根据 uid 字段 查询表中数据条数)
@"select count(*) from usersconfig where uid = '%@'"
更新数据
@"update usersconfig set active = '%@', sToken = '%@', credit_fp = '%@' where uid = '%@'"
插入数据(表的列名对应,插入一条数据)
@"insert into usersconfig (uid, userName, active, sToken, credit_fp, lets) values ('%@', '%@', '%@', '%@', '%@', '%@')"
删除数据 (根据userName 字段 删除一条数据)
@"delete from usersconfig where userName = '%@'"