Commit 48c15f0f authored by Alexander Nozdrin's avatar Alexander Nozdrin

Automerge from mysql-next-mr.

parents 804e9d30 273a0a4f
......@@ -141,7 +141,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0,
opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0,
ignore_spaces= 0;
......@@ -155,7 +155,7 @@ static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
*opt_init_command= 0;
static char *histfile;
static char *histfile_tmp;
......@@ -1581,9 +1581,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
charsets_dir = mysql_charsets_dir;
break;
case OPT_DEFAULT_CHARSET:
default_charset_used= 1;
break;
case OPT_DELIMITER:
if (argument == disabled_my_option)
{
......@@ -1788,10 +1785,6 @@ static int get_options(int argc, char **argv)
connect_flag= 0; /* Not in interactive mode */
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (argc > 1)
{
usage(0);
......@@ -2919,7 +2912,6 @@ com_charset(String *buffer __attribute__((unused)), char *line)
charset_info= new_cs;
mysql_set_character_set(&mysql, charset_info->csname);
default_charset= (char *)charset_info->csname;
default_charset_used= 1;
put_info("Charset changed", INFO_INFO);
}
else put_info("Charset is not found", INFO_INFO);
......@@ -4243,8 +4235,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
select_limit,max_join_size);
mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
}
if (default_charset_used)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!mysql_real_connect(&mysql, host, user, password,
database, opt_mysql_port, opt_mysql_unix_port,
connect_flag | CLIENT_MULTI_STATEMENTS))
......@@ -4259,6 +4252,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
}
return -1; // Retryable
}
charset_info= mysql.charset;
connected=1;
#ifndef EMBEDDED_LIBRARY
mysql.reconnect= debug_info_flag; // We want to know if this happens
......
......@@ -30,7 +30,7 @@
#define MAX_TRUNC_LENGTH 3
char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= NULL;
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR];
......@@ -348,7 +348,6 @@ int main(int argc,char *argv[])
if (shared_memory_base_name)
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
if (default_charset)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
error_flags= (myf)(opt_nobeep ? 0 : ME_BELL);
......
......@@ -369,12 +369,15 @@ static int get_options(int *argc, char ***argv)
If there's no --default-character-set option given with
--fix-table-name or --fix-db-name set the default character set to "utf8".
*/
if (!default_charset && (opt_fix_db_names || opt_fix_table_names))
if (!default_charset)
{
if (opt_fix_db_names || opt_fix_table_names)
default_charset= (char*) "utf8";
else
default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
}
if (default_charset && !get_charset_by_csname(default_charset, MY_CS_PRIMARY,
MYF(MY_WME)))
if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) &&
!get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME)))
{
printf("Unsupported character set: %s\n", default_charset);
return 1;
......@@ -798,7 +801,6 @@ static int dbConnect(char *host, char *user, char *passwd)
if (shared_memory_base_name)
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
if (default_charset)
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
......
......@@ -55,11 +55,10 @@ static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static uint opt_mysql_port= 0, opt_protocol= 0;
static char * opt_mysql_unix_port=0;
static longlong opt_ignore_lines= -1;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h>
#ifdef HAVE_SMEM
......@@ -282,10 +281,6 @@ static int get_options(int *argc, char ***argv)
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
return(1);
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
if (*argc < 2)
{
usage();
......@@ -440,6 +435,7 @@ static MYSQL *db_connect(char *host, char *database,
if (shared_memory_base_name)
mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(mysql,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port,
0)))
......
......@@ -32,7 +32,7 @@ static my_bool tty_password= 0, opt_table_type= 0;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint my_end_arg= 0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
......
......@@ -2048,10 +2048,11 @@ AC_SUBST(MAKE_SHELL)
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
paths.h semaphore.h)
paths.h semaphore.h langinfo.h)
# Already-done: strcasecmp
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
AC_CHECK_FUNCS(nl_langinfo)
AC_STAT_MACROS_BROKEN
MYSQL_SIGNAL_CHECK
......
......@@ -27,6 +27,8 @@
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
......
#
# We use default-character-set=latin1 to avoid character set auto-detection
# when running tests - not to depend on the current machine localization.
#
[mysql]
default-character-set=latin1
[mysqlshow]
default-character-set=latin1
[mysqlimport]
default-character-set=latin1
[mysqlcheck]
default-character-set=latin1
[mysql_upgrade]
default-character-set=latin1
# Use default setting for mysqld processes
!include default_mysqld.cnf
!include default_client.cnf
[mysqld.1]
......
......@@ -46,4 +46,14 @@ SELECT format(123456.789, 3, 'el_GR');
format(123456.789, 3, 'el_GR')
123456.789
DROP TABLE t1;
#
# Bug#46633 Obsolete Serbian locale name
#
set lc_messages=sr_YU;
ERROR HY000: Unknown locale: 'sr_YU'
set lc_messages=sr_RS;
set lc_time_names=sr_RS;
select format(123456.789, 3, 'sr_RS');
format(123456.789, 3, 'sr_RS')
123456.789
End of 5.4 tests
SET NAMES utf8;
DROP DATABASE IF EXISTS `ó`;
DROP DATABASE IF EXISTS `Ăł`;
DROP DATABASE IF EXISTS `цЁ`;
DROP DATABASE IF EXISTS `ó`;
iso88591
@@character_set_client
latin1
Database: ó
+--------+
| Tables |
+--------+
+--------+
iso88592
@@character_set_client
latin2
Database: ó
+--------+
| Tables |
+--------+
+--------+
koi8r
@@character_set_client
koi8r
Database: ó
+--------+
| Tables |
+--------+
+--------+
utf8
@@character_set_client
utf8
Database: ó
+--------+
| Tables |
+--------+
+--------+
Database: ó
+--------+
| Tables |
+--------+
+--------+
Database: Ăł
+--------+
| Tables |
+--------+
+--------+
Database: цЁ
+--------+
| Tables |
+--------+
+--------+
SHOW DATABASES LIKE 'ó';
Database (ó)
ó
SHOW DATABASES LIKE 'Ăł';
Database (Ăł)
Ăł
SHOW DATABASES LIKE 'цЁ';
Database (цЁ)
цЁ
SHOW DATABASES LIKE 'ó';
Database (ó)
ó
DROP DATABASE `ó`;
DROP DATABASE `Ăł`;
DROP DATABASE `цЁ`;
DROP DATABASE `ó`;
......@@ -19,7 +19,7 @@ eval CREATE TABLE t1(a INT) ENGINE=FEDERATED
SELECT * FROM t1;
--echo # Start a asynchronous reload
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= refresh 2>&1
--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= refresh 2>&1
--echo # Wait for tables to be closed
let $show_statement= SHOW STATUS LIKE 'Open_tables';
......
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
!include include/default_client.cnf
[mysqld.1]
log-bin= master-bin
......
!include include/default_mysqld.cnf
!include include/default_ndbd.cnf
!include include/default_client.cnf
[cluster_config.1]
NoOfReplicas= 2
......
# Use settings from rpl_1slave_base.cnf
# add setting to connect the slave to the master by default
!include rpl_1slave_base.cnf
!include include/default_client.cnf
[mysqld.2]
# Hardcode the host to 127.0.0.1 until running on more
......
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
!include include/default_client.cnf
[mysqld.1]
......
!include include/default_mysqld.cnf
!include include/default_ndbd.cnf
!include include/default_client.cnf
[cluster_config.1]
NoOfReplicas= 2
......
......@@ -31,4 +31,13 @@ SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
SELECT format(123456.789, 3, 'el_GR');
DROP TABLE t1;
--echo #
--echo # Bug#46633 Obsolete Serbian locale name
--echo #
--error ER_UNKNOWN_LOCALE
set lc_messages=sr_YU;
set lc_messages=sr_RS;
set lc_time_names=sr_RS;
select format(123456.789, 3, 'sr_RS');
--echo End of 5.4 tests
--source include/not_windows.inc
--source include/have_case_sensitive_file_system.inc
#
# Note, please keep this file UTF-8 compatible.
# After editing, make sure that
# "file mysql_locale_posix.test"
# says
# "UTF-8 Unicode text"
# or
# "UTF-8 Unicode English text"
#
#
# Check if we're running on a POSIX-locale machine
#
--disable_query_log
--exec locale -a > $MYSQLTEST_VARDIR/tmp/locale_a.output 2>/dev/null || true
SET @file=REPLACE(LOAD_FILE('../../tmp/locale_a.output'), '-', '');
#
# Note, file content must be case sensitive.
# Some platforms are case sensitive regarding to locale name.
# For example, on HP-UX
# LANG=cs_CZ.iso88592 - works fine
# LANG=cs_CZ.ISO88592 - does not work
#
--remove_file $MYSQLTEST_VARDIR/tmp/locale_a.output
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nde_DE.iso88591\n%')`)
{
Skip Need POSIX locale de_DE.iso88591;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nru_RU.koi8r\n%')`)
{
Skip Need POSIX locale ru_RU.koi8r;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\ncs_CZ.iso88592\n%')`)
{
Skip Need POSIX locale cs_CZ.iso88592;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nen_US.utf8\n%')`)
{
Skip Need POSIX locale en_US.utf8;
}
--enable_query_log
SET NAMES utf8;
--disable_warnings
DROP DATABASE IF EXISTS `ó`;
DROP DATABASE IF EXISTS `Ăł`;
DROP DATABASE IF EXISTS `цЁ`;
DROP DATABASE IF EXISTS `ó`;
--enable_warnings
#
# Test some of the OS-to-MySQL character set mappings
#
# {"ANSI_X3.4-1968", "ascii", my_cs_exact},
# {"ansi1251", "cp1251", my_cs_exact},
# {"armscii8", "armscii8", my_cs_exact},
# {"ASCII", "ascii", my_cs_exact},
# {"Big5", "big5", my_cs_exact},
# {"cp1251", "cp1251", my_cs_exact},
# {"cp1255", "cp1255", my_cs_exact},
# {"CP866", "cp866", my_cs_exact},
# {"eucCN", "gb2312", my_cs_exact},
# {"eucJP", "ujis", my_cs_exact},
# {"eucKR", "euckr", my_cs_exact},
#
# {"gb18030", "gb18030", my_cs_exact},
#
# {"gb2312", "gb2312", my_cs_exact},
# {"gbk", "gbk", my_cs_exact},
# {"georgianps", "geostd8", my_cs_exact},
# {"IBM-1252", "cp1252", my_cs_exact},
#
# {"iso88591", "latin1", my_cs_approx},
# {"ISO_8859-1", "latin1", my_cs_approx},
# {"ISO8859-1", "latin1", my_cs_approx},
# {"ISO-8859-1", "latin1", my_cs_approx},
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _latin1 0xC3 = LATIN CAPITAL LETTER A WITH TILDE
# _latin1 0xB3 = SUPERSCRIPT THREE
#
--echo
--echo iso88591
--exec LC_ALL=fi_FI.iso88591 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=fi_FI.iso88591 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=fi_FI.iso88591 $MYSQL_SHOW --default-character-set=auto ó
--exec LC_ALL=fi_FI.iso88591 $MYSQL_CHECK --default-character-set=auto "ó"
# {"iso885913", "latin7", my_cs_exact},
# {"ISO_8859-13", "latin7", my_cs_exact},
# {"ISO8859-13", "latin7", my_cs_exact},
# {"ISO-8859-13", "latin7", my_cs_exact},
#
# {"iso885915", "latin9", my_cs_exact},
# {"ISO_8859-15", "latin9", my_cs_exact},
# {"ISO8859-15", "latin9", my_cs_exact},
# {"ISO-8859-15", "latin9", my_cs_exact},
#
# {"iso88592", "latin2", my_cs_exact},
# {"ISO_8859-2", "latin2", my_cs_exact},
# {"ISO8859-2", "latin2", my_cs_exact},
# {"ISO-8859-2", "latin2", my_cs_exact},
#
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _latin2 0xC3 = LATIN CAPITAL LETTER A WITH BREVE
# _latin2 0xB3 = LATIN SMALL LETTER L WITH STROKE
#
--echo
--echo iso88592
--exec LC_ALL=cs_CZ.iso88592 $MYSQL --character-sets-dir=$CHARSETSDIR --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=cs_CZ.iso88592 $MYSQLADMIN --character-sets-dir=$CHARSETSDIR -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=cs_CZ.iso88592 $MYSQL_SHOW --character-sets-dir=$CHARSETSDIR --default-character-set=auto ó
--exec LC_ALL=cs_CZ.iso88592 $MYSQL_CHECK --character-sets-dir=$CHARSETSDIR--default-character-set=auto "ó"
# {"iso88597", "greek", my_cs_exact},
# {"ISO_8859-7", "greek", my_cs_exact},
# {"ISO8859-7", "greek", my_cs_exact},
# {"ISO-8859-7", "greek", my_cs_exact},
#
# {"iso88598", "hebrew", my_cs_exact},
# {"ISO_8859-8", "hebrew", my_cs_exact},
# {"ISO8859-8", "hebrew", my_cs_exact},
# {"ISO-8859-8", "hebrew", my_cs_exact},
#
# {"iso88599", "latin5", my_cs_exact},
# {"ISO_8859-9", "latin5", my_cs_exact},
# {"ISO8859-9", "latin5", my_cs_exact},
# {"ISO-8859-9", "latin5", my_cs_exact},
#
# {"koi8r", "koi8r", my_cs_exact},
# {"KOI8-R", "koi8r", my_cs_exact},
# {"koi8u", "koi8u", my_cs_exact},
# {"KOI8-U", "koi8u", my_cs_exact},
#
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _koi8r 0xC3 = CYRILLIC SMALL LETTER TSE
# _koi8r 0xB3 = CYRILLIC CAPITAL LETTER IO
#
--echo
--echo koi8r
--exec LC_ALL=ru_RU.koi8r $MYSQL --character-sets-dir=$CHARSETSDIR --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=ru_RU.koi8r $MYSQLADMIN --character-sets-dir=$CHARSETSDIR -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=ru_RU.koi8r $MYSQL_SHOW --character-sets-dir=$CHARSETSDIR --default-character-set=auto ó
--exec LC_ALL=ru_RU.koi8r $MYSQL_CHECK --character-sets-dir=$CHARSETSDIR --default-character-set=auto "ó"
# {"Shift_JIS", "sjis", my_cs_exact},
# {"SJIS", "sjis", my_cs_exact},
#
# {"tis620", "tis620", my_cs_exact},
#
# {"ujis", "ujis", my_cs_exact},
#
# {"US-ASCII", "ascii", my_cs_exact},
#
# {"utf8", "utf8", my_cs_exact},
# {"utf-8", "utf8", my_cs_exact},
--echo
--echo utf8
--exec LC_ALL=en_US.utf8 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=en_US.utf8 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto ó
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "ó"
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "Ăł"
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "цЁ"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto ó
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "ó"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "Ăł"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "цЁ"
SHOW DATABASES LIKE 'ó';
SHOW DATABASES LIKE 'Ăł';
SHOW DATABASES LIKE 'цЁ';
SHOW DATABASES LIKE 'ó';
DROP DATABASE `ó`;
DROP DATABASE `Ăł`;
DROP DATABASE `цЁ`;
DROP DATABASE `ó`;
......@@ -4,7 +4,7 @@
# Test "mysqladmin ping"
#
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
#
......@@ -19,7 +19,7 @@ EOF
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
# When mysqladmin finds "loose-database" in .cnf file it shall print
......@@ -30,6 +30,6 @@ loose-database=db2
EOF
--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
......@@ -178,7 +178,7 @@ SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
--echo mysqlcheck --fix-db-names --fix-table-names --all-databases
--exec $MYSQL_CHECK --fix-db-names --fix-table-names --all-databases
--exec $MYSQL_CHECK --default-character-set=utf8 --fix-db-names --fix-table-names --all-databases
USE `a@b`;
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
......
......@@ -134,7 +134,7 @@ then
exit 1
fi
cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
cmd="$bindir/mysql --no-defaults --default-character-set=latin1 --force --user=$user --host=$host"
if test ! -z "$port"; then
cmd="$cmd --port=$port"
fi
......
......@@ -1821,52 +1821,298 @@ static MYSQL_METHODS client_methods=
#endif
};
C_MODE_START
int mysql_init_character_set(MYSQL *mysql)
typedef enum my_cs_match_type_enum
{
/* MySQL and OS charsets are fully compatible */
my_cs_exact,
/* MySQL charset is very close to OS charset */
my_cs_approx,
/*
MySQL knows this charset, but it is not supported as client character set.
*/
my_cs_unsupp
} my_cs_match_type;
typedef struct str2str_st
{
const char *default_collation_name;
const char *os_name;
const char *my_name;
my_cs_match_type param;
} MY_CSET_OS_NAME;
/* Set character set */
if (!mysql->options.charset_name)
const MY_CSET_OS_NAME charsets[]=
{
#ifdef __WIN__
{"cp437", "cp850", my_cs_approx},
{"cp850", "cp850", my_cs_exact},
{"cp852", "cp852", my_cs_exact},
{"cp858", "cp850", my_cs_approx},
{"cp866", "cp866", my_cs_exact},
{"cp874", "tis620", my_cs_approx},
{"cp932", "cp932", my_cs_exact},
{"cp936", "gbk", my_cs_approx},
{"cp949", "euckr", my_cs_approx},
{"cp950", "big5", my_cs_exact},
{"cp1200", "utf16le", my_cs_unsupp},
{"cp1201", "utf16", my_cs_unsupp},
{"cp1250", "cp1250", my_cs_exact},
{"cp1251", "cp1251", my_cs_exact},
{"cp1252", "latin1", my_cs_exact},
{"cp1253", "greek", my_cs_exact},
{"cp1254", "latin5", my_cs_exact},
{"cp1255", "hebrew", my_cs_approx},
{"cp1256", "cp1256", my_cs_exact},
{"cp1257", "cp1257", my_cs_exact},
{"cp10000", "macroman", my_cs_exact},
{"cp10001", "sjis", my_cs_approx},
{"cp10002", "big5", my_cs_approx},
{"cp10008", "gb2312", my_cs_approx},
{"cp10021", "tis620", my_cs_approx},
{"cp10029", "macce", my_cs_exact},
{"cp12001", "utf32", my_cs_unsupp},
{"cp20107", "swe7", my_cs_exact},
{"cp20127", "ascii", my_cs_exact},
{"cp20866", "koi8r", my_cs_exact},
{"cp20932", "ujis", my_cs_exact},
{"cp20936", "gb2312", my_cs_approx},
{"cp20949", "euckr", my_cs_approx},
{"cp21866", "koi8u", my_cs_exact},
{"cp28591", "latin1", my_cs_approx},
{"cp28592", "latin2", my_cs_exact},
{"cp28597", "greek", my_cs_exact},
{"cp28598", "hebrew", my_cs_exact},
{"cp28599", "latin5", my_cs_exact},
{"cp28603", "latin7", my_cs_exact},
#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE
{"cp28605", "latin9", my_cs_exact},
#endif
{"cp38598", "hebrew", my_cs_exact},
{"cp51932", "ujis", my_cs_exact},
{"cp51936", "gb2312", my_cs_exact},
{"cp51949", "euckr", my_cs_exact},
{"cp51950", "big5", my_cs_exact},
#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE
{"cp54936", "gb18030", my_cs_exact},
#endif
{"cp65001", "utf8", my_cs_exact},
#else /* not Windows */
{"646", "latin1", my_cs_approx}, /* Default on Solaris */
{"ANSI_X3.4-1968", "ascii", my_cs_exact},
{"ansi1251", "cp1251", my_cs_exact},
{"armscii8", "armscii8", my_cs_exact},
{"armscii-8", "armscii8", my_cs_exact},
{"ASCII", "ascii", my_cs_exact},
{"Big5", "big5", my_cs_exact},
{"cp1251", "cp1251", my_cs_exact},
{"cp1255", "hebrew", my_cs_approx},
{"CP866", "cp866", my_cs_exact},
{"eucCN", "gb2312", my_cs_exact},
{"euc-CN", "gb2312", my_cs_exact},
{"eucJP", "ujis", my_cs_exact},
{"euc-JP", "ujis", my_cs_exact},
{"eucKR", "euckr", my_cs_exact},
{"euc-KR", "euckr", my_cs_exact},
#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE
{"gb18030", "gb18030", my_cs_exact},
#endif
{"gb2312", "gb2312", my_cs_exact},
{"gbk", "gbk", my_cs_exact},
{"georgianps", "geostd8", my_cs_exact},
{"georgian-ps", "geostd8", my_cs_exact},
{"IBM-1252", "cp1252", my_cs_exact},
{"iso88591", "latin1", my_cs_approx},
{"ISO_8859-1", "latin1", my_cs_approx},
{"ISO8859-1", "latin1", my_cs_approx},
{"ISO-8859-1", "latin1", my_cs_approx},
{"iso885913", "latin7", my_cs_exact},
{"ISO_8859-13", "latin7", my_cs_exact},
{"ISO8859-13", "latin7", my_cs_exact},
{"ISO-8859-13", "latin7", my_cs_exact},
#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE
{"iso885915", "latin9", my_cs_exact},
{"ISO_8859-15", "latin9", my_cs_exact},
{"ISO8859-15", "latin9", my_cs_exact},
{"ISO-8859-15", "latin9", my_cs_exact},
#endif
{"iso88592", "latin2", my_cs_exact},
{"ISO_8859-2", "latin2", my_cs_exact},
{"ISO8859-2", "latin2", my_cs_exact},
{"ISO-8859-2", "latin2", my_cs_exact},
{"iso88597", "greek", my_cs_exact},
{"ISO_8859-7", "greek", my_cs_exact},
{"ISO8859-7", "greek", my_cs_exact},
{"ISO-8859-7", "greek", my_cs_exact},
{"iso88598", "hebrew", my_cs_exact},
{"ISO_8859-8", "hebrew", my_cs_exact},
{"ISO8859-8", "hebrew", my_cs_exact},
{"ISO-8859-8", "hebrew", my_cs_exact},
{"iso88599", "latin5", my_cs_exact},
{"ISO_8859-9", "latin5", my_cs_exact},
{"ISO8859-9", "latin5", my_cs_exact},
{"ISO-8859-9", "latin5", my_cs_exact},
{"koi8r", "koi8r", my_cs_exact},
{"KOI8-R", "koi8r", my_cs_exact},
{"koi8u", "koi8u", my_cs_exact},
{"KOI8-U", "koi8u", my_cs_exact},
{"roman8", "hp8", my_cs_exact}, /* Default on HP UX */
{"Shift_JIS", "sjis", my_cs_exact},
{"SJIS", "sjis", my_cs_exact},
{"shiftjisx0213", "sjis", my_cs_exact},
{"tis620", "tis620", my_cs_exact},
{"tis-620", "tis620", my_cs_exact},
{"ujis", "ujis", my_cs_exact},
{"US-ASCII", "ascii", my_cs_exact},
{"utf8", "utf8", my_cs_exact},
{"utf-8", "utf8", my_cs_exact},
#endif
{NULL, NULL, 0}
};
static const char *
my_os_charset_to_mysql_charset(const char *csname)
{
const MY_CSET_OS_NAME *csp;
for (csp= charsets; csp->os_name; csp++)
{
default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
if (!(mysql->options.charset_name=
my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
return 1;
if (!my_strcasecmp(&my_charset_latin1, csp->os_name, csname))
{
switch (csp->param)
{
case my_cs_exact:
return csp->my_name;
case my_cs_approx:
/*
Maybe we should print a warning eventually:
character set correspondence is not exact.
*/
return csp->my_name;
default:
my_printf_error(ER_UNKNOWN_ERROR,
"OS character set '%s'"
" is not supported by MySQL client",
MYF(0), csp->my_name);
goto def;
}
else
default_collation_name= NULL;
}
}
my_printf_error(ER_UNKNOWN_ERROR,
"Unknown OS character set '%s'.",
MYF(0), csname);
def:
csname= MYSQL_DEFAULT_CHARSET_NAME;
my_printf_error(ER_UNKNOWN_ERROR,
"Switching to the default character set '%s'.",
MYF(0), csname);
return csname;
}
#ifndef __WIN__
#include <stdlib.h> /* for getenv() */
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#endif /* __WIN__ */
static int
mysql_autodetect_character_set(MYSQL *mysql)
{
const char *csname= MYSQL_DEFAULT_CHARSET_NAME;
#ifdef __WIN__
char cpbuf[64];
{
my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP());
csname= my_os_charset_to_mysql_charset(cpbuf);
}
#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO)
{
if (setlocale(LC_CTYPE, "") && (csname= nl_langinfo(CODESET)))
csname= my_os_charset_to_mysql_charset(csname);
}
#endif
if (!(mysql->options.charset_name= my_strdup(csname, MYF(MY_WME))))
return 1;
return 0;
}
static void
mysql_set_character_set_with_default_collation(MYSQL *mysql)
{
const char *save= charsets_dir;
if (mysql->options.charset_dir)
charsets_dir=mysql->options.charset_dir;
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
MY_CS_PRIMARY, MYF(MY_WME));
if (mysql->charset && default_collation_name)
if ((mysql->charset= get_charset_by_csname(mysql->options.charset_name,
MY_CS_PRIMARY, MYF(MY_WME))))
{
/* Try to set compiled default collation when it's possible. */
CHARSET_INFO *collation;
if ((collation=
get_charset_by_name(default_collation_name, MYF(MY_WME))))
{
if (!my_charset_same(mysql->charset, collation))
get_charset_by_name(MYSQL_DEFAULT_COLLATION_NAME, MYF(MY_WME))) &&
my_charset_same(mysql->charset, collation))
{
my_printf_error(ER_UNKNOWN_ERROR,
"COLLATION %s is not valid for CHARACTER SET %s",
MYF(0),
default_collation_name, mysql->options.charset_name);
mysql->charset= NULL;
mysql->charset= collation;
}
else
{
mysql->charset= collation;
}
/*
Default compiled collation not found, or is not applicable
to the requested character set.
Continue with the default collation of the character set.
*/
}
else
mysql->charset= NULL;
}
charsets_dir= save;
}
C_MODE_START
int mysql_init_character_set(MYSQL *mysql)
{
/* Set character set */
if (!mysql->options.charset_name)
{
if (!(mysql->options.charset_name=
my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
return 1;
}
else if (!strcmp(mysql->options.charset_name,
MYSQL_AUTODETECT_CHARSET_NAME) &&
mysql_autodetect_character_set(mysql))
return 1;
mysql_set_character_set_with_default_collation(mysql);
if (!mysql->charset)
{
......
......@@ -26,7 +26,7 @@
enum err_msgs_index
{
en_US= 0, cs_CZ, da_DK, nl_NL, et_EE, fr_FR, de_DE, el_GR, hu_HU, it_IT,
ja_JP, ko_KR, no_NO, nn_NO, pl_PL, pt_PT, ro_RO, ru_RU, sr_CS, sk_SK,
ja_JP, ko_KR, no_NO, nn_NO, pl_PL, pt_PT, ro_RO, ru_RU, sr_RS, sk_SK,
es_ES, sv_SE, uk_UA
} ERR_MSGS_INDEX;
......@@ -1716,41 +1716,41 @@ MY_LOCALE my_locale_sq_AL
);
/***** LOCALE END sq_AL *****/
/***** LOCALE BEGIN sr_YU: Servian - Yugoslavia *****/
static const char *my_locale_month_names_sr_YU[13] =
/***** LOCALE BEGIN sr_RS: Serbian - Serbia *****/
static const char *my_locale_month_names_sr_RS[13] =
{"januar","februar","mart","april","maj","juni","juli","avgust","septembar","oktobar","novembar","decembar", NullS };
static const char *my_locale_ab_month_names_sr_YU[13] =
static const char *my_locale_ab_month_names_sr_RS[13] =
{"jan","feb","mar","apr","maj","jun","jul","avg","sep","okt","nov","dec", NullS };
static const char *my_locale_day_names_sr_YU[8] =
static const char *my_locale_day_names_sr_RS[8] =
{"ponedeljak","utorak","sreda","četvrtak","petak","subota","nedelja", NullS };
static const char *my_locale_ab_day_names_sr_YU[8] =
static const char *my_locale_ab_day_names_sr_RS[8] =
{"pon","uto","sre","čet","pet","sub","ned", NullS };
static TYPELIB my_locale_typelib_month_names_sr_YU =
{ array_elements(my_locale_month_names_sr_YU)-1, "", my_locale_month_names_sr_YU, NULL };
static TYPELIB my_locale_typelib_ab_month_names_sr_YU =
{ array_elements(my_locale_ab_month_names_sr_YU)-1, "", my_locale_ab_month_names_sr_YU, NULL };
static TYPELIB my_locale_typelib_day_names_sr_YU =
{ array_elements(my_locale_day_names_sr_YU)-1, "", my_locale_day_names_sr_YU, NULL };
static TYPELIB my_locale_typelib_ab_day_names_sr_YU =
{ array_elements(my_locale_ab_day_names_sr_YU)-1, "", my_locale_ab_day_names_sr_YU, NULL };
MY_LOCALE my_locale_sr_YU
static TYPELIB my_locale_typelib_month_names_sr_RS =
{ array_elements(my_locale_month_names_sr_RS)-1, "", my_locale_month_names_sr_RS, NULL };
static TYPELIB my_locale_typelib_ab_month_names_sr_RS =
{ array_elements(my_locale_ab_month_names_sr_RS)-1, "", my_locale_ab_month_names_sr_RS, NULL };
static TYPELIB my_locale_typelib_day_names_sr_RS =
{ array_elements(my_locale_day_names_sr_RS)-1, "", my_locale_day_names_sr_RS, NULL };
static TYPELIB my_locale_typelib_ab_day_names_sr_RS =
{ array_elements(my_locale_ab_day_names_sr_RS)-1, "", my_locale_ab_day_names_sr_RS, NULL };
MY_LOCALE my_locale_sr_RS
(
48,
"sr_YU",
"Servian - Yugoslavia",
"sr_RS",
"Serbian - Serbia",
FALSE,
&my_locale_typelib_month_names_sr_YU,
&my_locale_typelib_ab_month_names_sr_YU,
&my_locale_typelib_day_names_sr_YU,
&my_locale_typelib_ab_day_names_sr_YU,
&my_locale_typelib_month_names_sr_RS,
&my_locale_typelib_ab_month_names_sr_RS,
&my_locale_typelib_day_names_sr_RS,
&my_locale_typelib_ab_day_names_sr_RS,
9,
10,
'.', /* decimal point sr_YU */
'\0', /* thousands_sep sr_YU */
"\x80", /* grouping sr_YU */
&global_errmsgs[sr_CS]
'.', /* decimal point sr_RS */
'\0', /* thousands_sep sr_RS */
"\x80", /* grouping sr_RS */
&global_errmsgs[sr_RS]
);
/***** LOCALE END sr_YU *****/
/***** LOCALE END sr_RS *****/
/***** LOCALE BEGIN sv_SE: Swedish - Sweden *****/
static const char *my_locale_month_names_sv_SE[13] =
......@@ -3281,7 +3281,7 @@ MY_LOCALE *my_locales[]=
&my_locale_sk_SK,
&my_locale_sl_SI,
&my_locale_sq_AL,
&my_locale_sr_YU,
&my_locale_sr_RS,
&my_locale_ta_IN,
&my_locale_te_IN,
&my_locale_th_TH,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment