How can a data dictionary list generated columns alongside ordinary columns?
table_xinfo extends table_info with generated or hidden columns and a flag describing the kind of column.
SQLite example and interpretation
A table stores milliseconds and derives seconds. A dictionary should show both. An importer must distinguish computed columns from writable inputs.
CREATE TABLE r(ms INTEGER,sec REAL AS(ms/1000.0));
SELECT name,hidden FROM pragma_table_xinfo('r') ORDER BY cid;Result [["ms", 0], ["sec", 2]]
中文
如何在数据字典里同时列出普通列和生成列?
table_xinfo 扩展了 table_info,额外报告生成列或隐藏列,并通过 hidden 字段标记列的性质。
SQLite 示例与适用条件
表中保存毫秒数并派生秒数,字典应能看到两列。导入器不能把所有列都当作可直接写入的字段。
CREATE TABLE r(ms INTEGER,sec REAL AS(ms/1000.0));
SELECT name,hidden FROM pragma_table_xinfo('r') ORDER BY cid;结果 [["ms", 0], ["sec", 2]]