X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fpage_email_confirm.ml;h=d4fcb0cd0f43e3f5194757e5277507a76e8777fa;hb=cd059731a60fd3d4dcf426430ad26ff227b91910;hp=5c65e40cc66772f815a101fe411fe7bc2f71a613;hpb=bfa88724ee152ba00c2b2fca881dd78a6599820a;p=cocanwiki.git diff --git a/scripts/page_email_confirm.ml b/scripts/page_email_confirm.ml index 5c65e40..d4fcb0c 100644 --- a/scripts/page_email_confirm.ml +++ b/scripts/page_email_confirm.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: page_email_confirm.ml,v 1.4 2006/03/27 18:09:46 rich Exp $ + * $Id: page_email_confirm.ml,v 1.5 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 @@ -31,26 +31,22 @@ let run r (q : cgi) dbh hostid _ _ = let pending = q#param "p" in (* Get the relevant fields from the database. *) - let sth = dbh#prepare_cached "select url, email from page_emails - where hostid = ? and pending = ?" in - sth#execute [Some hostid; Some pending]; + let rows = PGSQL(dbh) "select url, email from page_emails + where hostid = $hostid and pending = $pending" in let page, email = - try - (match sth#fetch1 () with - [ Some page; Some email ] -> page, email - | _ -> assert false) - with - Not_found -> - error ~close_button:true ~title:"Email already confirmed" - dbh hostid q - "It looks like that email address has already been confirmed."; - return () in + match rows with + | [ row ] -> row + | [] -> + error ~close_button:true ~title:"Email already confirmed" + dbh hostid q + "It looks like that email address has already been confirmed."; + return () + | _ -> assert false in (* Update the database. *) - let sth = dbh#prepare_cached "update page_emails set pending = null - where hostid = ? and pending = ?" in - sth#execute [Some hostid; Some pending]; + PGSQL(dbh) "update page_emails set pending = null + where hostid = $hostid and pending = $pending"; PGOCaml.commit dbh;