Compare commits

..

No commits in common. "405cf1cb3457401ad5af1a2fabfbcb1e13f34c5a" and "e3b97601e289e97f2c43b091d58098f7a0ac42ae" have entirely different histories.

View File

@ -631,28 +631,10 @@ class ModelMySQL {
* @return int
*/
public static function count($resetQuery = true) {
if (!$resetQuery)
$backup = [
'select' => static::$querySelect['select'],
'sql_calc_found_rows' => static::$querySelect['sql_calc_found_rows'],
'limit' => static::$querySelect['limit'],
'orderBy' => static::$querySelect['orderBy']
];
static::$querySelect['select'] = ['1'];
static::$querySelect['sql_calc_found_rows'] = true;
static::$querySelect['limit'] = '1';
static::$querySelect['orderBy'] = '';
$sql = static::buildQuery($resetQuery);
if (!$resetQuery) {
static::$querySelect['select'] = $backup['select'];
static::$querySelect['sql_calc_found_rows'] = $backup['sql_calc_found_rows'];
static::$querySelect['limit'] = $backup['limit'];
static::$querySelect['orderBy'] = $backup['orderBy'];
}
$result = static::query($sql)->fetch_assoc();
return static::found_row();
}