From e98b7ab13ec414d1c5c3c3d1d6a7c9995ebf4fea Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 30 Nov 2013 13:15:54 +0100 Subject: SQL : compression côté base de données (attention, perte de compatibilité) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ça y est, j'ai tout cassé... Contribue à https://github.com/marienfressinaud/FreshRSS/issues/204 Compatible MySQL 5.0. Commentaires souhaités avant l'implémentation de la recherche côté base de données. Pour l'instant, je n'ai pas fait de script de mise à jour, car la manière précédente `base64_encode(gzdeflate(serialize($content)))` est difficile à traiter côté MySQL et nécessite une boucle en PHP. Avec la nouvelle approche de ce patch, nous pourrons plus facilement changer d'avis sans perte de compatibilité. --- app/models/Feed.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app/models/Feed.php') diff --git a/app/models/Feed.php b/app/models/Feed.php index 2260f6fdf..954d1d45c 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -408,6 +408,16 @@ class FeedDAO extends Model_pdo { } public function deleteFeed ($id) { + /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY + $sql = 'DELETE FROM `' . $this->prefix . 'entry` WHERE id_feed=?'; + $stm = $this->bd->prepare ($sql); + $values = array ($id); + if (!($stm && $stm->execute ($values))) { + $info = $stm->errorInfo(); + Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + return false; + }*/ + $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE id=?'; $stm = $this->bd->prepare ($sql); @@ -422,6 +432,18 @@ class FeedDAO extends Model_pdo { } } public function deleteFeedByCategory ($id) { + /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY + $sql = 'DELETE FROM `' . $this->prefix . 'entry` e ' + . 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' + . 'WHERE f.category=?'; + $stm = $this->bd->prepare ($sql); + $values = array ($id); + if (!($stm && $stm->execute ($values))) { + $info = $stm->errorInfo(); + Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + return false; + }*/ + $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE category=?'; $stm = $this->bd->prepare ($sql); -- cgit v1.2.3