Added ability to choose the collation for new databases.

This commit is contained in:
Alexander M. Turek
2004-04-17 00:52:04 +00:00
parent 91c1336a07
commit 1ecafa5e23
4 changed files with 48 additions and 11 deletions

View File

@@ -24,8 +24,12 @@ $err_url = 'main.php?' . PMA_generate_common_url();
* Builds and executes the db creation sql query
*/
$sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
if (isset($db_charset) && isset($mysql_charsets) && in_array($db_charset, $mysql_charsets)) {
$sql_query .= ' DEFAULT CHARACTER SET ' . $db_charset;
if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
list($db_charset) = explode('_', $db_collation);
if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
$sql_query .= ' DEFAULT CHARACTER SET ' . $db_charset . ' COLLATE ' . $db_collation;
}
unset($db_charset, $db_collation);
}
$sql_query .= ';';