Parser recognizes collations / Include DB charset and collation in SQL export

This commit is contained in:
Alexander M. Turek
2004-01-02 16:11:56 +00:00
parent a65040f464
commit 0f288c3372
4 changed files with 31 additions and 6 deletions

View File

@@ -80,7 +80,17 @@ function PMA_exportDBCreate($db) {
if (isset($GLOBALS['drop_database'])) {
if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) return FALSE;
}
if (!PMA_exportOutputHandler('CREATE DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) return FALSE;
$create_query = 'CREATE DATABASE ' . (isset($GLOBALS['use_backquotes']) ? PMA_backquote($db) : $db);
if (PMA_MYSQL_INT_VERSION >= 40101) {
$collation = PMA_getDbCollation($db);
if (strpos($collation, '_')) {
$create_query .= ' DEFAULT CHARACTER SET ' . substr($collation, 0, strpos($collation, '_')) . ' COLLATE ' . $collation;
} else {
$create_query .= ' DEFAULT CHARACTER SET ' . $collation;
}
}
$create_query .= ';' . $crlf;
if (!PMA_exportOutputHandler($create_query)) return FALSE;
return PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);
}