summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-06-18 23:50:04 +0200
committerunknown <guilhem@mysql.com>2004-06-18 23:50:04 +0200
commit83f485968f643cc87573d57be6944ff32b18d79a (patch)
tree5c90f764ac83bc68c87d34eac6dafe250ad13884 /sql/sql_parse.cc
parent408dad07a949a570c59e5f660d648c4df727625c (diff)
downloadmariadb-git-83f485968f643cc87573d57be6944ff32b18d79a.tar.gz
API change: mysql_shutdown() now requires a 2nd argument, the shutdown level.
mysqld >=4.1.3 will however understand shutdown requests sent by clients <4.1.3. And mysqld <4.1.3 will understand shutdown requests sent by clients >=4.1.3 (it will ignore the level). Those shutdown level are just PLACEHOLDERS now. So this change is just to make the 4.1 API suitable before it is frozen. Later we will actually implement the shutdown levels. VC++Files/winmysqladmin/main.cpp: 2nd argument to mysql_shutdown() VC++Files/winmysqladmin/mysql.h: 2nd argument to mysql_shutdown() VC++Files/winmysqladmin/mysql_com.h: Several types of shutdown now. include/mysql_com.h: SHUTDOWN_DEFAULT is now 0 instead of 255, this saves one test in sql_parse.cc libmysql/libmysql.c: correcting mistake (how come that my tests still all worked with this? - should recheck, for curiosity). sql/sql_parse.cc: with SHUTDOWN_DEFAULT==0, no need for testing packet_length.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b0d476c695f..cfb04c96d8d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1308,7 +1308,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (command != COM_STATISTICS && command != COM_PING)
query_id++;
thread_running++;
- /* TODO: set thd->lex->sql_command to SQLCOM_PARSE here */
+ /* TODO: set thd->lex->sql_command to SQLCOM_END here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->server_status&=
@@ -1479,7 +1479,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->query_length= length;
thd->query= packet;
thd->query_id= query_id++;
- /* TODO: set thd->lex->sql_command to SQLCOM_PARSE here */
+ /* TODO: set thd->lex->sql_command to SQLCOM_END here */
VOID(pthread_mutex_unlock(&LOCK_thread_count));
#ifndef EMBEDDED_LIBRARY
mysql_parse(thd, packet, length);
@@ -1637,13 +1637,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment(com_other,&LOCK_status);
if (check_global_access(thd,SHUTDOWN_ACL))
break; /* purecov: inspected */
- enum enum_shutdown_level level= (packet_length >= 2) ?
- (enum enum_shutdown_level) (uchar) packet[0] : SHUTDOWN_DEFAULT;
- DBUG_PRINT("quit",("Got shutdown command for level %u", level));
/*
- Accept old mysql_shutdown (with no argument). For now we do nothing of
- the argument.
+ If the client is < 4.1.3, it is going to send us no argument; then
+ packet_length is 1, packet[0] is the end 0 of the packet. Note that
+ SHUTDOWN_DEFAULT is 0. If client is >= 4.1.3, the shutdown level is in
+ packet[0].
*/
+ enum enum_shutdown_level level=
+ (enum enum_shutdown_level) (uchar) packet[0];
+ DBUG_PRINT("quit",("Got shutdown command for level %u", level));
if (level == SHUTDOWN_DEFAULT)
level= SHUTDOWN_WAIT_ALL_BUFFERS; // soon default will be configurable
else if (level != SHUTDOWN_WAIT_ALL_BUFFERS)
@@ -1652,6 +1654,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
send_error(thd);
break;
}
+ DBUG_PRINT("quit",("Got shutdown command for level %u", level));
mysql_log.write(thd,command,NullS);
send_eof(thd);
#ifdef __WIN__