From 3403af30501cc0df75290372bc111430e0f8e70a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 17 Jul 2014 11:56:15 +0200 Subject: [PATCH] SQL: Bug with order ASC https://github.com/marienfressinaud/FreshRSS/issues/538 --- app/Models/EntryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 301a2ec49..8c001e73b 100644 --- a/app/Models/EntryDAO.php +++ b/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 . ' ';