select count now returns an int8. This fixes the broken 'Recent changes' pages.
authorrich <rich>
Wed, 23 Nov 2005 11:32:12 +0000 (11:32 +0000)
committerrich <rich>
Wed, 23 Nov 2005 11:32:12 +0000 (11:32 +0000)
scripts/contacts.ml
scripts/delete_contact.ml
scripts/edit_user_form.ml
scripts/rebuild_links.ml
scripts/recent.ml

index 22adc38..9ba8e65 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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 = ?
index cfff4a2..563bc02 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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));
 
index d8eb82a..ddd7ed1 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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];
 
index 354776a..34642c1 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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
index f77645c..94afb98 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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