summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2004-02-10 18:44:02 +0100
committerunknown <pem@mysql.com>2004-02-10 18:44:02 +0100
commit6efd76f317be8fc5fd0a2d144a7c57506723c2ad (patch)
treef04786f8a211a4c03eab547b7332792201289ac1 /sql-common
parent5390589c3c5845f48d3cf251d8b3dad359e0c9b1 (diff)
parent23103e44b4cc8abfdb1da47214ff2bd7cc2f3fca (diff)
downloadmariadb-git-6efd76f317be8fc5fd0a2d144a7c57506723c2ad.tar.gz
Merge 4.1 into 5.0.
BitKeeper/etc/logging_ok: auto-union configure.in: Auto merged BitKeeper/deleted/.del-opt_ft.cc~2048ffa561f9c59: Auto merged BitKeeper/deleted/.del-opt_ft.h~24aac1d29304599a: Auto merged client/mysql.cc: Auto merged include/my_global.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/rpl_until.test: Auto merged mysql-test/t/subselect.test: Auto merged sql/Makefile.am: Auto merged sql/filesort.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged sql-common/client.c: Auto merged
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c81
1 files changed, 34 insertions, 47 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 176f3a41cde..3902e9b3e1d 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1403,15 +1403,15 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
before calling mysql_real_connect !
*/
-static my_bool cli_mysql_read_query_result(MYSQL *mysql);
-static MYSQL_RES *cli_mysql_use_result(MYSQL *mysql);
+static my_bool cli_read_query_result(MYSQL *mysql);
+static MYSQL_RES *cli_use_result(MYSQL *mysql);
static MYSQL_METHODS client_methods=
{
- cli_mysql_read_query_result,
+ cli_read_query_result,
cli_advanced_command,
cli_read_rows,
- cli_mysql_use_result,
+ cli_use_result,
cli_fetch_lengths
#ifndef MYSQL_SERVER
,cli_list_fields,
@@ -1429,14 +1429,13 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
- char buff[NAME_LEN+USERNAME_LENGTH+100],charset_name_buff[16];
- char *end,*host_info,*charset_name;
+ char buff[NAME_LEN+USERNAME_LENGTH+100];
+ char *end,*host_info;
my_socket sock;
in_addr_t ip_addr;
struct sockaddr_in sock_addr;
ulong pkt_length;
NET *net= &mysql->net;
- uint charset_number;
#ifdef MYSQL_SERVER
thr_alarm_t alarmed;
ALARM alarm_buff;
@@ -1762,10 +1761,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error;
}
- charset_number= mysql->server_language;
-
/* Set character set */
- if ((charset_name=mysql->options.charset_name))
+ if (mysql->options.charset_name)
{
const char *save= charsets_dir;
if (mysql->options.charset_dir)
@@ -1773,44 +1770,34 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
MY_CS_PRIMARY,
MYF(MY_WME));
- charset_number= mysql->charset ? mysql->charset->number : 0;
charsets_dir= save;
- }
- else if (mysql->server_language)
- {
- charset_name=charset_name_buff;
- /* Save name in case of errors */
- int10_to_str(mysql->server_language, charset_name, 10);
- if (!(mysql->charset =
- get_charset((uint8) mysql->server_language, MYF(0))))
- mysql->charset = default_charset_info; /* shouldn't be fatal */
- }
- else
- {
- mysql->charset= default_charset_info;
- charset_number= mysql->charset->number;
- }
- if (!mysql->charset)
- {
- net->last_errno=CR_CANT_READ_CHARSET;
- strmov(net->sqlstate, unknown_sqlstate);
- if (mysql->options.charset_dir)
- my_snprintf(net->last_error, sizeof(net->last_error)-1,
- ER(net->last_errno),
- charset_name ? charset_name : "unknown",
- mysql->options.charset_dir);
- else
+ if (!mysql->charset)
{
- char cs_dir_name[FN_REFLEN];
- get_charsets_dir(cs_dir_name);
- my_snprintf(net->last_error, sizeof(net->last_error)-1,
+ net->last_errno=CR_CANT_READ_CHARSET;
+ strmov(net->sqlstate, unknown_sqlstate);
+ if (mysql->options.charset_dir)
+ my_snprintf(net->last_error, sizeof(net->last_error)-1,
+ ER(net->last_errno),
+ mysql->options.charset_name,
+ mysql->options.charset_dir);
+ 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),
- charset_name ? charset_name : "unknown",
+ mysql->options.charset_name,
cs_dir_name);
+ }
+ goto error;
}
- goto error;
}
+ else
+ {
+ mysql->charset= default_charset_info;
+ }
+
/* Save connection information */
if (!my_multi_malloc(MYF(0),
@@ -1870,7 +1857,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* 4.1 server and 4.1 client has a 32 byte option flag */
int4store(buff,client_flag);
int4store(buff+4, net->max_packet_size);
- buff[8]= (char) charset_number;
+ buff[8]= (char) mysql->charset->number;
bzero(buff+9, 32-9);
end= buff+32;
}
@@ -2022,7 +2009,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error;
if (mysql->fields)
{
- if (!(res= cli_mysql_use_result(mysql)))
+ if (!(res= cli_use_result(mysql)))
goto error;
mysql_free_result(res);
}
@@ -2240,13 +2227,13 @@ void STDCALL mysql_close(MYSQL *mysql)
DBUG_VOID_RETURN;
}
-static my_bool cli_mysql_read_query_result(MYSQL *mysql)
+static my_bool cli_read_query_result(MYSQL *mysql)
{
uchar *pos;
ulong field_count;
MYSQL_DATA *fields;
ulong length;
- DBUG_ENTER("cli_mysql_read_query_result");
+ DBUG_ENTER("cli_read_query_result");
/*
Read from the connection which we actually used, which
@@ -2419,10 +2406,10 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
have to wait for the client (and will not wait more than 30 sec/packet).
**************************************************************************/
-static MYSQL_RES * cli_mysql_use_result(MYSQL *mysql)
+static MYSQL_RES * cli_use_result(MYSQL *mysql)
{
MYSQL_RES *result;
- DBUG_ENTER("cli_mysql_use_result");
+ DBUG_ENTER("cli_use_result");
mysql = mysql->last_used_con;