about summary refs log tree commit diff
path: root/gn
diff options
context:
space:
mode:
Diffstat (limited to 'gn')
-rw-r--r--gn/db/mysql.scm22
-rw-r--r--gn/db/sparql.scm9
2 files changed, 26 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))))))
diff --git a/gn/db/sparql.scm b/gn/db/sparql.scm
index c413b9a..b7d94f3 100644
--- a/gn/db/sparql.scm
+++ b/gn/db/sparql.scm
@@ -1,3 +1,12 @@
+#!
+
+Module for handling SPARQL primitives.
+
+Note that GN queries should go into gn/data - this is currently not
+the case.
+
+!#
+
 (define-module (gn db sparql)
   #:use-module (json)
   #:use-module (ice-9 match)