[DATABASE] Consistently use the "LIMIT $limit OFFSET $offset" syntax
The "LIMIT $offset, $limit" syntax is only supported by MySQL and MariaDB.
This commit is contained in:
@@ -44,20 +44,13 @@ class GroupsByPostsSection extends GroupSection
|
||||
{
|
||||
function getGroups()
|
||||
{
|
||||
$limit = GROUPS_PER_SECTION;
|
||||
|
||||
$qry = 'SELECT user_group.*, count(*) as value ' .
|
||||
'FROM user_group JOIN group_inbox '.
|
||||
'ON user_group.id = group_inbox.group_id ' .
|
||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
|
||||
'ORDER BY value DESC ';
|
||||
|
||||
$limit = GROUPS_PER_SECTION;
|
||||
$offset = 0;
|
||||
|
||||
if (common_config('db','type') == 'pgsql') {
|
||||
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
||||
} else {
|
||||
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
||||
}
|
||||
'ORDER BY value DESC LIMIT ' . $limit;
|
||||
|
||||
$group = Memcached_DataObject::cachedQuery('User_group',
|
||||
$qry,
|
||||
|
Reference in New Issue
Block a user