From 4355d8447f8e9073f4d96a35b280bad5ba793e32 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 27 Nov 2013 22:50:00 +0100 Subject: SQL : Passe e.id en bigint plutôt que char(6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/202 e.id est généré à l'insertion par microtime(true). --- app/models/Entry.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'app/models/Entry.php') diff --git a/app/models/Entry.php b/app/models/Entry.php index abf381a9b..c5ff6ab60 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -2,7 +2,7 @@ class Entry extends Model { - private $id = null; + private $id = 0; private $guid; private $title; private $author; @@ -29,11 +29,7 @@ class Entry extends Model { } public function id () { - if(is_null($this->id)) { - return small_hash ($this->guid . Configuration::selApplication ()); - } else { - return $this->id; - } + return $this->id; } public function guid () { return $this->guid; @@ -195,11 +191,11 @@ class Entry extends Model { class EntryDAO extends Model_pdo { public function addEntry ($valuesTmp) { - $sql = 'INSERT INTO ' . $this->prefix . 'entry(id, guid, title, author, content, link, date, is_read, is_favorite, id_feed, tags) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; + $sql = 'INSERT INTO ' . $this->prefix . 'entry(id, guid, title, author, content, link, date, is_read, is_favorite, id_feed, tags) VALUES(CAST(? * 1000000 AS SIGNED INTEGER), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; $stm = $this->bd->prepare ($sql); $values = array ( - $valuesTmp['id'], + microtime(true), substr($valuesTmp['guid'], 0, 760), substr($valuesTmp['title'], 0, 255), substr($valuesTmp['author'], 0, 255), -- cgit v1.2.3