Commit 384ae2ef authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fixed that one can always get a name for a compiled characterset

parent e05bf277
Loading
Loading
Loading
Loading
+49 −9
Original line number Diff line number Diff line
@@ -19777,6 +19777,10 @@ joins that don't use keys properly.
@item
If @code{Threads_created} is big, you may want to increase the
@code{thread_cache_size} variable.
@item
If @code{Created_tmp_disk_tables} is big, you may want to increase the
@code{tmp_table_size} variable to get the temporary tables memory based
instead of disk based.
@end itemize
@@ -20411,6 +20415,7 @@ Create Table: CREATE TABLE t (
* Character arrays::            The character definition arrays
* String collating::            String Collating Support
* Multi-byte characters::       Multi-byte Character Support
* Problems with character sets::  
@end menu
@@ -20744,7 +20749,7 @@ the maximum ratio the strings may grow during @code{my_strxfrm_MYSET} (it
must be a positive integer).
@node Multi-byte characters,  , String collating, Localization
@node Multi-byte characters, Problems with character sets, String collating, Localization
@subsection Multi-byte Character Support
@cindex characters, multi-byte
@@ -20763,6 +20768,41 @@ You must specify the @code{mbmaxlen_MYSET=N} value in the special
comment at the top of the source file.  @code{N} should be set to the
size in bytes of the largest character in the set.
@node Problems with character sets,  , Multi-byte characters, Localization
@subsection Problems With Character Sets
If you try to use a character set that is not compiled into your binary,
you can run into a couple of different problems:
@itemize @bullet
@item
Your program has a wrong path to where the character sets are stored.
(Default @file{/usr/local/mysql/share/mysql/charsets}).  
This can be fixed by using the @code{--character-sets-dir}
option to the program in question.
@item
The character set is a multi-byte-character set that can't be loaded
dynamicly.  In this case you have to recompiled the program with the
support for the character set.
@item
The character set is a dynamic character set, but you don't have a
configure file for it.  In this case you should install the configure
file for the character set from a new MySQL distribution.
@item
Your @file{Index} file doesn't contain the name for the character set.
@example
ERROR 1105: File '/usr/local/share/mysql/charsets/?.conf' not found
(Errcode: 2)
@end example
In this case you should either get a new @code{Index} file or add
by hand the name of any missing character sets.
@end itemize
For MyISAM tables, you can check the character set name and number for a
table with @code{myisamchk -dvv table_name}.
@node Server-Side Scripts, Client-Side Scripts, Localization, MySQL Database Administration
@section MySQL Server-Side Scripts and Utilities
@@ -39313,7 +39353,7 @@ likely it is that we can fix the problem!
* C API function overview::     C API Function Overview
* C API functions::             C API Function Descriptions
* C Thread functions::          C Thread Functions
* C Embedded Server functions:: C Embedded Server Functions
* C Embedded Server functions:: C Embedded Server functions.  C Embedded Server Functions
* C API problems::              Common questions and problems when using the C API
* Building clients::            Building Client Programs
* Threaded clients::            How to Make a Threaded Client
+6 −2
Original line number Diff line number Diff line
@@ -726,7 +726,7 @@ AC_MSG_CHECKING(for OpenSSL)
      openssl_includes="-I/usr/local/ssl/include"
      AC_DEFINE(HAVE_OPENSSL)
    else
      AC_MSG_RESULT("disabled because --with-vio wasn't used")
      AC_MSG_RESULT(disabled because --with-vio wasn not used)
    fi
  else
    AC_MSG_RESULT(no)
@@ -748,15 +748,19 @@ dnl Call MYSQL_CHECK_ORBIT even if mysqlfs == no, so that @orbit_*@
dnl get substituted.
  MYSQL_CHECK_ORBIT

  AC_MSG_CHECKING(if we should build MySQLFS)
  fs_dirs=""
  if test "$mysqlfs" = "yes"
  then
    if test -n "$orbit_exec_prefix"
    then
      fs_dirs=fs
      AC_MSG_RESULT([yes])
    else
      AC_MSG_RESULT("disabled because ORBIT, the CORBA ORB, wasn't found"])
      AC_MSG_RESULT(disabled because ORBIT, the CORBA ORB, was not found)
    fi
  else
    AC_MSG_RESULT([no])
  fi
  AC_SUBST([fs_dirs])
])
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *find_compiled_charset(uint cs_number);
extern CHARSET_INFO *find_compiled_charset_by_name(const char *name);
extern CHARSET_INFO  compiled_charsets[];
extern uint compiled_charset_number(const char *name);
extern const char *compiled_charset_name(uint charset_number);

#define MY_CHARSET_UNDEFINED 0
#define MY_CHARSET_CURRENT (default_charset_info->number)
+14 −21
Original line number Diff line number Diff line
@@ -44,13 +44,6 @@ struct simpleconfig_buf_st {
  char *p;
};

/* Defined in strings/ctype.c */

CHARSET_INFO *find_compiled_charset(uint cs_number);
uint compiled_charset_number(const char *name);
const char *compiled_charset_name(uint charset_number);


static uint num_from_csname(CS_ID **cs, const char *name)
{
  CS_ID **c;
@@ -264,21 +257,21 @@ static my_bool read_charset_file(uint cs_number, CHARSET_INFO *set,

uint get_charset_number(const char *charset_name)
{
  my_bool error;
  error = init_available_charsets(MYF(0));	/* If it isn't initialized */
  if (error)
    return compiled_charset_number(charset_name);
  else
  uint number=compiled_charset_number(charset_name);
  if (number)
    return number;
  if (init_available_charsets(MYF(0)))	/* If it isn't initialized */
    return 0;
  return num_from_csname(available_charsets, charset_name);
}

const char *get_charset_name(uint charset_number)
{
  my_bool error;
  error = init_available_charsets(MYF(0));	/* If it isn't initialized */
  if (error)
    return compiled_charset_name(charset_number);
  else
  char *name=compiled_charset_name(charset_number);
  if (*name != '?')
    return name;
  if (init_available_charsets(MYF(0)))	/* If it isn't initialized */
    return "?";
  return name_from_csnum(available_charsets, charset_number);
}

@@ -293,8 +286,8 @@ static CHARSET_INFO *find_charset(CHARSET_INFO **table, uint cs_number,
  return NULL;
}

static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table, const char *name,
					  size_t tablesz)
static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table,
					  const char *name, size_t tablesz)
{
  uint i;
  for (i = 0; i < tablesz; ++i)
+1 −1
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ int main(int argc,char **argv)

  MY_INIT(argv[0]);

  start_value=1060872L; best_t1=7930739L;  best_t2=4311642L;  best_type=3; /* mode=5333  add=6  type: 0 */
  start_value=1109118L; best_t1=6657025L;  best_t2=6114496L;  best_type=1; /* mode=4903  add=3  type: 0 */
  if (get_options(argc,(char **) argv))
    exit(1);