3

I'm having trouble locating how to find out if my sqlite3 db is fts (four preferably) enabled.

I'm having trouble using the MATCH command, and I'm guessing it's because the db doesn't have FTS capabilities.

Google mostly returns mysql info about this.

Mou某
  • 556
  • 3
  • 10
  • 32

1 Answers1

8

You could call the sqlite3_compileoption_get() C function, or look at the output of PRAGMA compile_options or the sqlite_compileoption_get() SQL function:

WITH opts(n, opt) AS (
  VALUES(0, NULL)
  UNION ALL
  SELECT n + 1,
         sqlite_compileoption_get(n)
  FROM opts
  WHERE sqlite_compileoption_get(n) IS NOT NULL
)
SELECT opt
FROM opts
WHERE opt LIKE '%FTS%';

ENABLE_FTS3
ENABLE_FTS4

This does not work for dynamically loaded extensions, though.

Community
  • 1
  • 1
CL.
  • 173,858
  • 17
  • 217
  • 259
  • Good answer! Can you clarify if sqlite supports *dynamic* linked extensions and if this method would still detect FTS if deployed that way, if it does? – Mark Setchell Nov 21 '15 at 11:33