diff options
author | unknown <monty@mysql.com> | 2005-05-16 15:26:40 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-05-16 15:26:40 +0300 |
commit | 4d3d703200f2ef575942d0c053371c6596b77b7d (patch) | |
tree | 947fb072bf07d38ba8947779578299a196136c92 /libmysql | |
parent | b9a4e7d88eabba5b7463da899d1a72a264a84093 (diff) | |
parent | d15f89c47afd2b674e666098eee69ec8bdfb901d (diff) | |
download | mariadb-git-4d3d703200f2ef575942d0c053371c6596b77b7d.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
BitKeeper/etc/logging_ok:
auto-union
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index f070d95780c..463f9da6ad5 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1495,37 +1495,40 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql) return mysql->charset->csname; } + int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name) { struct charset_info_st *cs; - const char *save_csdir = charsets_dir; + const char *save_csdir= charsets_dir; if (mysql->options.charset_dir) - charsets_dir = mysql->options.charset_dir; + charsets_dir= mysql->options.charset_dir; - if ( (cs = get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))) ) + if ((cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0)))) { char buff[MY_CS_NAME_SIZE + 10]; - charsets_dir = save_csdir; + charsets_dir= save_csdir; sprintf(buff, "SET NAMES %s", cs_name); - if (!mysql_query(mysql, buff)) { - mysql->charset = cs; - } - } else { + if (!mysql_query(mysql, buff)) + { + mysql->charset= cs; + } + } + else + { char cs_dir_name[FN_REFLEN]; get_charsets_dir(cs_dir_name); - mysql->net.last_errno=CR_CANT_READ_CHARSET; + 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, - ER(mysql->net.last_errno), - cs_name, - cs_dir_name); + my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error) - 1, + ER(mysql->net.last_errno), cs_name, cs_dir_name); } - charsets_dir = save_csdir; + charsets_dir= save_csdir; return mysql->net.last_errno; } + uint STDCALL mysql_thread_safe(void) { #ifdef THREAD |