Skip to content

Commit

Permalink
bug #1893034 [Export] SET NAMES for importing with command-line client
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Mar 9, 2008
1 parent 8f1e9c8 commit d80816e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -10,6 +10,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1905711 [compatibility] Functions deprecated in PHP 5.3: is_a() and
get_magic_quotes_gpc(), thanks to Dmitry N. Shilnikov - yrtimd
- bug [lang] catalan wrong accented characters
- bug #1893034 [Export] SET NAMES for importing with command-line client

2.11.5.0 (2008-03-01)
- bug #1862661 [GUI] Warn about rename deleting database
Expand Down
16 changes: 13 additions & 3 deletions libraries/export/sql.php
Expand Up @@ -229,13 +229,23 @@ function PMA_exportHeader()

$head .= $crlf;

$charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : '';
if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) {
if (! empty($GLOBALS['asfile'])) {
// we are saving as file, therefore we provide charset information
// so that a utility like the mysql client can interpret
// the file correctly
if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) {
// $cfg['AllowAnywhereRecoding'] was true so we got a charset from
// the export dialog
$set_names = $mysql_charset_map[$GLOBALS['charset_of_file']];
} else {
// by default we use the connection charset
$set_names = $mysql_charset_map[$GLOBALS['charset']];
}
$head .= $crlf
. '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' . $crlf
. '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;' . $crlf
. '/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;' . $crlf
. '/*!40101 SET NAMES ' . $mysql_charset_map[$charset_of_file] . ' */;' . $crlf . $crlf;
. '/*!40101 SET NAMES ' . $set_names . ' */;' . $crlf . $crlf;
}

return PMA_exportOutputHandler($head);
Expand Down

0 comments on commit d80816e

Please sign in to comment.