shard-crystal-sqlite3/spec
Luis Lavena 84857724c1
Automatically set PRAGMAs using connection query params (#85)
* Automatically set PRAGMAs using connection query params

Introduce the flexibility to adjust certain PRAGMAs of the SQLite3
connection without having to hardcode those in your codebase (and wait
for compilation).

This allows applications to use `DATABASE_URL` to dynamically fine tune
their SQLite3 configuration.

The change complements `#setup_connection` that offers, via code, the
option to perform queries on setup of each connection.

Only a few PRAGMAs necessary to allow more performant concurrent reads
and reduce write locking.

These pragmas are detected and combined in a single SQL string to reduce
to 1 the number of calls to `sqlite3_exec` C function.

There is no validation of supplied values as SQLite3 automatically
ignores incorrect values for these pragmas.

Closes #84

References:
- https://www.sqlite.org/pragma.html

* Simplify PRAGMA mapping and detection

No longer prefix PRAGMAS with `_`, so the mapping between the real
SQLite3 pragmas and the usage in the URI is more direct.

Use macros instead of case to detect pragmas from URI params and return
those as NamedTuple.

* Update README.md

---------

Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>
2023-02-18 17:06:09 -03:00
..
connection_spec.cr Automatically set PRAGMAs using connection query params (#85) 2023-02-18 17:06:09 -03:00
db_spec.cr Fix timestamp reading issue (#68) 2021-02-28 14:18:08 -03:00
driver_spec.cr Code cleanup due to Crystal >= 0.28.0 2019-06-06 12:36:16 -03:00
pool_spec.cr Code cleanup due to Crystal >= 0.28.0 2019-06-06 12:36:16 -03:00
result_set_spec.cr Fix timestamp reading issue (#68) 2021-02-28 14:18:08 -03:00
spec_helper.cr Upgrade to Crystal 0.28.0 (#38) 2019-04-18 15:58:02 -03:00