diff options
Diffstat (limited to 'db/conn.rkt')
| -rw-r--r-- | db/conn.rkt | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/db/conn.rkt b/db/conn.rkt index e083d94..793cf03 100644 --- a/db/conn.rkt +++ b/db/conn.rkt @@ -12,11 +12,9 @@ (define (connect! #:path [path 'memory]) (cond - [(connection? (current-conn)) - (printf "Database connection already exists: ~e\n" (current-conn))] + [(connection? (current-conn)) (printf "Database connection already exists: ~e\n" (current-conn))] [else - (current-conn (sqlite3-connect #:database path - #:mode 'create)) + (current-conn (sqlite3-connect #:database path #:mode 'create)) (printf "Created database connection at path: ~a\n" path)])) (define (disconnect!) @@ -25,10 +23,14 @@ (current-conn #f)) (define-syntax-rule (with-db body ...) - (begin (connect!) body ...)) + (begin + (connect!) + body ...)) (define-syntax-rule (with-tx body ...) - (call-with-transaction (current-conn) (λ () body ...))) + (call-with-transaction (current-conn) + (λ () + body ...))) (module+ test (require rackunit) @@ -37,5 +39,4 @@ (check-true (connection? (current-conn))) (disconnect!) (check-equal? (current-conn) #f) - (with-db - (check-true (connection? (current-conn))))) + (with-db (check-true (connection? (current-conn))))) |