X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/90dd48df1de3ea116fe2f2c0ec0fe36c71e17e5c..fe789bea628b15229156c8a4272c2b6063c9b1a0:/src/dbms.sml diff --git a/src/dbms.sml b/src/dbms.sml index caf504a..71fb664 100644 --- a/src/dbms.sml +++ b/src/dbms.sml @@ -22,10 +22,18 @@ structure Dbms :> DBMS = struct open DataStructures -val validDbname = CharVector.all Char.isAlpha +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 = {adduser : string -> string option, - createdb : {user : string, dbname : string} -> string option} +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