[geeklog-hg] geeklog: rewrote UPDATE statement for Postgres

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Jun 29 16:18:26 EDT 2012


changeset 8737:73ab2f64edd4
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/73ab2f64edd4
user: Dirk Haun <dirk at haun-online.de>
date: Fri Jun 29 22:07:09 2012 +0200
description:
rewrote UPDATE statement for Postgres

diffstat:

 public_html/lib-common.php |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 56d4331f6bd6 -r 73ab2f64edd4 public_html/lib-common.php
--- a/public_html/lib-common.php	Fri Jun 29 22:01:37 2012 +0200
+++ b/public_html/lib-common.php	Fri Jun 29 22:07:09 2012 +0200
@@ -2712,7 +2712,10 @@
         if ($numB > 1) {
             // OK, we have two or more featured stories in a topic, fix that
             $B = DB_fetchArray($resultB);
-            $sql = "UPDATE {$_TABLES['stories']} s, {$_TABLES['topic_assignments']} ta SET s.featured = 0 WHERE s.featured = 1 AND s.draft_flag = 0 AND ta.tid = '{$A['tid']}' AND ta.type = 'article' AND ta.id = s.sid AND s.date <= NOW() AND s.sid <> '{$B['sid']}'";
+            $sql = array();
+            $sql['mysql'] = "UPDATE {$_TABLES['stories']} s, {$_TABLES['topic_assignments']} ta SET s.featured = 0 WHERE s.featured = 1 AND s.draft_flag = 0 AND ta.tid = '{$A['tid']}' AND ta.type = 'article' AND ta.id = s.sid AND s.date <= NOW() AND s.sid <> '{$B['sid']}'";
+            $sql['mssql'] = $sql['mysql']; // I hope ...
+            $sql['pgsql'] = "UPDATE {$_TABLES['stories']} AS s SET featured = 0 FROM {$_TABLES['topic_assignments']} WHERE s.featured = 1 AND s.draft_flag = 0 AND {$_TABLES['topic_assignments']}.tid = '{$A['tid']}' AND {$_TABLES['topic_assignments']}.type = 'article' AND {$_TABLES['topic_assignments']}.id = s.sid AND s.date <= NOW() AND s.sid <> '{$B['sid']}'";
             DB_query($sql);            
         }
     }



More information about the geeklog-cvs mailing list