Fixup the APIs strange way of doing table aliases on a join....
Only used in very few places
$useIndex = false;
// Filter only users that belong to a given group
$this->addTables( 'user_groups', 'ug1' );
- $ug1 = $this->getAliasedName( 'user_groups', 'ug1' );
- $this->addJoinConds( array( $ug1 => array( 'INNER JOIN', array( 'ug1.ug_user=user_id',
+ $this->addJoinConds( array( 'ug1' => array( 'INNER JOIN', array( 'ug1.ug_user=user_id',
'ug1.ug_group' => $params['group'] ) ) ) );
}
$sqlLimit = $limit + $groupCount + 1;
$this->addTables( 'user_groups', 'ug2' );
- $tname = $this->getAliasedName( 'user_groups', 'ug2' );
- $this->addJoinConds( array( $tname => array( 'LEFT JOIN', 'ug2.ug_user=user_id' ) ) );
+ $this->addJoinConds( array( 'ug2' => array( 'LEFT JOIN', 'ug2.ug_user=user_id' ) ) );
$this->addFields( 'ug2.ug_group ug_group2' );
} else {
$sqlLimit = $limit + 1;
$this->tables = array_merge( $this->tables, $tables );
} else {
if ( !is_null( $alias ) ) {
- $tables = $this->getAliasedName( $tables, $alias );
+ $this->tables[$alias] = $tables;
+ } else {
+ $this->tables[] = $tables;
}
- $this->tables[] = $tables;
}
}
- /**
- * Get the SQL for a table name with alias
- * @param $table string Table name
- * @param $alias string Alias
- * @return string SQL
- */
- protected function getAliasedName( $table, $alias ) {
- return $this->getDB()->tableName( $table ) . ' ' . $alias;
- }
-
/**
* Add a set of JOIN conditions to the internal array
*
$this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) );
}
-
-
// This is an index optimization for mysql, as done in the Special:Watchlist page
$this->addWhereIf( "rc_timestamp > ''", !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql' );
}
/**
- * @private
+ * @return string
*/
function tableNamesWithUseIndexOrJOIN( $tables, $use_index = array(), $join_conds = array() ) {
$ret = array();