[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:
Alexei Sorokin
2019-09-11 10:12:49 +03:00
parent 44f4c9374d
commit 6911b499d3
15 changed files with 403 additions and 576 deletions

View File

@@ -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,