Changes done on the Mac.
[cocanwiki.git] / scripts / login_form.ml
index d165726..39fbb06 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: login_form.ml,v 1.6 2006/03/27 18:09:46 rich Exp $
+ * $Id: login_form.ml,v 1.7 2006/03/28 13:20:00 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
@@ -43,14 +43,11 @@ let run r (q : cgi) dbh hostid _ _ =
   let username = try q#param "username" with Not_found -> "" in
   template#set "username" username;
 
-  let sth = dbh#prepare_cached "select create_account_anon from hosts
-                                 where id = ?" in
-  sth#execute [Some hostid];
-
   let create_account_anon =
-    match sth#fetch1 () with
-       [ `Bool b ] -> b
-      | _ -> assert false in
+    List.hd (
+      PGSQL(dbh) "select create_account_anon from hosts
+                   where id = $hostid"
+    ) in
 
   template#conditional "create_account_anon" create_account_anon;