From fe04e7d35f72214f08446b12a22e09af0076cc2a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 11 May 2010 11:01:36 +0000 Subject: - Patch #793604 by matt2000, chx: DBTNG JOINs are close to useless. --- includes/database/select.inc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/database/select.inc b/includes/database/select.inc index 3e7d27762..ddb78c69d 100644 --- a/includes/database/select.inc +++ b/includes/database/select.inc @@ -232,7 +232,9 @@ interface SelectQueryInterface extends QueryConditionInterface, QueryAlterableIn * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined * on a query, this value is ignored as the first table is taken as the base - * table. + * table. The token %alias can be used in this string to be replaced with + * the actual alias. This is useful when $alias is modified by the database + * system, for example, when joining the same table more than once. * @param $arguments * An array of arguments to replace into the $condition of this join. * @return @@ -253,7 +255,9 @@ interface SelectQueryInterface extends QueryConditionInterface, QueryAlterableIn * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined * on a query, this value is ignored as the first table is taken as the base - * table. + * table. The token %alias can be used in this string to be replaced with + * the actual alias. This is useful when $alias is modified by the database + * system, for example, when joining the same table more than once. * @param $arguments * An array of arguments to replace into the $condition of this join. * @return @@ -274,7 +278,9 @@ interface SelectQueryInterface extends QueryConditionInterface, QueryAlterableIn * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined * on a query, this value is ignored as the first table is taken as the base - * table. + * table. The token %alias can be used in this string to be replaced with + * the actual alias. This is useful when $alias is modified by the database + * system, for example, when joining the same table more than once. * @param $arguments * An array of arguments to replace into the $condition of this join. * @return @@ -295,7 +301,9 @@ interface SelectQueryInterface extends QueryConditionInterface, QueryAlterableIn * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined * on a query, this value is ignored as the first table is taken as the base - * table. + * table. The token %alias can be used in this string to be replaced with + * the actual alias. This is useful when $alias is modified by the database + * system, for example, when joining the same table more than once. * @param $arguments * An array of arguments to replace into the $condition of this join. * @return @@ -324,7 +332,9 @@ interface SelectQueryInterface extends QueryConditionInterface, QueryAlterableIn * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined * on a query, this value is ignored as the first table is taken as the base - * table. + * table. The token %alias can be used in this string to be replaced with + * the actual alias. This is useful when $alias is modified by the database + * system, for example, when joining the same table more than once. * @param $arguments * An array of arguments to replace into the $condition of this join. * @return @@ -1210,6 +1220,10 @@ class SelectQuery extends Query implements SelectQueryInterface { } $alias = $alias_candidate; + if (is_string($condition)) { + $condition = str_replace('%alias', $alias, $condition); + } + $this->tables[$alias] = array( 'join type' => $type, 'table' => $table, -- cgit v1.2.3