aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 9e291f4ed..70135e7a0 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -628,10 +628,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
$firstId = $order === 'DESC' ? '9000000000'. '000000' : '0';
}*/
if ($firstId !== '') {
- $search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
+ $search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . ' ? ';
+ $values[] = $firstId;
}
if ($date_min > 0) {
- $search .= 'AND ' . $alias . 'id >= ' . $date_min . '000000 ';
+ $search .= 'AND ' . $alias . 'id >= ? ';
+ $values[] = $date_min . '000000';
}
if ($filter) {
if ($filter->getMinDate()) {
@@ -781,6 +783,23 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
return self::daoToEntries($stm->fetchAll(PDO::FETCH_ASSOC));
}
+ public function listByIds($ids, $order = 'DESC') {
+ if (count($ids) < 1) {
+ return array();
+ }
+
+ $sql = 'SELECT id, guid, title, author, '
+ . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content')
+ . ', link, date, is_read, is_favorite, id_feed, tags '
+ . 'FROM `' . $this->prefix . 'entry` '
+ . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?) '
+ . 'ORDER BY id ' . $order;
+
+ $stm = $this->bd->prepare($sql);
+ $stm->execute($ids);
+ return self::daoToEntries($stm->fetchAll(PDO::FETCH_ASSOC));
+ }
+
public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);