X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/d541c6185fb0f426dce0b16e85327b53635169e0..fe789bea628b15229156c8a4272c2b6063c9b1a0:/src/dbms.sml diff --git a/src/dbms.sml b/src/dbms.sml index 6f7bb9d..71fb664 100644 --- a/src/dbms.sml +++ b/src/dbms.sml @@ -22,7 +22,18 @@ structure Dbms :> DBMS = struct open DataStructures -type handler = {adduser : string -> string option} +val validDbname = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"_") +fun validEncoding encoding = + case encoding of + NONE => true + | SOME e => size e > 0 andalso size e < 20 andalso CharVector.all Char.isAlphaNum e + +type handler = {getpass : (unit -> Client.passwd_result) option, + adduser : {user : string, passwd : string option} -> string option, + passwd : {user : string, passwd : string} -> string option, + createdb : {user : string, dbname : string, encoding : string option} -> string option, + dropdb : {user : string, dbname : string} -> string option, + grant : {user : string, dbname : string} -> string option} val dbmses : handler StringMap.map ref = ref StringMap.empty