[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

@@ -1,36 +1,30 @@
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* StatusNet, the distributed open-source microblogging tool
*
* Action for showing Twitter-like JSON search results
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Search
* @package StatusNet
* @package GNUsocial
* @author Zach Copley <zach@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
if (!defined('STATUSNET')) {
exit(1);
}
defined('GNUSOCIAL') || die();
class UserautocompleteAction extends Action
{
@@ -44,7 +38,7 @@ class UserautocompleteAction extends Action
* @return boolean true if nothing goes wrong
* @throws ClientException
*/
public function prepare(array $args = array())
public function prepare(array $args = [])
{
parent::prepare($args);
$this->query = $this->trimmed('term');
@@ -87,7 +81,7 @@ class UserautocompleteAction extends Action
. ' AND LEFT(LOWER(profile.nickname), '
. strlen($this->query)
. ') = \'%s\' '
. ' LIMIT 0, 10';
. ' LIMIT 10';
$profile->query(sprintf($sql, $this->query));
}