diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-06-28 16:03:00 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-06-28 16:03:00 -0400 |
commit | 5a877e7f69430dbb6c5b1398b15a7b64916c39a8 (patch) | |
tree | 9fcbf80505ddc3a6e4b3a26a0b2f6218132dfa80 /src/settings.sml | |
parent | 5404041e9b6c6c8bba38c58e510327c129df4cc7 (diff) |
Moved query code into Settings
Diffstat (limited to 'src/settings.sml')
-rw-r--r-- | src/settings.sml | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/settings.sml b/src/settings.sml index ed3d1f14..2e0a5ac8 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -274,12 +274,54 @@ val debug = ref false fun setDebug b = debug := b fun getDebug () = !debug +datatype sql_type = + Int + | Float + | String + | Bool + | Time + | Blob + | Channel + | Client + | Nullable of sql_type + +fun p_sql_type t = + let + open Print.PD + open Print + in + case t of + Int => string "uw_Basis_int" + | Float => string "uw_Basis_float" + | String => string "uw_Basis_string" + | Bool => string "uw_Basis_bool" + | Time => string "uw_Basis_time" + | Blob => string "uw_Basis_blob" + | Channel => string "uw_Basis_channel" + | Client => string "uw_Basis_client" + | Nullable String => string "uw_Basis_string" + | Nullable t => box [p_sql_type t, string "*"] + end + +fun isBlob Blob = true + | isBlob (Nullable t) = isBlob t + | isBlob _ = false + type dbms = { name : string, header : string, link : string, global_init : Print.PD.pp_desc, - init : string * (string * int) list -> Print.PD.pp_desc + init : string * (string * int) list -> Print.PD.pp_desc, + query : {loc : ErrorMsg.span, numCols : int, + doCols : ({wontLeakStrings : bool, col : int, typ : sql_type} -> Print.PD.pp_desc) + -> Print.PD.pp_desc} + -> Print.PD.pp_desc, + queryPrepared : {loc : ErrorMsg.span, id : int, query : string, + inputs : sql_type list, numCols : int, + doCols : ({wontLeakStrings : bool, col : int, typ : sql_type} -> Print.PD.pp_desc) + -> Print.PD.pp_desc} + -> Print.PD.pp_desc } val dbmses = ref ([] : dbms list) @@ -287,7 +329,9 @@ val curDb = ref ({name = "", header = "", link = "", global_init = Print.box [], - init = fn _ => Print.box []} : dbms) + init = fn _ => Print.box [], + query = fn _ => Print.box [], + queryPrepared = fn _ => Print.box []} : dbms) fun addDbms v = dbmses := v :: !dbmses fun setDbms s = |