From 8158c57a8e3a40338045e0b809bca42f1e703ca5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 7 Sep 2005 14:31:21 +0100 Subject: update schema, more mysql work --- backend.php | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'backend.php') diff --git a/backend.php b/backend.php index 82e07e6d7..b4181069f 100644 --- a/backend.php +++ b/backend.php @@ -288,11 +288,16 @@ "; } - // FIXME: check for null value here - - $result = db_query($link, "SELECT *,SUBSTRING(last_updated,1,16) as last_updated_s, - EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout - FROM ttrss_feeds WHERE id = '$feed'"); + if (DB_TYPE == "pgsql") { + $result = db_query($link, + "SELECT *,SUBSTRING(last_updated,1,16) as last_updated_s, + EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout + FROM ttrss_feeds WHERE id = '$feed'"); + } else { + $result = db_query($link, + "SELECT *,SUBSTRING(last_updated,1,16) as last_updated_s + FROM ttrss_feeds WHERE id = '$feed'"); + } if ($result) { @@ -356,10 +361,15 @@ $limit_query_part = "LIMIT " . $limit; } + if (DB_TYPE == "pgsql") { + $extract_epoch_qpart = " + ,EXTRACT(EPOCH FROM last_read) AS last_read_ts, + EXTRACT(EPOCH FROM updated) AS updated_ts"; + } + $result = db_query($link, "SELECT - id,title,updated,unread,feed_id,marked,link, - EXTRACT(EPOCH FROM last_read) AS last_read_ts, - EXTRACT(EPOCH FROM updated) AS updated_ts + id,title,updated,unread,feed_id,marked,link + $extract_epoch_qpart FROM ttrss_entries WHERE @@ -388,12 +398,12 @@ alt=\"Updated\">"; } - if ($line["unread"] == "t") { + if ($line["unread"] == "t" || $line["unread"] == "1") { $class .= "Unread"; ++$num_unread; } - if ($line["marked"] == "t") { + if ($line["marked"] == "t" || $line["marked"] == "1") { $marked_pic = "\"Reset"; } else { @@ -648,7 +658,7 @@ "; + onclick=\"javascript:feedEditSave()\" value=\"Save\">"; } else { print " @@ -668,7 +678,7 @@ print " All feeds: "; + class=\"button\" onclick=\"gotoExportOpml()\" value=\"Export OPML\">"; } @@ -710,7 +720,7 @@ if (!WEB_DEMO_MODE) { - $regexp = db_escape_string($_GET["reg_exp"]); + $regexp = db_escape_string($_GET["regexp"]); $match = db_escape_string($_GET["match"]); $result = db_query($link, -- cgit v1.2.3-54-g00ecf