diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-05-28 16:23:04 +0500 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-05-28 16:23:04 +0500 |
commit | eb4f5e2d6c693faecf152478cbe7e3883985548a (patch) | |
tree | 014f51899b65b90c388c3d77676cada597fbb95e | |
parent | af512c8d8c196b3132266dc76c8a458f42405f31 (diff) | |
download | mariadb-git-eb4f5e2d6c693faecf152478cbe7e3883985548a.tar.gz |
--with-collation argument for configure. Now one can for example use this:
./configure --with-charset=latin1 --with-collation=latin1_danish_ci
-rw-r--r-- | acconfig.h | 5 | ||||
-rw-r--r-- | client/mysql.cc | 2 | ||||
-rw-r--r-- | client/mysqlcheck.c | 3 | ||||
-rw-r--r-- | client/mysqldump.c | 2 | ||||
-rw-r--r-- | client/mysqlimport.c | 2 | ||||
-rw-r--r-- | configure.in | 171 | ||||
-rw-r--r-- | include/mysql_version.h.in | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 |
8 files changed, 178 insertions, 14 deletions
diff --git a/acconfig.h b/acconfig.h index 6bd017bbbce..0b822d67cf5 100644 --- a/acconfig.h +++ b/acconfig.h @@ -19,7 +19,10 @@ #undef CRAY_STACKSEG_END /* Define the default charset name */ -#undef DEFAULT_CHARSET_NAME +#undef MYSQL_DEFAULT_CHARSET_NAME + +/* Define the default charset name */ +#undef MYSQL_DEFAULT_COLLATION_NAME /* Version of .frm files */ #undef DOT_FRM_VERSION diff --git a/client/mysql.cc b/client/mysql.cc index 33014b27ae8..aa9dcca92db 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -139,7 +139,7 @@ static my_string 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_CHARSET; + *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; static char *histfile; static String glob_buffer,old_buffer; static String processed_prompt; diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 8f599c9f497..b21a73aae4f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -38,7 +38,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, static uint verbose = 0, opt_mysql_port=0; static my_string opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, - *default_charset = (char *)MYSQL_CHARSET, *current_host = 0; + *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME, + *current_host = 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair; #ifdef HAVE_SMEM diff --git a/client/mysqldump.c b/client/mysqldump.c index 6a577af8792..86f03b46038 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -85,7 +85,7 @@ static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, - *where=0, *default_charset= (char *)MYSQL_CHARSET, + *where=0, *default_charset= (char *)MYSQL_DEFAULT_CHARSET_NAME, *opt_compatible_mode_str= 0, *err_ptr= 0; static ulong opt_compatible_mode= 0; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index f247301c6dc..8ee656f23b2 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -44,7 +44,7 @@ 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_CHARSET; + *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; static uint opt_mysql_port=0; static my_string opt_mysql_unix_port=0; static my_string opt_ignore_lines=0; diff --git a/configure.in b/configure.in index 63286db74c5..f25cb213e0b 100644 --- a/configure.in +++ b/configure.in @@ -2255,6 +2255,12 @@ AC_ARG_WITH(charset, [default_charset="$withval"], [default_charset="$DEFAULT_CHARSET"]) +AC_ARG_WITH(collation, + [ --with-collation=COLLATION + Default collation], + [default_collation="$withval"], + [default_collation="default"]) + AC_ARG_WITH(extra-charsets, [ --with-extra-charsets=CHARSET[,CHARSET,...] @@ -2281,7 +2287,6 @@ else CHARSETS="$CHARSETS $EXTRA_CHARSETS" fi - for cs in $CHARSETS do case $cs in @@ -2404,11 +2409,169 @@ do done -AC_SUBST(default_charset) -AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset") + default_charset_collations="" -AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS]) +case $default_charset in + armscii8) + default_charset_default_collation="armscii8_general_ci" + default_charset_collations="armscii8_general_ci armscii_bin" + ;; + ascii) + default_charset_default_collation="ascii_general_ci" + default_charset_collations="ascii_general_ci ascii_bin" + ;; + big5) + default_charset_default_collation="big5_chinese_ci" + default_charset_collations="big5_chinese_ci big5_bin" + ;; + cp1250) + default_charset_default_collation="cp1250_general_ci" + default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin" + ;; + cp1251) + default_charset_default_collation="cp1251_general_ci" + default_charset_collations="cp1251_general_ci cp1251_general_cs cp1251_bin cp1251_bulgarian_ci cp1251_ukrainian_ci" + ;; + cp1256) + default_charset_default_collation="cp1256_general_ci" + default_charset_collations="cp1256_general_ci cp1256_bin" + ;; + cp1257) + default_charset_default_collation="cp1257_general_ci" + default_charset_collations="cp1257_general_ci cp1257_lithuanian_ci cp1257_bin" + ;; + cp850) + default_charset_default_collation="cp850_general_ci" + default_charset_collations="cp850_general_ci cp850_bin" + ;; + cp852) + default_charset_default_collation="cp852_general_ci" + default_charset_collations="cp852_general_ci cp852_bin" + ;; + cp866) + default_charset_default_collation="cp866_general_ci" + default_charset_collations="cp866_general_ci cp866_bin" + ;; + dec8) + default_charset_default_collation="dec8_swedish_ci" + default_charset_collations="dec8_swedish_ci dec8_bin" + ;; + euckr) + default_charset_default_collation="euckr_korean_ci" + default_charset_collations="euckr_korean_ci euckr_bin" + ;; + gb2312) + default_charset_default_collation="gb2312_chinese_ci" + default_charset_collations="gb2312_chinese_ci gb2312_bin" + ;; + gbk) + default_charset_default_collation="gbk_chinese_ci" + default_charset_collations="gbk_chinese_ci gbk_bin" + ;; + greek) + default_charset_default_collation="greek_general_ci" + default_charset_collations="greek_general_ci greek_bin" + ;; + hebrew) + default_charset_default_collation="hebrew_general_ci" + default_charset_collations="hebrew_general_ci hebrew_bin" + ;; + hp8) + default_charset_default_collation="hp8_english_ci" + default_charset_collations="hp8_english_ci hp8_bin" + ;; + keybcs2) + default_charset_default_collation="keybcs2_general_ci" + default_charset_collations="keybcs2_general_ci keybcs2_bin" + ;; + koi8r) + default_charset_default_collation="koi8r_general_ci" + default_charset_collations="koi8r_general_ci koi8r_bin" + ;; + koi8u) + default_charset_default_collation="koi8u_general_ci" + default_charset_collations="koi8u_general_ci koi8u_bin" + ;; + latin1) + default_charset_default_collation="latin1_swedish_ci" + default_charset_collations="latin1_general_ci latin1_general_cs latin1_bin latin1_german1_ci latin1_german2_ci latin1_danish_ci latin1_swedish_ci" + ;; + latin2) + default_charset_default_collation="latin2_general_ci" + default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci" + ;; + latin5) + default_charset_default_collation="latin5_turkish_ci" + default_charset_collations="latin5_turkish_ci latin5_bin" + ;; + latin7) + default_charset_default_collation="latin7_general_ci" + default_charset_collations="latin7_general_ci latin7_general_cs latin7_bin latin7_estonian_cs" + ;; + macce) + default_charset_default_collation="macce_general_ci" + default_charset_collations="macce_general_ci macce_bin" + ;; + macroman) + default_charset_default_collation="macroman_general_ci" + default_charset_collations="macroman_general_ci macroman_bin" + ;; + sjis) + default_charset_default_collation="sjis_japanese_ci" + default_charset_collations="sjis_japanese_ci sjis_bin" + ;; + swe7) + default_charset_default_collation="swe7_swedish_ci" + default_charset_collations="swe7_swedish_ci swe7_bin" + ;; + tis620) + default_charset_default_collation="tis620_thai_ci" + default_charset_collations="tis620_thai_ci tis620_bin" + ;; + ucs2) + default_charset_default_collation="ucs2_general_ci" + default_charset_collations="ucs2_general_ci ucs2_bin" + ;; + ujis) + default_charset_default_collation="ujis_japanese_ci" + default_charset_collations="ujis_japanese_ci ujis_bin" + ;; + utf8) + default_charset_default_collation="utf8_general_ci" + default_charset_collations="utf8_general_ci utf8_bin" + ;; + *) + AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE). + See the Installation chapter in the Reference Manual.]); +esac + +if test "$default_collation" = default; then + default_collation=$default_charset_default_collation +fi + +valid_default_collation=no +for cl in $default_charset_collations +do + if test x"$cl" = x"$default_collation" + then + valid_default_collation=yes + break + fi +done + +if test x$valid_default_collation = xyes +then + AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS]) +else + AC_MSG_ERROR([ + Collation $default_collation is not valid for character set $default_charset. + Valid collations are: $default_charset_collations. + See the Installation chapter in the Reference Manual. + ]); +fi +AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_CHARSET_NAME,"$default_charset") +AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_COLLATION_NAME,"$default_collation") MYSQL_CHECK_ISAM MYSQL_CHECK_BDB diff --git a/include/mysql_version.h.in b/include/mysql_version.h.in index 793bf36e9fe..91cf3ecc074 100644 --- a/include/mysql_version.h.in +++ b/include/mysql_version.h.in @@ -20,8 +20,5 @@ #define MYSQL_CONFIG_NAME "my" /* mysqld compile time options */ -#ifndef MYSQL_CHARSET -#define MYSQL_CHARSET "@default_charset@" -#endif /* MYSQL_CHARSET */ #endif /* _CUSTOMCONFIG_ */ #endif /* _mysql_version_h */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 86ec00e1e92..6d31abc3dc9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4642,7 +4642,7 @@ static void mysql_init_variables(void) pidfile_name_ptr= pidfile_name; log_error_file_ptr= log_error_file; language_ptr= language; - default_collation_name= 0; + default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME; mysql_data_home= mysql_real_data_home; thd_startup_options= (OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL | OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE); @@ -4681,7 +4681,7 @@ static void mysql_init_variables(void) /* Variables in libraries */ charsets_dir= 0; - sys_charset.value= (char*) MYSQL_CHARSET; + sys_charset.value= (char*) MYSQL_DEFAULT_CHARSET_NAME; sys_charset_system.value= (char*) system_charset_info->csname; /* Set default values for some option variables */ |