diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-03 00:35:45 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-03 00:35:45 -0400 |
commit | a4502857ece08326168fd5b1170d9ff9f4c3be01 (patch) | |
tree | 2eaff7d4a705bcc7bee42a9f4eaf8bd2dec67f3c /lib/feedmapper.php | |
parent | 9e1b6c31a8818f665ac58307931c6fd308e6c353 (diff) |
small fixes on previous commits
Diffstat (limited to 'lib/feedmapper.php')
-rw-r--r-- | lib/feedmapper.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 7b544c3cf..6e3f6080d 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -125,6 +125,18 @@ class OC_News_FeedMapper { } return $id; } + + public function mostRecent(){ + //FIXME: does something like SELECT TOP 1 * exists in pear/mdb2 ?? + $stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' ORDER BY lastmodified'); + $result = $stmt->execute(); + $row = $result->fetchRow(); + $id = null; + if ($row != null){ + $id = $row['id']; + } + return $id; + } /** * @brief Save the feed and all its items into the database @@ -153,19 +165,17 @@ class OC_News_FeedMapper { //FIXME: Detect when feed contains already a database id $feedid = $this->findIdFromUrl($url); if ($feedid == null){ - $query = OCP\DB::prepare(' - INSERT INTO ' . self::tableName . - '(url, title, favicon_link, folder_id, added, lastmodified, user_id) - VALUES (?, ?, ?, ?, ?, ?, ?) - '); + $query = OCP\DB::prepare(" + INSERT INTO " . self::tableName . + "(url, title, favicon_link, folder_id, user_id, added, lastmodified) + VALUES (?, ?, ?, ?, ?, $_ut, $_ut) + "); $params=array( $url, htmlspecialchars_decode($title), $feed->getFavicon(), $folderid, - $_ut, - $_ut, $this->userid ); $query->execute($params); |