X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fpage_rss.ml;h=b6bc2e0251e166b249f79c905c336b231d7574bc;hb=cd059731a60fd3d4dcf426430ad26ff227b91910;hp=673b18e0cc0796c5f5e89bfe0750083d6d99a96e;hpb=bfa88724ee152ba00c2b2fca881dd78a6599820a;p=cocanwiki.git diff --git a/scripts/page_rss.ml b/scripts/page_rss.ml index 673b18e..b6bc2e0 100644 --- a/scripts/page_rss.ml +++ b/scripts/page_rss.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_rss.ml,v 1.3 2006/03/27 18:09:46 rich Exp $ + * $Id: page_rss.ml,v 1.4 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 @@ -44,36 +44,33 @@ let run r (q : cgi) dbh hostid {hostname = hostname} _ = template#set "hostname" hostname; (* Get the title and description of the page. *) - let sth = dbh#prepare_cached "select id, title, description - from pages - where hostid = ? and url = ? - and redirect is null" in - sth#execute [Some hostid; Some page]; + let rows = PGSQL(dbh) + "select id, title, description from pages + where hostid = $hostid and url = $page and redirect is null" in let pageid, title, description = - match sth#fetch1 () with - [ Some id; Some title; Some description ] -> - id, title, description - | _ -> assert false in + match rows with + | [row] -> row + | _ -> assert false in template#set "title" title; template#set "description" description; (* Get the sections in the live page. *) - let sth = dbh#prepare_cached "select sectionname, content, ordering - from contents - where pageid = ? - and sectionname is not null - order by ordering" in - sth#execute [Some pageid]; + let rows = PGSQL(dbh) + "select sectionname, content, ordering + from contents + where pageid = $pageid + and sectionname is not null + order by ordering" in let sections = - sth#map (function [Some sectionname; Some content; _] -> - sectionname, content - | _ -> assert false) in + List.map (fun (sectionname, content, _) -> sectionname, content) rows in let sections = List.map (fun (sectionname, content) -> + let sectionname = match sectionname with + | None -> "" | Some s -> s in let content = Wikilib.xhtml_of_content dbh hostid content in let linkname = linkname_of_sectionname sectionname in [ "sectionname", Template.VarString sectionname;