[geeklog-hg] geeklog: fixed Postgres SQL error (comparing a string with an int)

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


changeset 8734:9f91f1ceed7f
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/9f91f1ceed7f
user: Dirk Haun <dirk at haun-online.de>
date: Fri Jun 29 21:40:33 2012 +0200
description:
fixed Postgres SQL error (comparing a string with an int)

diffstat:

 public_html/lib-common.php |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (32 lines):

diff -r 497414054e92 -r 9f91f1ceed7f public_html/lib-common.php
--- a/public_html/lib-common.php	Fri Jun 29 21:16:53 2012 +0200
+++ b/public_html/lib-common.php	Fri Jun 29 21:40:33 2012 +0200
@@ -4279,12 +4279,13 @@
 
     $blocksql['mysql'] = "SELECT b.*,UNIX_TIMESTAMP(rdfupdated) AS date ";
     $blocksql['pgsql'] = 'SELECT b.*, date_part(\'epoch\', rdfupdated) AS date ';
-    
-    
-
-    $commonsql = "FROM {$_TABLES['blocks']} b, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'block' AND ta.id = bid AND is_enabled = 1";
-
-    if( $side == 'left' ) {
+
+    $blocksql['mysql'] .= "FROM {$_TABLES['blocks']} b, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'block' AND ta.id = bid AND is_enabled = 1";
+    $blocksql['mssql'] .= "FROM {$_TABLES['blocks']} b, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'block' AND ta.id = bid AND is_enabled = 1";
+    $blocksql['pgsql'] .= "FROM {$_TABLES['blocks']} b, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'block' AND ta.id::integer = bid AND is_enabled = 1";
+
+    $commonsql = '';
+    if ($side == 'left') {
         $commonsql .= " AND onleft = 1";
     } else {
         $commonsql .= " AND onleft = 0";
@@ -4298,7 +4299,7 @@
             $topic_access = $_TOPICS[$topic_index]['access'];
         }
     }
-    
+
     if(!empty($topic) && $topic != TOPIC_ALL_OPTION && $topic != TOPIC_HOMEONLY_OPTION && $topic_access > 0) {
         // Retrieve list of inherited topics
         $tid_list = TOPIC_getChildList($topic);



More information about the geeklog-cvs mailing list