FOF30\Database\Installer::realGetTableCollation PHP Метод

realGetTableCollation() приватный Метод

Get the collation of a table. This is the internal method used by getTableCollation.
private realGetTableCollation ( string $tableName ) : string
$tableName string The name of the table
Результат string The collation, e.g. "utf8_general_ci"
    private function realGetTableCollation($tableName)
    {
        $utf8Support = method_exists($this->db, 'hasUTFSupport') && $this->db->hasUTFSupport();
        $utf8mb4Support = $utf8Support && method_exists($this->db, 'hasUTF8mb4Support') && $this->db->hasUTF8mb4Support();
        $collation = $utf8mb4Support ? 'utf8mb4_unicode_ci' : ($utf8Support ? 'utf_general_ci' : 'latin1_swedish_ci');
        $query = 'SHOW TABLE STATUS LIKE ' . $this->db->q($tableName);
        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'];
    }