Detect the FTS3 extension in SQLite3

孤人 提交于 2019-12-07 04:56:21

问题


What is the SQLite query to detect if the FTS3 extension module is installed? Or is it possible to get a list of installed extensions with an SQLite3 query? It has to work with pysqlite2.

I know that I can get the list of tables using SELECT * FROM sqlite_master, I'd like to get something similar for the list of extensions. I also know that CREATE VIRTUAL TABLE v USING FTS3 (t TEXT) succeeds iff FTS3 is installed, but I'd like to get a query without side effects (not even creating a temporary table).

As a workaround I have opened the ":memory:" database, and issued the CREATE VIRTUAL TABLE command above.


回答1:


There is no way to do it in SQLite at the moment; it forgets what it has loaded and cannot report it even if it wanted to (I checked the source to the code that does the loading, and the critical information that describes what is loaded is just not stored). It is known (see Wish List at the bottom of that page) that it would be good to retain this information, but it does not appear to be retained as yet.

As a consequence, the only thing you can do is your current workaround – trying it and seeing if it works. Sorry I can't offer anything else.



来源:https://stackoverflow.com/questions/2482868/detect-the-fts3-extension-in-sqlite3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!