Overview
| Comment: | Allow to take zero SQL parameters |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
0d3df6790a58452429db1a09661d3262 |
| User & Date: | joel on 2019-03-09 03:59:13 |
| Other Links: | manifest | tags |
Context
|
2019-03-09
| ||
| 04:00 | Small fixes in dust check-in: e18e8fa4 user: joel tags: trunk | |
| 03:59 | Allow to take zero SQL parameters check-in: 0d3df679 user: joel tags: trunk | |
|
2019-03-08
| ||
| 00:01 | Change scribble command in makefile so that it can link to documentation for packages installed in user scope check-in: 7e52d6a3 user: joel tags: trunk | |
Changes
Modified code-docs/sqlite-tools.scrbl from [dda37e2d] to [de7cfd61].
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + + |
@section{Parameters}
@defparam[sqltools:dbc con connection? #:value "No DB connection!"]
The current database connection. This module assumes a single active connection and stores it in
this parameter so you don’t have to pass it to a function every time you execute a query. It’s
|
| ︙ |
Modified sqlite-tools.rkt from [74d52a42] to [044c6c3e].
| ︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - - + + |
(#:primary-key-cols (listof stringish?))
. ->* . string?)]
[make-insert/replace-query (stringish? (listof stringish?) . -> . string?)]
[make-insert-rows-query (stringish? (listof stringish?) (listof (listof stringish?)) . -> . string?)]
[make-select-query (stringish? (listof stringish?) #:where stringish? . -> . string?)]
;; Database operations
|
| ︙ | |||
220 221 222 223 224 225 226 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | + - + |
(for ([q (in-list qs)])
(query! q))))
;; Run a query with logging (if enabled) and return the result
(define (query! q . parameters)
(unless (good-connection?) (error "(query!) DB not connected"))
(log-query q)
(cond [(empty? parameters) (query-exec (sqltools:dbc) q)]
|
| ︙ | |||
247 248 249 250 251 252 253 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - + | ;; TESTING: database connection state and queries (module+ test (define TESTDB "SQLITE-TOOLS-TEST.sqlite") ;; Check that things start out uninitialized and that queries don’t work (check-equal? (sqltools:dbc) uninitialized-connection) (check-false (file-exists? TESTDB)) |
| ︙ |