最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
sqlite数据库如何判断表、字段是否存在
时间:2022-06-29 10:16:21 编辑:袖梨 来源:一聚教程网
1.判断表名是否存在:
select * from sqlite_master
sqlite_master 的表结构如下:
type |name |tbl_name |rootpage |sql
示范查询结果;
=============
type>>table
name>>android_metadata
tbl_name>>android_metadata
rootpage>>3
sql>>CREATE TABLE android_metadata (locale TEXT)
=============
type>>table
name>>TalkVO
tbl_name>>TalkVO
rootpage>>4
sql>>CREATE TABLE TalkVO (content text,videoPath text,img text,name text,issend BLOB,isPlaying integer,uid integer,_id integer PRIMARY KEY)
2.判断字段是否存在
PRAGMA table_info([TalkVO])
必须 大写,结构如下:
cid | name | type | notnull | dflt_value | pk
示范查询结果;
PRAGMA table_info([TalkVO])
=============
cid>>0
name>>content
type>>text
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>1
1name>>videoPath
type>>text
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>2
name>>img
type>>text
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>3
name>>name
type>>text
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>4
name>>issend
type>>BLOB
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>5
name>>isPlaying
type>>integer
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>6
name>>uid
type>>integer
notnull>>0
dflt_value>>null
pk>>0
=============
cid>>7
name>>_id
type>>integer
notnull>>0
dflt_value>>null
pk>>1
相关文章
- 守望黎明如何转职业 04-20
- 乱斗西游2怎么抽哪吒 04-20
- 女神异闻录夜幕魅影烧鸟外卖其一怎么攻略 女神异闻录夜幕魅影烧鸟外卖其一攻略方法 04-20
- 碧蓝航线鲤μ兵装获得方法 碧蓝航线鲤μ兵装获得方法 04-20
- 明日方舟BB-EX-5突袭攻略 明日方舟BB-EX-5突袭怎么打 04-20
- 射雕手游金盏罗盘获取位置介绍 射雕手游金盏罗盘怎么获取 04-20