PMA\libraries\DbQbe::_getLeftJoinColumnCandidates PHP Method

_getLeftJoinColumnCandidates() private method

Provides UNIQUE columns and INDEX columns present in criteria tables
private _getLeftJoinColumnCandidates ( array $search_tables, array $search_columns, array $where_clause_columns ) : array
$search_tables array Tables involved in the search
$search_columns array Columns involved in the search
$where_clause_columns array Columns having criteria where clause
return array having UNIQUE and INDEX columns
    private function _getLeftJoinColumnCandidates($search_tables, $search_columns, $where_clause_columns)
    {
        $GLOBALS['dbi']->selectDb($this->_db);
        // Get unique columns and index columns
        $indexes = $this->_getIndexes($search_tables, $search_columns, $where_clause_columns);
        $unique_columns = $indexes['unique'];
        $index_columns = $indexes['index'];
        list($candidate_columns, $needsort) = $this->_getLeftJoinColumnCandidatesBest($search_tables, $where_clause_columns, $unique_columns, $index_columns);
        // If we came up with $unique_columns (very good) or $index_columns (still
        // good) as $candidate_columns we want to check if we have any 'Y' there
        // (that would mean that they were also found in the whereclauses
        // which would be great). if yes, we take only those
        if ($needsort != 1) {
            return $candidate_columns;
        }
        $very_good = array();
        $still_good = array();
        foreach ($candidate_columns as $column => $is_where) {
            $table = explode('.', $column);
            $table = $table[0];
            if ($is_where == 'Y') {
                $very_good[$column] = $table;
            } else {
                $still_good[$column] = $table;
            }
        }
        if (count($very_good) > 0) {
            $candidate_columns = $very_good;
            // Candidates restricted in index+where
        } else {
            $candidate_columns = $still_good;
            // None of the candidates where in a where-clause
        }
        return $candidate_columns;
    }