*** ./config/ac-macros/character_sets.m4.orig 2005-12-21 11:39:48.000000000 -0800 --- ./config/ac-macros/character_sets.m4 2007-04-12 23:14:45.000000000 -0700 *************** *** 429,431 **** --- 429,442 ---- else AC_MSG_RESULT(no) fi + + + AC_ARG_ENABLE([external-charsets], + [ --disable-external-charsets do not read any external charset], + [external_charsets="$enableval"], + [external_charsets=yes]) + + if test "$external_charsets" = no ; then + AC_DEFINE([DISABLE_EXTERNAL_CHARSETS], [1], [disable loading any external charset]) + fi + *** ./sql-common/client.c.orig 2005-12-21 11:40:02.000000000 -0800 --- ./sql-common/client.c 2007-04-15 16:37:54.000000000 -0700 *************** *** 1931,1937 **** else { char cs_dir_name[FN_REFLEN]; ! get_charsets_dir(cs_dir_name); my_snprintf(net->last_error, sizeof(net->last_error)-1, ER(net->last_errno), mysql->options.charset_name, --- 1931,1938 ---- else { char cs_dir_name[FN_REFLEN]; ! char *p = get_charsets_dir(cs_dir_name); ! if ( ! p ) strmov(cs_dir_name,""); my_snprintf(net->last_error, sizeof(net->last_error)-1, ER(net->last_errno), mysql->options.charset_name, *************** *** 2840,2846 **** else { char cs_dir_name[FN_REFLEN]; ! get_charsets_dir(cs_dir_name); mysql->net.last_errno= CR_CANT_READ_CHARSET; strmov(mysql->net.sqlstate, unknown_sqlstate); my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error) - 1, --- 2841,2848 ---- else { char cs_dir_name[FN_REFLEN]; ! char *p = get_charsets_dir(cs_dir_name); ! if ( ! p ) strmov(cs_dir_name,""); mysql->net.last_errno= CR_CANT_READ_CHARSET; strmov(mysql->net.sqlstate, unknown_sqlstate); my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error) - 1, *** ./mysys/charset.c.orig 2005-12-21 11:39:44.000000000 -0800 --- ./mysys/charset.c 2007-04-16 11:02:03.000000000 -0700 *************** *** 345,366 **** char *get_charsets_dir(char *buf) { - const char *sharedir= SHAREDIR; char *res; DBUG_ENTER("get_charsets_dir"); if (charsets_dir != NULL) strmake(buf, charsets_dir, FN_REFLEN-1); else { if (test_if_hard_path(sharedir) || is_prefix(sharedir, DEFAULT_CHARSET_HOME)) strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); else strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, NullS); } - res= convert_dirname(buf,buf,NullS); DBUG_PRINT("info",("charsets dir: '%s'", buf)); DBUG_RETURN(res); } --- 345,405 ---- char *get_charsets_dir(char *buf) { char *res; DBUG_ENTER("get_charsets_dir"); + static int use_ext_charsets = -1 ; + if ( charsets_dir == NULL && use_ext_charsets == -1 ) + { + #if DISABLE_EXTERNAL_CHARSETS + use_ext_charsets = 0 ; + #else + use_ext_charsets = 1; + #endif + char* p = getenv("MYSQL_EXTERNAL_CHARSETS"); + if ( p ) + { + if ( strcmp(p,"yes") == 0 ) + { + use_ext_charsets = 1; + } + else if ( strcmp(p,"no") == 0 ) + { + use_ext_charsets = 0; + } + else + { + charsets_dir = p; + } + } + } + if (charsets_dir != NULL) + { strmake(buf, charsets_dir, FN_REFLEN-1); + res= convert_dirname(buf,buf,NullS); + } + else if ( ! use_ext_charsets ) + { + /* + if we do not do external charsets then set the directory to empty string + but also return zero pointer so the clients can see that there is no + external directory (as opposed to the current directory) + */ + buf[0] = '\0' ; + res = 0 ; + } else { + const char *sharedir= SHAREDIR; if (test_if_hard_path(sharedir) || is_prefix(sharedir, DEFAULT_CHARSET_HOME)) strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); else strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, NullS); + res= convert_dirname(buf,buf,NullS); } DBUG_PRINT("info",("charsets dir: '%s'", buf)); DBUG_RETURN(res); } *************** *** 387,392 **** --- 426,432 ---- #endif { char fname[FN_REFLEN]; + char* fnameptr; my_bool error=FALSE; /* We have to use charset_initialized to not lock on THR_LOCK_charset *************** *** 418,425 **** } } ! strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); ! error= my_read_charset_file(fname,myflags); charset_initialized=1; } pthread_mutex_unlock(&THR_LOCK_charset); --- 458,468 ---- } } ! fnameptr = get_charsets_dir(fname) ; ! if ( fnameptr ) { ! strmov(fnameptr, MY_CHARSET_INDEX); ! error= my_read_charset_file(fname,myflags); ! } charset_initialized=1; } pthread_mutex_unlock(&THR_LOCK_charset); *************** *** 484,491 **** { if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED)) { ! strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); ! my_read_charset_file(buf,flags); } cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL; } --- 527,537 ---- { if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED)) { ! char *p = get_charsets_dir(buf); ! if ( p ) { ! strxmov(p, cs->csname, ".xml", NullS); ! my_read_charset_file(buf,flags); ! } } cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL; } *************** *** 518,528 **** if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN], cs_string[23]; ! strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); cs_string[0]='#'; int10_to_str(cs_number, cs_string+1, 10); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file); } return cs; } --- 564,579 ---- if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN], cs_string[23]; ! char *p = get_charsets_dir(index_file); ! if ( p ) ! strmov(p,MY_CHARSET_INDEX); ! else ! strmov(index_file,""); cs_string[0]='#'; int10_to_str(cs_number, cs_string+1, 10); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file); } + return cs; } *************** *** 538,547 **** if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; ! strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); my_error(EE_UNKNOWN_COLLATION, MYF(ME_BELL), cs_name, index_file); } - return cs; } --- 589,601 ---- if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; ! char *p = get_charsets_dir(index_file); ! if ( p ) ! strmov(p,MY_CHARSET_INDEX); ! else ! strmov(index_file,""); my_error(EE_UNKNOWN_COLLATION, MYF(ME_BELL), cs_name, index_file); } return cs; } *************** *** 563,569 **** if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; ! strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); } --- 617,627 ---- if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; ! char *p = get_charsets_dir(index_file); ! if ( p ) ! strmov(p,MY_CHARSET_INDEX); ! else ! strmov(index_file,""); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); } *** ./config.h.in.orig 2005-12-21 11:40:31.000000000 -0800 --- ./config.h.in 2007-04-13 00:12:52.000000000 -0700 *************** *** 14,19 **** --- 14,22 ---- /* all charsets are available */ #undef DEFINE_ALL_CHARACTER_SETS + /* disable loading any external charset */ + #undef DISABLE_EXTERNAL_CHARSETS + /* Version of .frm files */ #undef DOT_FRM_VERSION *** Docs/mysql.info.orig 2007-04-16 11:07:06.000000000 -0700 --- Docs/mysql.info 2007-04-16 11:33:55.000000000 -0700 *************** *** 7155,7160 **** --- 7155,7164 ---- * `all' - to include all character sets into the binaries + With the `configure' option --disable-external-charsets you can + build the library which does not read external character set tables + by default. + * To configure MySQL with debugging code, use the -with-debug option: shell> ./configure --with-debug *************** *** 25674,25683 **** You can change the character set with the -default-character-set option when you start the server. The character sets available depend on the ! -with-charset=CHARSET and -with-extra-charsets=LIST-OF-CHARSETS | ! complex | all | none options to `configure', and the character set ! configuration files listed in `SHAREDIR/charsets/Index'. See *Note ! configure-options::. You can also change the character set collation with the -default-collation option when you start the server. The collation must --- 25678,25687 ---- You can change the character set with the -default-character-set option when you start the server. The character sets available depend on the ! -with-charset=CHARSET, -with-extra-charsets=LIST-OF-CHARSETS | ! complex | all | none, and -disable-external-charsets options to ! `configure', and the character set configuration files listed in ! `SHAREDIR/charsets/Index'. See *Note configure-options::. You can also change the character set collation with the -default-collation option when you start the server. The collation must *************** *** 25720,25725 **** --- 25724,25759 ---- This is normally unnecessary, however. + When mysql is built with the -disable-external-charsets configure option + it normally does not read any external character sets from + `SHAREDIR/charsets/Index'. This can be changed at run time with either + -character-sets-dir option or environment variable MYSQL_EXTERNAL_CHARSETS: + + * If -character-sets-dir option is used, either on command line or in + option file, then its value is always used for the path to external + character sets. This does not depend on whether + -disable-external-charsets was used or not during configure. + + * If environment variable MYSQL_EXTERNAL_CHARSETS is set to `yes' + then `SHAREDIR/charsets' is used as path to external character sets. + This does not depend on whether -disable-external-charsets was used + or not during configure. + + * If environment variable MYSQL_EXTERNAL_CHARSETS is set to `no' then + no external character sets are loaded. This also does not depend on + whether -disable-external-charsets was used or not during configure. + + * If environment variable MYSQL_EXTERNAL_CHARSETS is set to anything + else then its value is used for the path to external character sets. + This does not depend on whether -disable-external-charsets was + used or not during configure. + + * If environment variable MYSQL_EXTERNAL_CHARSETS is not set then + the library configured with -disable-external-charsets does not + load external character set, and the library configured without + -disable-external-charsets (default) loads character sets from + `SHAREDIR/charsets'. +  File: manual.info, Node: german-character-set, Prev: character-sets, Up: character-sets