加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语

发布时间:2020-12-12 19:08:08 所属栏目:百科 来源:网络整理
导读:在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?基本上,我想获得与PRAGMA返回完全相同的结果集:cid,name,type,notnull,dflt_value和pk.虽然我知道通过C函数sqlite3_table_column_metadata获取此信息的另一种方法,但我更喜欢使用SELECT语
在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?基本上,我想获得与PRAGMA返回完全相同的结果集:cid,name,type,notnull,dflt_value和pk.虽然我知道通过C函数sqlite3_table_column_metadata获取此信息的另一种方法,但我更喜欢使用SELECT语句. 根据 doc

PRAGMAs that return results and that have no side-effects can be
accessed from ordinary SELECT statements as table-valued functions.
For each participating PRAGMA,the corresponding table-valued function
has the same name as the PRAGMA with a 7-character “pragma_” prefix.
The PRAGMA argument and schema,if any,are passed as arguments to the
table-valued function.

For example,information about the columns in an index can be read
using the index_info pragma as follows:

PRAGMA index_info(‘idx52’); Or,the same content can be read using:

SELECT * FROM pragma_index_info(‘idx52’);

不应该这样做吗?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读