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

在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?,第1张

概述在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?基本上,我想获得与PRAGMA返回完全相同的结果集:cid,name,type,notnull,dflt_value和pk.虽然我知道通过C函数sqlite3_table_column_metadata获取此信息的另一种方法,但我更喜欢使用SELECT语句. 根据 doc PRAGMAs that 在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’);

不应该这样做吗?

总结

以上是内存溢出为你收集整理的在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?全部内容,希望文章能够帮你解决在SQLite中是否有PRAGMA table_info(‘mytable’)的等效SELECT语句?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1160420.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存