SQLite Forum

Windows x64 SQLite extensions...
Login

Windows x64 SQLite extensions...

(1) By anonymous on 2021-01-20 16:51:51 [link] [source]

Hi All,

I'm using a Pascal compiler under Windows 10 x64 and I'm trying to use the FTS5 extension (that it should be provided by a FTS5.dll). I cannot find any FTS5.dll under the download page and I don't have Visual Studio so, I can't compile myself, the provided sources.

I've spent 2 days to find on internet the possible link but without success.

Is there someone who has compiled this FTS5.dll for Windows 10 x64 ? I would really appreciate if you could share it.

Thank you and all the best

Laurent

(2.1) By Larry Brasfield (LarryBrasfield) on 2021-01-20 17:47:34 edited from 2.0 in reply to 1 [link] [source]

The mingw-w64 gcc builds are readily obtained for the modern Windows platform. The MingW-W64-builds builds are easy to install and work well for building SQLite and extensions for it. You don't need Visual Studio. Even if you wish to use the Microsoft compiler, that can be obtained with the DDK. (device development kit)

Building it yourself is far more secure than resorting to using DLL's you might find on the "internet". It's also easy to do, as you can see at the link.

(4) By Keith Medcalf (kmedcalf) on 2021-01-20 18:16:57 in reply to 2.1 [link] [source]

Note that later versions of the multilib toolchain that include the C/C++/Ada compilers only can be found here:

https://sourceforge.net/projects/mingw-w64/files/Multilib%20Toolchains%28Targetting%20Win32%20and%20Win64%29/ray_linn/

The latest port there is GCC version 10.2

(5) By Keith Medcalf (kmedcalf) on 2021-01-20 18:46:50 in reply to 2.1 [source]

Also note that the Microsoft C/C++ compiler is free. (Do a Google search for Visual Studio Build Tools) You can download it here:

https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

Parent Page:
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

I think you can even get the clicky-pokey hooey-gooey for free too, if clickety-pokey hooey-gooeys float your boat.

The Microsoft compiler is an OK compiler for non-critical work. It is also a separate toolchain to produce x86 and x64 executables and not a unified tool chain like the mingw-w64 gcc ports.

If you are expecting to perform floating point arithmetic and are using a Microsoft compiler, be aware that the generated code is no longer IEEE-754 compliant though there are (apparently) ways to "force" compliance even with the x64 compiler. How one accomplishes this feat I do not know -- it is far more complicated than setting a compiler switch in that one has to bugger with the CRT startup code, I presume. Switching to a compiler that generates IEEE-754 compliant code by default seems much easier to me.

(3) By Keith Medcalf (kmedcalf) on 2021-01-20 18:11:04 in reply to 1 [link] [source]

If the version of SQLite3 distributed by the product you are using does not have FTS5 enabled, perhaps you should take that issue up with whomever built that distribution and omitted the -DSQLITE_ENABLE_FTS5 compile time flag when they were building their product.

All current versions of the amalgamation source code include FTS5, and it has been enabled in all distributed binaries obtained from the sqlite.org website.

(6) By HotAirBalloon (hotairballoon) on 2021-01-22 10:51:44 in reply to 1 [link] [source]

First of all, thank you for your feedbacks.

Since my first post, I know that th SQLite3.dll supports the FTS5 extension. What I've discovered is, I need to change some PRAGMA and parameters under my Pascal source to "activate" this FTS5 features.

Here is my code :

Before the connection
...
    ProviderName := 'SQLite';
    SpecificOptions.Add('EnableLoadExtension = True');
    SpecificOptions.Add('Direct = True');
    SpecificOptions.Add('EnableSharedCache = True');
    SpecificOptions.Add('ReadUncommitted = True');
    SpecificOptions.Add('BusyTimeout = 3000');
...

After the connection

...
    ExecSQL('PRAGMA cache_size = 400000;');
    ExecSQL('PRAGMA synchronous = OFF;');
    ExecSQL('PRAGMA journal_mode = OFF;');
    ExecSQL('PRAGMA locking_mode = EXCLUSIVE;');
    ExecSQL('PRAGMA count_changes = OFF;');
    ExecSQL('PRAGMA temp_store = MEMORY;');
    ExecSQL('PRAGMA auto_vacuum = NONE;');
    ExecSQL('PRAGMA enable_fts5;');

