- let sth = dbh#prepare_cached "select rv.url, p.title, rv.visit_time
- from recently_visited rv, pages p
- where rv.hostid = ? and rv.userid = ?
- and rv.hostid = p.hostid and rv.url = p.url
- order by 3 desc" in
- sth#execute [`Int hostid; `Int userid];
-
- let table = sth#map (function [`String page; `String title; _] ->
- [ "page", Template.VarString page;
- "title", Template.VarString title ]
- | _ -> assert false) in
+ let rows = PGSQL(dbh)
+ "select rv.url, p.title, rv.visit_time
+ from recently_visited rv, pages p
+ where rv.hostid = $hostid and rv.userid = $userid
+ and rv.hostid = p.hostid and rv.url = p.url
+ order by 3 desc" in
+
+ let table = List.map (
+ fun (page, title, _) ->
+ [ "page", Template.VarString page;
+ "title", Template.VarString title ]
+ ) rows in