Scripts updated to use new PG interface.
[cocanwiki.git] / scripts / user_prefs_form.ml
index 6908904..4d66eb7 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: user_prefs_form.ml,v 1.4 2006/03/27 18:09:47 rich Exp $
+ * $Id: user_prefs_form.ml,v 1.5 2006/03/28 16:24:08 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,15 +39,11 @@ let run r (q : cgi) dbh hostid host user =
   let can_edit = can_edit host user in
 
   (* Pull out the registration date - not stored in the user object. *)
-  let sth =
-    dbh#prepare_cached
-      "select registration_date from users where hostid = ? and id = ?" in
-  sth#execute [Some hostid; Some userid];
-
-  let registration_date =
-    match sth#fetch1 () with
-       [ `Date registration_date ] -> registration_date
-      | _ -> assert false in
+  let registration_date = List.hd (
+    PGSQL(dbh)
+      "select registration_date from users
+        where hostid = $hostid and id = $userid"
+  ) in
 
   let email, has_email =
     match prefs.email with