- let sth = dbh#prepare_cached "select subject from contacts
- where hostid = ? and id = ?" in
- sth#execute [`Int hostid; `Int id];
-
- let subject =
- try sth#fetch1string ()
- with Not_found -> fail "There is no such contact id in the database." in
+ let sth = dbh#prepare_cached "select id, subject from contacts
+ where hostid = ? and name = ?" in
+ sth#execute [`Int hostid; `String name];
+
+ let id, subject =
+ try
+ (match sth#fetch1 () with
+ [ `Int id; `String subject ] -> id, subject
+ | _ -> assert false
+ )
+ with Not_found -> fail "There is no such contact form in the database." in