diff src/settings.sml @ 866:03e7f111fe99

Start of multi-DBMS support
author Adam Chlipala <adamc@hcoop.net>
date Sun, 28 Jun 2009 13:49:32 -0400
parents ebefb0609ac3
children e7f80d78075b
line wrap: on
line diff
--- a/src/settings.sml	Sun Jun 28 11:49:04 2009 -0400
+++ b/src/settings.sml	Sun Jun 28 13:49:32 2009 -0400
@@ -274,4 +274,26 @@
 fun setDebug b = debug := b
 fun getDebug () = !debug
 
+type dbms = {
+     name : string,
+     header : string,
+     link : string,
+     global_init : Print.PD.pp_desc,
+     init : string * (string * int) list -> Print.PD.pp_desc
+}
+
+val dbmses = ref ([] : dbms list)
+val curDb = ref ({name = "",
+                  header = "",
+                  link = "",
+                  global_init = Print.box [],
+                  init = fn _ => Print.box []} : dbms)
+
+fun addDbms v = dbmses := v :: !dbmses
+fun setDbms s =
+    case List.find (fn db => #name db = s) (!dbmses) of
+        NONE => raise Fail ("Unknown DBMS " ^ s)
+      | SOME db => curDb := db
+fun currentDbms () = !curDb
+
 end