summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-01 20:40:41 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-01 20:45:08 +0200
commit50b1b38d038a5def9606fdac4bcd944a65b09da6 (patch)
tree3a4766578a1d45653f024691ee6d56c760a8fe0a /lib
parent6867632e9d6f5dcf475b9418f2d3ec223d137068 (diff)
we can now use UNIX_TIMESTAMP in queries
Diffstat (limited to 'lib')
-rw-r--r--lib/feedmapper.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php
index 65194374e..eec3ade64 100644
--- a/lib/feedmapper.php
+++ b/lib/feedmapper.php
@@ -156,15 +156,6 @@ class FeedMapper {
*/
//TODO: handle error case
public function save(Feed $feed, $folderid){
- $CONFIG_DBTYPE = \OCP\Config::getSystemValue( "dbtype", "sqlite" );
- if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
- $_ut = "strftime('%s','now')";
- } elseif($CONFIG_DBTYPE == 'pgsql') {
- $_ut = 'date_part(\'epoch\',now())::integer';
- } else {
- $_ut = "UNIX_TIMESTAMP()";
- }
-
$title = $feed->getTitle();
$url = $feed->getUrl();
$url_hash = md5($url);
@@ -182,7 +173,7 @@ class FeedMapper {
$query = \OCP\DB::prepare("
INSERT INTO " . self::tableName .
"(url, url_hash, title, favicon_link, folder_id, user_id, added, lastmodified)
- VALUES (?, ?, ?, ?, ?, ?, $_ut, $_ut)
+ VALUES (?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())
");
$params=array(
@@ -201,13 +192,12 @@ class FeedMapper {
//update the db. it needs to be done, since it might be the first save after a full fetch
$stmt = \OCP\DB::prepare('
UPDATE ' . self::tableName .
- ' SET favicon_link = ? , lastmodified = ? , folder_id = ?
+ ' SET favicon_link = ? , lastmodified = UNIX_TIMESTAMP() , folder_id = ?
WHERE id = ?
');
$params=array(
$favicon,
- $_ut,
$folderid,
$feedid
);