2017-10-07 79 views
1

示例模式:如何获取虚拟表的名称?

CREATE VIRTUAL TABLE posts USING FTS5(title, body); 

选择表名:

SELECT name FROM sqlite_master WHERE type='table'; 

结果:

 
posts 
posts_data 
posts_idx 
posts_content 
posts_docsize 
posts_config 

如何获取导致只为虚表,没有*_data*_idx*_content*_docsize*_config

回答

1

FTS模块使用shadow tables来存储实际数据及其索引。

但这些都是“真实”的表,所以你可以简单地使用过滤器只得到sqlite_master条目虚表:

SELECT name 
FROM sqlite_master 
WHERE type = 'table' 
    AND sql LIKE 'CREATE VIRTUAL TABLE%';