Просмотр исходного кода

SQL: Bug with order ASC

https://github.com/marienfressinaud/FreshRSS/issues/538
Alexandre Alapetite 11 лет назад
Родитель
Сommit
3403af3050
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      app/Models/EntryDAO.php

+ 1 - 1
app/Models/EntryDAO.php

@@ -353,7 +353,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
 				throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!');
 		}
 		if ($firstId === '' && parent::$sharedDbType === 'mysql') {
-			$firstId = '9000000000' . '000000';	//MySQL optimization. Tested on MySQL 5.5 with 150k articles
+			$firstId = $order === 'DESC' ? '9000000000'. '000000' : '0';	//MySQL optimization. Tested on MySQL 5.5 with 150k articles
 		}
 		if ($firstId !== '') {
 			$where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';