Scripts updated to use new PG interface.
[cocanwiki.git] / scripts / page_email_form.ml
index cb9188f..f361135 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: page_email_form.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
+ * $Id: page_email_form.ml,v 1.4 2006/03/28 16:24:07 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
@@ -27,18 +27,17 @@ open Printf
 open Cocanwiki
 open Cocanwiki_template
 
-let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+let run r (q : cgi) dbh hostid _ _ =
   let template = get_template dbh hostid "page_email_form.html" in
 
   let page = q#param "page" in
   template#set "page" page;
 
   (* Get the page title. *)
-  let sth = dbh#prepare_cached "select title from pages
-                                 where hostid = ? and url = ?" in
-  sth#execute [`Int hostid; `String page];
-
-  let title = sth#fetch1string () in
+  let title = List.hd (
+    PGSQL(dbh) "select title from pages
+                 where hostid = $hostid and url = $page"
+  ) in
   template#set "title" title;
 
   q#template template