FOF30\Database\Installer::realGetColumnCollation PHP Method

realGetColumnCollation() private method

Get the collation of a column. This is the internal method used by getColumnCollation.
private realGetColumnCollation ( string $tableName, string $columnName ) : string
$tableName string The name of the table
$columnName string The name of the column
return string The collation, e.g. "utf8_general_ci"
    private function realGetColumnCollation($tableName, $columnName)
    {
        $collation = $this->getTableCollation($tableName);
        $query = 'SHOW FULL COLUMNS FROM ' . $this->db->qn($tableName) . ' LIKE ' . $this->db->q($columnName);
        try {
            $row = $this->db->setQuery($query)->loadAssoc();
        } catch (\Exception $e) {
            return $collation;
        }
        if (empty($row)) {
            return $collation;
        }
        if (!isset($row['Collation'])) {
            return $collation;
        }
        if (empty($row['Collation'])) {
            return $collation;
        }
        return $row['Collation'];
    }