diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-29 13:45:29 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-29 13:45:29 +0100 |
| commit | 086ba55a15dc04914cba500f7ead61dec5490162 (patch) | |
| tree | c2147f7f7d7802b43b44e90c37de802761a31b8c /db/conn.rkt | |
| parent | f54e5bda270d55a91f62be9cacbbcd1d3f1a0884 (diff) | |
Add debug facilities.
Diffstat (limited to 'db/conn.rkt')
| -rw-r--r-- | db/conn.rkt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/db/conn.rkt b/db/conn.rkt index 42a75c0..11abc19 100644 --- a/db/conn.rkt +++ b/db/conn.rkt @@ -1,22 +1,27 @@ #lang racket -(require db) - (provide current-conn connect! disconnect! with-db with-tx) +(require db + "../debug.rkt") + (define current-conn (make-parameter #f)) (define (connect! #:path [path 'memory]) - (unless (connection? (current-conn)) - (current-conn (sqlite3-connect #:database path #:mode 'create)))) + (if (connection? (current-conn)) + (debug-log (format "Connection already instantiated: ~a" (current-conn))) + (begin + (current-conn (sqlite3-connect #:database path #:mode 'create)) + (debug-log (format "Connection instantiated: ~a" (current-conn)))))) (define (disconnect!) (disconnect (current-conn)) - (current-conn #f)) + (current-conn #f) + (debug-log "Connection disconnected.")) (define-syntax-rule (with-db body ...) (begin |