blob: e35cc6939df516a2ac78a3146ceaea09c3310b01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!
Module for handling SQL DB primitives. Note that GN queries should go into gn/data
!#
(define-module (gn db mysql)
#:use-module (json)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (ice-9 iconv)
#:use-module (ice-9 receive)
#:use-module (ice-9 string-fun)
#:use-module (rnrs base)
#:use-module (dbi dbi)
#:export (
db-check
))
(define (db-check db)
"Use DBI-style handle to report an error"
(match (dbi-get_status db)
((stat . msg) (if (= stat 0)
#t
(begin
(display msg)
(newline)
(assert stat))))))
|