summaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-26 01:41:08 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-26 01:41:08 +0100
commita20fd9db9f0ed0e27c65671bb10402ced10587b1 (patch)
treedf13fc03c21a4a27b90c763b66b9fa9c8e5abed7 /app/Models/EntryDAO.php
parent22b41f3bfcbd5a54d59789c2cebfda6dc23b7dde (diff)
Defered insertion MySQL bug
The update of cached values remains to be optimized
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index decae9307..9d11cec6a 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -121,6 +121,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
}
protected function autoUpdateDb($errorInfo) {
+ Minz_Log::warning('FreshRSS_EntryDAO::autoUpdateDb: ' . print_r($errorInfo, true));
if (isset($errorInfo[0])) {
if ($errorInfo[0] === '42S22') { //ER_BAD_FIELD_ERROR
//autoAddColumn
@@ -202,16 +203,15 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
}
public function commitNewEntries() {
- $sql = 'SET @rank=SELECT MAX(id) - COUNT(*) FROM `' . $this->prefix . 'entrytmp`; ' . //MySQL-specific
+ $sql = 'SET @rank=(SELECT MAX(id) - COUNT(*) FROM `' . $this->prefix . 'entrytmp`); ' . //MySQL-specific
'INSERT IGNORE INTO `' . $this->prefix . 'entry` (id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) ' .
'SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `' . $this->prefix . 'entrytmp` ORDER BY date; ' .
'DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= @rank;';
- $stm = $this->bd->prepare($sql);
$hadTransaction = $this->bd->inTransaction();
if (!$hadTransaction) {
$this->bd->beginTransaction();
}
- $result = $stm ? $stm->execute() : false;
+ $result = $this->bd->exec($sql) !== false;
if (!$hadTransaction) {
$this->bd->commit();
}