Setting SQLite compile time parameters from etc.c.sqlite3

H. S. Teoh hsteoh at
Tue Mar 1 21:55:38 UTC 2022

On Tue, Mar 01, 2022 at 08:59:46PM +0000, data pulverizer via Digitalmars-d-learn wrote:
> Hello all,
> I'm not sure how to set the compile time parameters in D's SQLite
> module particular the items that take multiple parameters, for example
> in the C API manual `SQLITE_CONFIG_MMAP_SIZE` takes two
> `sqlite3_int64`. How do I set these?

These are not compile-time parameters. According to SQLite's
documentation, they are set at runtime using the sqlite3_config() API,
which is a C-style variadic function, so you can just pass however many
arguments are needed for that configuration item. I.e.:

	sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, 10_000_000_000, 30_000_000_000);

Since sqlite3_config is not thread-safe (according to the docs), you
must initialize it before any threads are started:

	shared static this() {
		sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, 10_000_000_000, 30_000_000_000);


When solving a problem, take care that you do not become part of the problem.

More information about the Digitalmars-d-learn mailing list