1 database.inc | public DatabaseConnection_mysql::utf8mb4IsSupported() |
Checks whether utf8mb4 support is available on the current database system.
Return value
bool:
Overrides DatabaseConnection::utf8mb4IsSupported
File
- core/
includes/ database/ mysql/ database.inc, line 427 - Database interface code for MySQL database servers.
Class
- DatabaseConnection_mysql
- MySQL database connection driver.
Code
public function utf8mb4IsSupported() {
// Caching if this method is called multiple times in the same request.
if (isset($this->utf8mb4Supported)) {
return $this->utf8mb4Supported;
}
// Ensure that the MySQL server supports large prefixes and utf8mb4.
try {
$this->query("DROP TABLE IF EXISTS {backdrop_utf8mb4_test}");
$this->query("CREATE TABLE {backdrop_utf8mb4_test} (id VARCHAR(255), PRIMARY KEY(id(255))) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ROW_FORMAT=DYNAMIC ENGINE=INNODB");
}
catch (Exception $e) {
$this->utf8mb4Supported = FALSE;
return FALSE;
}
$this->query("DROP TABLE IF EXISTS {backdrop_utf8mb4_test}");
$this->utf8mb4Supported = TRUE;
return TRUE;
}