17 | _
=> raise C
.Sql
"Bad status"
25 fun statusFromSql v
= statusFromInt (C
.intFromSql v
)
26 fun statusToSql s
= C
.intToSql (statusToInt s
)
28 type app
= { id
: int, name
: string, rname
: string, email
: string,
29 forward
: bool, uses
: string, other
: string,
30 passwd
: string, status
: status
, stamp
: C
.timestamp
}
32 fun mkAppRow
[id
, name
, rname
, email
, forward
, uses
, other
, passwd
, status
, stamp
] =
33 { id
= C
.intFromSql id
, name
= C
.stringFromSql name
, rname
= C
.stringFromSql rname
,
34 email
= C
.stringFromSql email
, forward
= C
.boolFromSql forward
,
35 uses
= C
.stringFromSql uses
, other
= C
.stringFromSql other
, passwd
= C
.stringFromSql passwd
,
36 status
= statusFromSql status
, stamp
= C
.timestampFromSql stamp
}
37 | mkAppRow r
= rowError ("app", r
)
40 case C
.oneOrNoRows (getDb ()) ($`SELECT id
, name
, rname
, email
, forward
, uses
, other
, passwd
, status
, stamp
42 WHERE id
= ^
(C
.intToSql id
)`
) of
43 SOME row
=> mkAppRow row
44 | NONE
=> raise Fail
"Membership application not found"