Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13542
Modified Files:
serendipity_functions.inc.php
Log Message:
Fixed a few GROUP BY statements. If this breaks MySQL, please see serendipity_mailSubscribers for a good way to fix this.
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.332
retrieving revision 1.333
diff -u -d -r1.332 -r1.333
--- serendipity_functions.inc.php 14 Jul 2004 13:57:26 -0000 1.332
+++ serendipity_functions.inc.php 15 Jul 2004 03:59:07 -0000 1.333
@@ -727,8 +727,11 @@
}
}
+ ##Query modified to remove GROUP BY clause. If Distinct doesn't work
+ ##for mysql, please see the serendipity_mailSubscribers function in
+ ##this file for an example of how to fix it.
$query = "SELECT
- e.id,
+ DISTINCT(e.id),
e.title,
e.timestamp,
e.comments,
@@ -752,11 +755,11 @@
ON e.id = ec.entryid
LEFT JOIN {$serendipity['dbPrefix']}category c
ON ec.categoryid = c.categoryid $and
- GROUP BY
- e.id
ORDER BY
$orderby
$limit";
+ #GROUP BY
+ # e.id
$ret = serendipity_db_query($query);
@@ -908,8 +911,11 @@
function serendipity_searchEntries($term) {
global $serendipity;
+ ##Query modified to remove GROUP BY clause. If Distinct doesn't work
+ ##for mysql, please see the serendipity_mailSubscribers function in
+ ##this file for an example of how to fix it.
$querystring = "SELECT
- e.id,
+ DISTINCT(e.id),
e.author,
a.username,
a.email,
@@ -930,10 +936,10 @@
AND e.id = ec.entryid
AND MATCH (title,body,extended) AGAINST ('" . serendipity_db_escape_string($term) . "')
AND isdraft = 'false'
- GROUP BY
- e.id
ORDER BY
timestamp DESC";
+ #GROUP BY
+ # e.id
return serendipity_db_query($querystring);
}
@@ -1389,7 +1395,8 @@
}
$query = "SELECT
- co.*,
+ DISTINCT(co.id),
+ co.entry_id, co.timestamp, co.title, co.email, co.url, co.ip, co.body, co.type, co.subscribed,
co.author AS username,
e.title,
e.id AS entryid,
@@ -1403,10 +1410,10 @@
LEFT JOIN {$serendipity['dbPrefix']}entrycat ec ON (e.id = ec.entryid)
LEFT JOIN {$serendipity['dbPrefix']}category c ON (ec.categoryid = c.categoryid)
WHERE co.type LIKE 'NORMAL' AND entry_id > 0 $and
- GROUP BY co.id
ORDER BY
co.id " . ($order != '' ? $order : '') . "
$limit";
+ #GROUP BY co.id
$comments = serendipity_db_query($query);
@@ -3035,7 +3042,7 @@
/* Portable version of the same query */
$query = "SELECT scheme, host, SUM(count) AS total
FROM {$serendipity['dbPrefix']}$list
- GROUP BY host
+ GROUP BY scheme, host
ORDER BY total DESC, host
LIMIT $limit";
}
|