+ let dbh = PGOCaml.connect ~database:"cocanwiki" () in
+ PGOCaml.begin_work dbh;
+
+ (* Get the template hosts. *)
+ let rows = PGSQL(dbh)
+ "select id, canonical_hostname from hosts
+ where is_template order by 2" in
+
+ let table = List.map (
+ fun (id, canonical_hostname) ->
+ [ "id", Template.VarString (Int32.to_string id);
+ "canonical_hostname", Template.VarString canonical_hostname ]
+ ) rows in
+ template#table "templates" table;
+