python和sqlite3,检查我是否可以使用fts5扩展名? [英] python and sqlite3, check if I can use fts5 extension?

查看:600
本文介绍了python和sqlite3,检查我是否可以使用fts5扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现 FTS5 扩展程序已经发布。

什么是检查我的应用程序是否可以在用户系统上使用它的最佳方法?

只需根据发布页面 ??还是其他的东西?

解决方案

/这是以前编辑的OP帖子,但是我把它移到这里保留问题清晰



所以这感觉就像它可以工作,发现它在问题这里

  import sqlite3 
$ b $ con = sqlite3.connect(':memory:')
cur = con.cursor()
cur.execute('pragma compile_options;')
available_pragmas = cur.fetchall()
con.close()

print(available_pragmas)

if('ENABLE_FTS5',)in available_pragmas:
print ('YES')
else:
print('NO')

但奇怪的是,我在几台虚拟机上运行它,并且没有启用fts4,但我无忧无虑地使用它,也许它的fts3 / fts4是相同的,或者它可能完全错误。 p>

/编辑
文档中的

$ b


请注意,启用FTS3还会使FTS4可用。没有单独的SQLITE_ENABLE_FTS4编译时选项。 SQLite的构建既可以支持FTS3,也可以支持FTS4,或者它们都不支持。



I recently found out that FTS5 extension has been released.
What is the best way to check if my application can use it on users system?
Just python3 version check, or sqlite3.sqlite_version check according to release page?? Or something else?

解决方案

/ this was previously edit of the OP post, but I moved it down here to keep the question clear

so this feels like it could work, found it in the question here

import sqlite3

con = sqlite3.connect(':memory:')
cur = con.cursor()
cur.execute('pragma compile_options;')
available_pragmas = cur.fetchall()
con.close()

print(available_pragmas)

if ('ENABLE_FTS5',) in available_pragmas:
    print('YES')
else:
    print('NO')

But what is strange is that I run it in a few virtual machines, and none had fts4 enabled, yet I used it happily like nothing... maybe its fts3/fts4 being rather the same, or maybe its just all wrong.

/edit
from the documentation

Note that enabling FTS3 also makes FTS4 available. There is not a separate SQLITE_ENABLE_FTS4 compile-time option. A build of SQLite either supports both FTS3 and FTS4 or it supports neither.

这篇关于python和sqlite3,检查我是否可以使用fts5扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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