Generate public link directory
[hcoop/zz_old/portal.git] / pref.sml
CommitLineData
566fd712 1structure Pref :> PREF =
2struct
3
4open Util Sql Init
5
6fun hasDirectory usr =
7 case C.oneOrNoRows (getDb ()) ($`SELECT * FROM DirectoryPref WHERE usr = ^(C.intToSql usr)`) of
8 NONE => false
9 | _ => true
10
11fun setDirectory usr =
12 if hasDirectory usr then
13 ()
14 else
15 ignore (C.dml (getDb ()) ($`INSERT INTO DirectoryPref (usr) VALUES (^(C.intToSql usr))`))
16
17fun unsetDirectory usr =
18 ignore (C.dml (getDb ()) ($`DELETE FROM DirectoryPref WHERE usr = ^(C.intToSql usr)`))
19
20end