Commit Graph

19 Commits

Author SHA1 Message Date
Brian J. Cardiff c08fc2befc
Update to crystal-db 0.12.0 (refactor connection factory) (#91)
* Refactor connection builder

* Update for ConnectionBuilder

* Update to crystal-db ~> 0.12.0

* run crystal tool format
2023-06-23 15:36:08 -03:00
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
Ryan Westlund 55b8399d7e
Enable REGEXP by connecting Crystal's stdlib Regex (#62) 2020-11-11 15:00:40 -03:00
Brian J. Cardiff 8586182fd8
Update crystal-db ~> 0.10.0 and Crystal 0.35.0 for logging support (#58)
* Update crystal-db for logging support

* Update sample

* Update to crystal-db ~> 0.10.0
2020-09-30 11:34:25 -03:00
Brian J. Cardiff 5303492839 Upgrade to Crystal v0.30.0 2019-07-30 19:17:12 -03:00
Brian J. Cardiff 058c78f837 Annotate return types of abstract methods 2019-07-29 10:25:46 -03:00
Brian J. Cardiff 4b4441bb37 Code cleanup due to Crystal >= 0.28.0 2019-06-06 12:36:16 -03:00
Brian J. Cardiff c621a9b701
Upgrade to Crystal 0.28.0 (#38) 2019-04-18 15:58:02 -03:00
Benoist 616af3ba1d better closing checks (#23) 2017-05-29 15:20:32 -03:00
Brian J. Cardiff bda4b8e184 update to crystal-db ~> 0.3.1 2016-12-15 14:49:39 -03:00
Brian J. Cardiff 46709eab00 add spec for transactions and nested transactions (#12) 2016-12-14 12:27:43 -03:00
Brian J. Cardiff 242e3dfa02 update to crystal-db feature/unprepared branch 2016-12-03 17:52:24 -03:00
Brian J. Cardiff f70c1d89e2 fix: avoid closing statements twice, they are closed in base connection 2016-08-30 16:17:49 -03:00
Brian J. Cardiff 881ef79893 Merge master changes into db branch.
Refactor flags, add option to dump from one database connection to another.

Merge commit '135f33d9eac82c63a48b14942c8eff647c070410' into db

# Conflicts:
#	spec/database_spec.cr
#	src/sqlite3/lib_sqlite3.cr
#	src/sqlite3/result_set.cr
#	src/sqlite3/statement.cr
2016-06-23 17:27:58 -03:00
Brian J. Cardiff 07ba7d6d51 rename types 2016-02-18 18:52:49 -03:00
Brian J. Cardiff 503868f434 update to last db design 2016-02-18 18:52:49 -03:00
Brian J. Cardiff dd5c10ba6e column types
update to connection_string
remove Driver.quote
2016-02-18 18:52:48 -03:00
Brian J. Cardiff 2e6e6ed7e5 add insert/select per type specs
add last_insert_id
add Driver.quote
2016-02-18 18:52:48 -03:00
Brian J. Cardiff add75d86bf update to refactored api
refactor specs
2016-02-18 18:52:48 -03:00