From: Jeroen De Dauw Date: Sat, 14 Aug 2010 11:24:07 +0000 (+0000) Subject: Make NATURAL JOINs possible X-Git-Tag: 1.31.0-rc.0~35492 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=3c224e54ac10b008309c2cd9876e5d9c3c026879;p=lhc%2Fweb%2Fwiklou.git Make NATURAL JOINs possible --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 54eb32c317..4770293c9f 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1428,7 +1428,10 @@ abstract class DatabaseBase { if ( isset($join_conds_safe[$table]) && isset($use_index_safe[$table]) ) { $tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table ); $tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$table] ) ); - $tableClause .= ' ON (' . $this->makeList((array)$join_conds_safe[$table][1], LIST_AND) . ')'; + $on = $this->makeList((array)$join_conds_safe[$table][1], LIST_AND); + if ( $on != '' ) { + $tableClause .= ' ON (' . $on . ')'; + } $retJOIN[] = $tableClause; // Is there an INDEX clause? } else if ( isset($use_index_safe[$table]) ) { @@ -1438,7 +1441,10 @@ abstract class DatabaseBase { // Is there a JOIN clause? } else if ( isset($join_conds_safe[$table]) ) { $tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table ); - $tableClause .= ' ON (' . $this->makeList((array)$join_conds_safe[$table][1], LIST_AND) . ')'; + $on = $this->makeList((array)$join_conds_safe[$table][1], LIST_AND); + if ( $on != '' ) { + $tableClause .= ' ON (' . $on . ')'; + } $retJOIN[] = $tableClause; } else { $tableClause = $this->tableName( $table );