summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.(none)>2007-11-01 00:10:58 +0300
committerunknown <kostja@bodhi.(none)>2007-11-01 00:10:58 +0300
commitbfae4730530ed6ae42739d560d655eb570641625 (patch)
tree69747828df5a86c88950f6d9b608d5d385d69c0e /sql/sql_parse.cc
parent8365a74e47afd6a9598f21b75f3360448b69fcf6 (diff)
downloadmariadb-git-bfae4730530ed6ae42739d560d655eb570641625.tar.gz
Remove net_printf_error(). Do not talk to network directly in
check_user()/check_connection()/check_for_max_user_connections(). This is a pre-requisite patch for the fix for Bug#12713 "Error in a stored function called from a SELECT doesn't cause ROLLBACK of statem" Implement review comments. sql/mysql_priv.h: check_for_max_user_connections() is used in one place only, make it static. sql/mysqld.cc: Remove net_printf_error(): a consolidation of error reporting facilities is necessary to simplify maintenance of the query cache, the client-server protocol, stored procedure continue handlers. Rewrite the only place where its use is somewhat justified (my_error() can not be used since we need to report an error for the thread that does not exist) with my_snprintf()/net_send_error(). sql/protocol.cc: Remove net_printf_error(). sql/protocol.h: Remove net_printf_error(). sql/sql_connect.cc: Remove net_printf_error(). In check_connection()/check_user()/ check_for_max_user_connections() do not write directly to the network, but use the standard my_error() mechanism to record an error in THD. It will be sent to the client by the caller. This was the last place in the server that would attempt to send an error directly, mainly left untouched by 5.0 refactoring because it is executed only during thread startup. sql/sql_parse.cc: In the old code, when res was greater than 0, it contained an exact error code, e.g. ER_OUT_OF_RESOURCES or NO SUCH DATABASE, or ER_HANDSHAKE_ERROR. I don't know the reason why this error code was ignored, and instead a generic ER_UNKNOWN_COM_ERROR was pushed into the error stack, but knowing the relaxed attitude towards preserving the error codes in the old code, I'm inclinded to think that it was a bug. After this patch, the most specific error message is already pushed, so calling my_message() again is useless. If res is < 0, the error used to be already sent. This is not done by the new code, but will be done later, in the end of dispatch_command(). When this is done, clear_error() will be called for us - it is in the first lines of do_command. To sum up, this change is to remove COM_CHANGE_USER specific error handling in favor of the standard one employed for all other COM_* commands.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc5
1 files changed, 0 insertions, 5 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ac042960388..803d29d83d6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -915,11 +915,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (res)
{
- /* authentication failure, we shall restore old user */
- if (res > 0)
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
- else
- thd->clear_error(); // Error already sent to client
x_free(thd->security_ctx->user);
*thd->security_ctx= save_security_ctx;
thd->user_connect= save_user_connect;