Commit 4adb9abf authored by unknown's avatar unknown

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/usr/local/home/marty/MySQL/mysql-5.0

parents 15ff7fd8 a982c458
......@@ -218,6 +218,18 @@ enum mysql_rpl_type
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
typedef struct character_set
{
unsigned int number; /* character set number */
unsigned int state; /* character set state */
const char *csname; /* collation name */
const char *name; /* character set name */
const char *comment; /* comment */
const char *dir; /* character set directory */
unsigned int mbminlen; /* min. length for multibyte strings */
unsigned int mbmaxlen; /* max. length for multibyte strings */
} MY_CHARSET_INFO;
struct st_mysql_methods;
typedef struct st_mysql
......@@ -418,6 +430,8 @@ my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset);
/* local infile support */
......
......@@ -1495,6 +1495,21 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql)
return mysql->charset->csname;
}
void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo)
{
csinfo->number = mysql->charset->number;
csinfo->state = mysql->charset->state;
csinfo->csname = mysql->charset->csname;
csinfo->name = mysql->charset->name;
csinfo->comment = mysql->charset->comment;
csinfo->mbminlen = mysql->charset->mbminlen;
csinfo->mbmaxlen = mysql->charset->mbmaxlen;
if (mysql->options.charset_dir)
csinfo->dir = mysql->options.charset_dir;
else
csinfo->dir = charsets_dir;
}
int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name)
{
......
......@@ -149,5 +149,6 @@ EXPORTS
mysql_server_init
mysql_server_end
mysql_set_character_set
mysql_get_character_set_info
get_defaults_files
modify_defaults_file
......@@ -13626,6 +13626,23 @@ static void test_bug10214()
mysql_query(mysql, "set sql_mode=''");
}
static void test_client_character_set()
{
MY_CHARSET_INFO cs;
const char *csname;
int rc;
myheader("test_client_character_set");
csname = "utf8";
rc = mysql_set_character_set(mysql, csname);
DIE_UNLESS(rc == 0);
mysql_get_character_set_info(mysql, &cs);
DIE_UNLESS(!strcmp(cs.csname, "utf8"));
DIE_UNLESS(!strcmp(cs.name, "utf8_general_ci"));
}
/*
Read and parse arguments and MySQL options from my.cnf
......@@ -13850,6 +13867,7 @@ static struct my_tests_st my_tests[]= {
{ "test_cursors_with_union", test_cursors_with_union },
{ "test_truncation", test_truncation },
{ "test_truncation_option", test_truncation_option },
{ "test_client_character_set", test_client_character_set },
{ "test_bug8330", test_bug8330 },
{ "test_bug7990", test_bug7990 },
{ "test_bug8378", test_bug8378 },
......
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