(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_unsubscribe.ml,v 1.1 2004/09/24 16:41:16 rich Exp $
+ * $Id: mailing_list_unsubscribe.ml,v 1.5 2006/12/06 09:46:57 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
open Cocanwiki
open Cocanwiki_ok
-let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+let run r (q : cgi) dbh hostid _ _ =
let opt_out = q#param "o" in
(* Update the database. *)
- let sth = dbh#prepare_cached "delete from mailing_lists
- where hostid = ? and opt_out = ?" in
- sth#execute [`Int hostid; `String opt_out];
+ PGSQL(dbh) "delete from mailing_lists
+ where hostid = $hostid and opt_out = $opt_out";
- dbh#commit ();
+ PGOCaml.commit dbh;
(* Confirmed. *)
let buttons = [ ok_button "/" ] in
ok ~buttons ~title:"Unsubscribed"
- q "Your email address has been unsubscribed."
+ r dbh hostid q "Your email address has been unsubscribed."
let () =
register_script run