diff options
author | unknown <hf@deer.(none)> | 2004-05-21 22:00:12 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-05-21 22:00:12 +0500 |
commit | 8a3adca7a138bafe1123213f9ac27513ed49dfff (patch) | |
tree | 3d52e56df8adca50f8e19dfd690455a1a3789f7d /libmysqld | |
parent | d4c67b60995f537f6e60276719e72fb2422b5853 (diff) | |
parent | d301fa9125bd0928fb5e56968e48f7dd8834f6b9 (diff) | |
download | mariadb-git-8a3adca7a138bafe1123213f9ac27513ed49dfff.tar.gz |
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.3744
client/mysql.cc:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/embedded_priv.h | 1 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 31 | ||||
-rw-r--r-- | libmysqld/libmysqld.c | 1 |
3 files changed, 21 insertions, 12 deletions
diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h index 1608f4ed4ad..d4316dff63f 100644 --- a/libmysqld/embedded_priv.h +++ b/libmysqld/embedded_priv.h @@ -28,5 +28,6 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); void *create_embedded_thd(int client_flag, char *db); int check_embedded_connection(MYSQL *mysql); void free_old_query(MYSQL *mysql); +void embedded_get_error(MYSQL *mysql); extern MYSQL_METHODS embedded_methods; C_MODE_END diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 09b03e38f2e..2bbca220db9 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -42,6 +42,22 @@ C_MODE_START #include "errmsg.h" #include <sql_common.h> +void embedded_get_error(MYSQL *mysql) +{ + THD *thd=(THD *) mysql->thd; + NET *net= &mysql->net; + if ((net->last_errno= thd->net.last_errno)) + { + memcpy(net->last_error, thd->net.last_error, sizeof(net->last_error)); + memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate)); + } + else + { + net->last_error[0]= 0; + strmov(net->sqlstate, not_error_sqlstate); + } +} + static my_bool emb_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, @@ -86,16 +102,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, if (!skip_check) result= thd->net.last_errno ? -1 : 0; - if ((net->last_errno= thd->net.last_errno)) - { - memcpy(net->last_error, thd->net.last_error, sizeof(net->last_error)); - memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate)); - } - else - { - net->last_error[0]= 0; - strmov(net->sqlstate, not_error_sqlstate); - } + embedded_get_error(mysql); mysql->server_status= thd->server_status; mysql->warning_count= ((THD*)mysql->thd)->total_warn_count; return result; @@ -239,6 +246,7 @@ static void emb_free_embedded_thd(MYSQL *mysql) free_rows(thd->data); thread_count--; delete thd; + mysql->thd=0; } static const char * emb_read_statistics(MYSQL *mysql) @@ -498,8 +506,7 @@ int check_embedded_connection(MYSQL *mysql) thd->host= (char*)my_localhost; thd->host_or_ip= thd->host; thd->user= my_strdup(mysql->user, MYF(0)); - check_user(thd, COM_CONNECT, NULL, 0, thd->db, true); - return 0; + return check_user(thd, COM_CONNECT, NULL, 0, thd->db, true); } #else diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 95f745aef5f..db9e828369d 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -232,6 +232,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, DBUG_RETURN(mysql); error: + embedded_get_error(mysql); DBUG_PRINT("error",("message: %u (%s)", mysql->net.last_errno, mysql->net.last_error)); { |