aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-10-01 18:31:28 +0200
committerGravatar GitHub <noreply@github.com> 2017-10-01 18:31:28 +0200
commitceda55c75b158fc1cf4813fe0f258527754b9289 (patch)
tree7c84ac32cc845ab1d70ea5a3fb263c6613de34b0 /app/Models/EntryDAOSQLite.php
parentcb7ba3e47576aa1d0c3f53e5966f831e6540bbc3 (diff)
parentf241fc1841df89285ecb6f124f0d70198d712b2f (diff)
Merge pull request #1651 from FreshRSS/dev1.8.0
Release 1.8.0
Diffstat (limited to 'app/Models/EntryDAOSQLite.php')
-rw-r--r--app/Models/EntryDAOSQLite.php57
1 files changed, 52 insertions, 5 deletions
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index ad7bcd865..8dad54322 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -27,11 +27,58 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
public function commitNewEntries() {
$sql = '
-CREATE TEMP TABLE `tmp` AS SELECT id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `' . $this->prefix . 'entrytmp` ORDER BY date;
-INSERT OR IGNORE INTO `' . $this->prefix . 'entry` (id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags)
- SELECT rowid + (SELECT MAX(id) - COUNT(*) FROM `tmp`) AS id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `tmp` ORDER BY date;
-DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= (SELECT MAX(id) FROM `tmp`);
-DROP TABLE `tmp`;';
+ CREATE TEMP TABLE `tmp` AS
+ SELECT
+ id,
+ guid,
+ title,
+ author,
+ content,
+ link,
+ date,
+ `lastSeen`,
+ hash, is_read,
+ is_favorite,
+ id_feed,
+ tags
+ FROM `' . $this->prefix . 'entrytmp`
+ ORDER BY date;
+ INSERT OR IGNORE INTO `' . $this->prefix . 'entry`
+ (
+ id,
+ guid,
+ title,
+ author,
+ content,
+ link,
+ date,
+ `lastSeen`,
+ hash,
+ is_read,
+ is_favorite,
+ id_feed,
+ tags
+ )
+ SELECT rowid + (SELECT MAX(id) - COUNT(*) FROM `tmp`) AS
+ id,
+ guid,
+ title,
+ author,
+ content,
+ link,
+ date,
+ `lastSeen`,
+ hash,
+ is_read,
+ is_favorite,
+ id_feed,
+ tags
+ FROM `tmp`
+ ORDER BY date;
+ DELETE FROM `' . $this->prefix . 'entrytmp`
+ WHERE id <= (SELECT MAX(id)
+ FROM `tmp`);
+ DROP TABLE `tmp`;';
$hadTransaction = $this->bd->inTransaction();
if (!$hadTransaction) {
$this->bd->beginTransaction();