summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-08-21 16:36:08 +0400
committerAndrew Dolgov <[email protected]>2011-08-21 16:36:08 +0400
commitcd9da663630b6e12a1f4b0c82646e989410aed51 (patch)
treefa477ddc63913b527ac05bec259275625151fbe8 /functions.php
parent4dd369d42a7be58fb2c2a2c2eb4ca349c43df114 (diff)
ccache_cleanup: fix sql syntax for mysql
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php35
1 files changed, 27 insertions, 8 deletions
diff --git a/functions.php b/functions.php
index 0c5819656..f17fe4484 100644
--- a/functions.php
+++ b/functions.php
@@ -6125,15 +6125,34 @@
function ccache_cleanup($link, $owner_uid) {
- db_query($link, "DELETE FROM ttrss_counters_cache AS c1 WHERE
- (SELECT count(*) FROM ttrss_counters_cache AS c2
- WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
- AND owner_uid = '$owner_uid'");
-
- db_query($link, "DELETE FROM ttrss_cat_counters_cache AS c1 WHERE
- (SELECT count(*) FROM ttrss_cat_counters_cache AS c2
- WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
+ if (DB_TYPE == "pgsql") {
+ db_query($link, "DELETE FROM ttrss_counters_cache AS c1 WHERE
+ (SELECT count(*) FROM ttrss_counters_cache AS c2
+ WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
+ AND owner_uid = '$owner_uid'");
+
+ db_query($link, "DELETE FROM ttrss_cat_counters_cache AS c1 WHERE
+ (SELECT count(*) FROM ttrss_cat_counters_cache AS c2
+ WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
AND owner_uid = '$owner_uid'");
+ } else {
+ db_query($link, "DELETE c1 FROM
+ ttrss_counters_cache AS c1,
+ ttrss_counters_cache AS c2
+ WHERE
+ c1.owner_uid = '$owner_uid' AND
+ c1.owner_uid = c2.owner_uid AND
+ c1.feed_id = c2.feed_id");
+
+ db_query($link, "DELETE c1 FROM
+ ttrss_cat_counters_cache AS c1,
+ ttrss_cat_counters_cache AS c2
+ WHERE
+ c1.owner_uid = '$owner_uid' AND
+ c1.owner_uid = c2.owner_uid AND
+ c1.feed_id = c2.feed_id");
+
+ }
}
function label_find_id($link, $label, $owner_uid) {