diff options
Diffstat (limited to 'gn/db/mysql.scm')
-rw-r--r-- | gn/db/mysql.scm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gn/db/mysql.scm b/gn/db/mysql.scm index c84605d..e35cc69 100644 --- a/gn/db/mysql.scm +++ b/gn/db/mysql.scm @@ -1,3 +1,7 @@ +#! + 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) @@ -5,11 +9,19 @@ #: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 ( - open-db - ) -) + db-check + )) -(define open-db - #t) +(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)))))) |