From 439a0e2991231db51232646736a4bf78cfb2bffd Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 7 Jul 2014 18:25:48 +0200 Subject: SQL: improved performance for adding new articles --- app/Models/EntryDAO.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/Models/EntryDAO.php') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 1775af63c..6f3f472f6 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -6,14 +6,18 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return parent::$sharedDbType !== 'sqlite'; } - public function addEntry($valuesTmp) { + public function addEntryPrepare() { $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, ' . ($this->isCompressed() ? 'content_bin' : 'content') . ', link, date, is_read, is_favorite, id_feed, tags) ' . 'VALUES(?, ?, ?, ?, ' . ($this->isCompressed() ? 'COMPRESS(?)' : '?') . ', ?, ?, ?, ?, ?, ?)'; - $stm = $this->bd->prepare($sql); + return $this->bd->prepare($sql); + } + + public function addEntry($valuesTmp, $preparedStatement = null) { + $stm = $preparedStatement === null ? addEntryPrepare() : $preparedStatement; $values = array( $valuesTmp['id'], -- cgit v1.2.3