检测 SQLite3 中的 FTS3 扩展 [英] Detect the FTS3 extension in SQLite3

查看:46
本文介绍了检测 SQLite3 中的 FTS3 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检测是否安装了 FTS3 扩展模块的 SQLite 查询是什么?或者是否可以通过 SQLite3 查询获取已安装扩展的列表?它必须与 pysqlite2 一起使用.

我知道我可以使用 SELECT * FROM sqlite_master 获取表列表,我想为扩展列表获取类似的内容.我也知道 CREATE VIRTUAL TABLE v USING FTS3 (t TEXT) 如果安装了 FTS3 会成功,但我想获得没有副作用的查询(甚至不创建临时表).>

作为一种解决方法,我打开了 ":memory:" 数据库,并发出了上面的 CREATE VIRTUAL TABLE 命令.

解决方案

目前在 SQLite 中没有办法做到;它忘记了它加载了什么,即使它想也不能报告它(我检查了 source 到执行加载的代码,而描述加载内容的关键信息并未存储).它是已知(参见愿望清单,网址为该页面的底部)表示保留此信息会很好,但似乎尚未保留.

因此,您唯一能做的就是您当前的解决方法——尝试一下,看看它是否有效.抱歉,我不能提供其他任何东西.

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.

解决方案

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.

这篇关于检测 SQLite3 中的 FTS3 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