How can I enable FTS5 in SQLite?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
waheed
Posts: 16
Joined: Mon 02 Nov 2009 19:47
Location: Kuwait

How can I enable FTS5 in SQLite?

Post by waheed » Sat 11 May 2019 06:10

I'm using UniDAC 7.4, but I don't see where I enable FTS5 for SQLite. FTS5 is included in v.3.9 but not enabled by default except when I use "--enable-fts5" option when running the configure script. https://sqlite.org/fts5.html
But where can I enable it in UniConnection?
I'm using DirectMode=True

I found this in the documentation:

Code: Select all

UniConnection.ExecSQL('SELECT load_extension(''C:\ext.dll'', ''sqlite3_ext_init'');');
so I replaced it by:

Code: Select all

UniConnection1.ExecSQL('SELECT load_extension(''C:\sqlite\sqlite3.exe'', ''sqlite3_fts5_init'');');
But still it didn't work, it gave me (The specified procedure could not be found) error

MaximG
Devart Team
Posts: 1337
Joined: Mon 06 Jul 2015 11:34

Re: How can I enable FTS5 in SQLite?

Post by MaximG » Wed 15 May 2019 08:09

Please follow the steps to work with FTS5 and UniDAC in Direct Mode:

1. Compile Loadable Extension with FTS5 support as described in the docs: https://www.sqlite.org/loadext.html. On Windows, you’ll get a DLL file – you can name it fts5.dll, for example.
2. Enable support for Loadable Extension : UniConnection.SpecificOptions.Values['EnableLoadExtension'] := 'True';
3. Set the path to fts5.dll when downloading the extension (for example, to C:\fts5.dll): UniConnection.ExecSQL('SELECT load_extension(''C:\fts5.dll'', ''sqlite3_fts5_init'');');

The next version of UniDAC will support FTS5 in Direct Mode by default.

Post Reply