开发者

Alternative for CREATE VIRTUAL TABLE IF NOT EXISTS

开发者 https://www.devze.com 2023-02-10 13:55 出处:网络
According to CREATE VIRTUAL TA开发者_运维百科BLE syntax, IF NOT EXISTS clause is not available.

According to CREATE VIRTUAL TA开发者_运维百科BLE syntax, IF NOT EXISTS clause is not available.

How should I handle the case when the virtual table already exists without using DROP TABLE IF EXISTS?

I want to use rtree and fts module.


You can use

select DISTINCT tbl_name from sqlite_master where tbl_name = ?

Then bind the virtual table name to your statement and call sqlite3_step(). If you get SQLITE_ROW back, then your table exists. To be certain that it is a virtual table, check the rootpage column for '0'.


This is now supported since sqlite 3.7.11.

changelog

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号