For the last line, I've tried different syntax like:
    ExecSQL('PRAGMA enable_fts5 = ON;');
And
    ExecSQL('PRAGMA enable_fts5 = TRUE;');

All this ExecSQL lines doesn't break my runtime module.
After that, what I read is to apply this "SELECT" to activate at least, the FTS5 features :

    ExecSQL('SELECT load_extension("SQLite.dll", "sqlite3_fts5_init");';

At this point, my application breaks on this line.
If I don't use this last line, my INSERT command under my FTS table breaks with this message : "No such module : FTS5"

As I already said, I've spent a lot of time under so many SQLite forums and Pascal/Delphi too...

What I can add too, under the SQLite Manager, using the same SQLite3.dll, by using script SQL, my INSERT command works find.

So, if someone has a tip or suggestion, I'll take it.

Once again, thank you all for your help.

(7) By Keith Medcalf (kmedcalf) on 2021-01-22 12:33:54 in reply to 6 [link] [source]

Once you open a connection execute the SQL command pragma compile_options; which will return to you a list of the options that were used to compile the SQLite3 library (just like a select statement). You should see ENABLE_FTS5 in the list if FTS5 was enabled in the library when the maker compiled it from the source code. If it is not listed then the FTS5 code was not enabled and you will have to speak to whomever is responsible for your wrapper as to how/why it is not included/enabled.

My SQLite3 has the following results for pragma compile_options because I have enabled a boatload of features (some of which are non-standard/custom):

ALLOW_COVERING_INDEX_SCAN
ALLOW_URI_AUTHORITY
COMPILER=gcc-10.2.0
DEFAULT_CACHE_SIZE=-1048576
DEFAULT_FOREIGN_KEYS
DEFAULT_PAGE_SIZE=4096
DEFAULT_RECURSIVE_TRIGGERS
DEFAULT_WAL_AUTOCHECKPOINT=256
DEFAULT_WAL_SYNCHRONOUS=1
DEFAULT_WORKER_THREADS=8
ENABLE_8_3_NAMES=1
ENABLE_API_ARMOR
ENABLE_BYTECODE_VTAB
ENABLE_COLUMN_METADATA
ENABLE_COLUMN_USED_MASK
ENABLE_COSTMULT
ENABLE_CURSOR_HINTS
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS4
ENABLE_FTS5
ENABLE_JSON1
ENABLE_LOAD_EXTENSION
ENABLE_LOCKING_STYLE=1
ENABLE_MATH_FUNCTIONS
ENABLE_MEMORY_MANAGEMENT
ENABLE_PREUPDATE_HOOK
ENABLE_RBU
ENABLE_RTREE
ENABLE_SESSION
ENABLE_SNAPSHOT
ENABLE_STAT4
ENABLE_STMT_SCANSTATUS
ENABLE_UNKNOWN_SQL_FUNCTION
ENABLE_UPDATE_DELETE_LIMIT
EXPLAIN_ESTIMATED_ROWS
EXTRA_INIT=core_init
HAVE_ISNAN
LIKE_DOESNT_MATCH_BLOBS
MAX_ATTACHED=15
MAX_WORKER_THREADS=16
SOUNDEX
STAT4_SAMPLES=64
TEMP_STORE=1
THREADSAFE=1
USE_DATETIME_NEW
USE_PRECISE_TIME
USE_QUADMATH
USE_URI

The (DLL) build available from the website look something like this:

COMPILER=msvc-1500
ENABLE_BYTECODE_VTAB
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS4
ENABLE_FTS5
ENABLE_GEOPOLY
ENABLE_JSON1
ENABLE_RTREE
ENABLE_STMTVTAB
MAX_TRIGGER_DEPTH=100
TEMP_STORE=1
THREADSAFE=1

(8) By Keith Medcalf (kmedcalf) on 2021-01-22 12:50:34 in reply to 6 [link] [source]

You can try this one: http://www.dessus.com/files/fts5.dll

It was built using
>cl /Ox /MT /LD fts5.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

from the current (3.35) tip of trunk.

But really, you should be using whatever your wrapper-writer is providing as part of their sqlite3 wrapper package ...