about summary refs log tree commit diff
path: root/gn/db/mysql.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-11-15 07:46:12 +0100
committerPjotr Prins2023-11-15 07:46:12 +0100
commit58acb7ccf46881708f7552ad303fb156603c29d2 (patch)
tree3138cc8484d6e934bc901110f2580bc041574668 /gn/db/mysql.scm
parent12e43794a12a94e45c25cadf5d167697c16c4f5f (diff)
downloadgn-guile-58acb7ccf46881708f7552ad303fb156603c29d2.tar.gz
Return list of BXD
Diffstat (limited to 'gn/db/mysql.scm')
-rw-r--r--gn/db/mysql.scm22
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))))))