From: rich Date: Wed, 23 Nov 2005 11:32:12 +0000 (+0000) Subject: select count now returns an int8. This fixes the broken 'Recent changes' pages. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=da90d13b12890069f0bade66b6676daf80b41bfd;p=cocanwiki.git select count now returns an int8. This fixes the broken 'Recent changes' pages. --- diff --git a/scripts/contacts.ml b/scripts/contacts.ml index 22adc38..9ba8e65 100644 --- a/scripts/contacts.ml +++ b/scripts/contacts.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: contacts.ml,v 1.1 2004/09/17 16:03:34 rich Exp $ + * $Id: contacts.ml,v 1.2 2005/11/23 11:32:12 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 @@ -33,7 +33,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = (* Pull out all the contacts from the database. *) let sth = dbh#prepare_cached "select c.id, c.name, c.subject, - (select count(*) from contact_emails + (select count(*)::int4 from contact_emails where contactid = c.id) from contacts c where c.hostid = ? diff --git a/scripts/delete_contact.ml b/scripts/delete_contact.ml index cfff4a2..563bc02 100644 --- a/scripts/delete_contact.ml +++ b/scripts/delete_contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: delete_contact.ml,v 1.2 2004/09/23 11:56:47 rich Exp $ + * $Id: delete_contact.ml,v 1.3 2005/11/23 11:32:13 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 @@ -45,7 +45,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = (* Need to check the contact emails all belong to this host. *) let qs = Dbi.placeholders (List.length ids) in - let sth = dbh#prepare_cached ("select count(*) from contacts + let sth = dbh#prepare_cached ("select count(*)::int4 from contacts where hostid = ? and id in " ^ qs) in sth#execute (`Int hostid :: (List.map (fun id -> `Int id) ids)); diff --git a/scripts/edit_user_form.ml b/scripts/edit_user_form.ml index d8eb82a..ddd7ed1 100644 --- a/scripts/edit_user_form.ml +++ b/scripts/edit_user_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_user_form.ml,v 1.7 2004/10/11 14:13:04 rich Exp $ + * $Id: edit_user_form.ml,v 1.8 2005/11/23 11:32:13 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 @@ -38,9 +38,9 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = "select u.name, u.email, u.registration_date, u.can_edit, u.can_manage_users, u.can_manage_contacts, u.can_manage_site, u.can_edit_global_css, u.can_import_mail, - (select count(*) from pages where logged_user = u.id), + (select count(*) from pages where logged_user = u.id)::int4, (select count(*) from pages - where logged_user = u.id and url_deleted is null) + where logged_user = u.id and url_deleted is null)::int4 from users u where u.hostid = ? and u.id = ?" in sth#execute [`Int hostid; `Int userid]; diff --git a/scripts/rebuild_links.ml b/scripts/rebuild_links.ml index 354776a..34642c1 100644 --- a/scripts/rebuild_links.ml +++ b/scripts/rebuild_links.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: rebuild_links.ml,v 1.3 2004/10/23 12:00:24 rich Exp $ + * $Id: rebuild_links.ml,v 1.4 2005/11/23 11:32:13 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 @@ -40,7 +40,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = (* Estimate how many sections we will have to process. *) let sth = dbh#prepare_cached - "select count(c.id) from contents c, pages p + "select count(c.id)::int4 from contents c, pages p where c.pageid = p.id and p.hostid = ? and p.url is not null diff --git a/scripts/recent.ml b/scripts/recent.ml index f77645c..94afb98 100644 --- a/scripts/recent.ml +++ b/scripts/recent.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: recent.ml,v 1.9 2004/10/21 18:35:01 rich Exp $ + * $Id: recent.ml,v 1.10 2005/11/23 11:32:13 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 @@ -36,7 +36,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = let template = get_template dbh hostid "recent.html" in (* Count the number of changes. *) - let sth = dbh#prepare_cached "select count(*) from pages where hostid = ?" in + let sth = dbh#prepare_cached + "select count(*)::int4 from pages where hostid = ?" in sth#execute [`Int hostid]; let count = sth#fetch1int () in