summaryrefslogtreecommitdiff
path: root/client/mysqladmin.c
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-05-15 23:00:58 +0200
committerunknown <guilhem@mysql.com>2003-05-15 23:00:58 +0200
commit80c1556a8f2b47f16c9e9187705be4de93f3902e (patch)
tree783ef09dc4f3e7afee9ec3ad35b74367c935b994 /client/mysqladmin.c
parentddabd51c5738bf3bd9f0f40d7368bd3eee92e966 (diff)
downloadmariadb-git-80c1556a8f2b47f16c9e9187705be4de93f3902e.tar.gz
changes to mysqladmin : use queries instead of commands (so that they have a chance to go
into the binlog), SLAVE START -> START SLAVE, error test changes. client/mysqladmin.c: Now that FLUSH TABLES and some other FLUSH go into the binlog, the same commands issued from mysqladmin should also go into the binlog. How could I explain to a user that "mysql -e 'flush tables'" is not exactly the same as "mysqladmin flush-tables" ?? So I replace mysql_refresh() by mysql_query(). Also SLAVE START -> START SLAVE to make this work with 4.1 (it won't work with 3.23 anymore). Also the code tested for mysql_refresh() < 0 for errors, but this cannot happen : - mysql_refresh() calls simple_command() - in 4.1 the return type of simple_command() is my_bool, and I have checked the 4.1 libmysql code and it returns 0 or 1, not negative values. - note that in 4.0 libmysql, simple_command() returns int which can be < 0, but we don't care here as we link the 4.1 mysqladmin with the 4.1 libmysql. Btw, some other parts of the code already checked for mysql_refresh() != 0, not < 0. So now it's homogenous : we always test for != 0 instead of < 0.
Diffstat (limited to 'client/mysqladmin.c')
-rw-r--r--client/mysqladmin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index cba137d54c6..f5a9a70c820 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -520,7 +520,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_PRIVILEGES:
case ADMIN_RELOAD:
- if (mysql_refresh(mysql,REFRESH_GRANT) < 0)
+ if (mysql_query(mysql,"flush privileges"))
{
my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -531,7 +531,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_refresh(mysql,
(uint) ~(REFRESH_GRANT | REFRESH_STATUS |
REFRESH_READ_LOCK | REFRESH_SLAVE |
- REFRESH_MASTER)) < 0)
+ REFRESH_MASTER)))
{
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -539,7 +539,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
break;
case ADMIN_FLUSH_THREADS:
- if (mysql_refresh(mysql,(uint) REFRESH_THREADS) < 0)
+ if (mysql_refresh(mysql,(uint) REFRESH_THREADS))
{
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -726,7 +726,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_HOSTS:
{
- if (mysql_refresh(mysql,REFRESH_HOSTS))
+ if (mysql_query(mysql,"flush hosts"))
{
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -736,7 +736,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_TABLES:
{
- if (mysql_refresh(mysql,REFRESH_TABLES))
+ if (mysql_query(mysql,"flush tables"))
{
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -746,7 +746,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_STATUS:
{
- if (mysql_refresh(mysql,REFRESH_STATUS))
+ if (mysql_query(mysql,"flush status"))
{
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql));
@@ -793,7 +793,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_START_SLAVE:
- if (mysql_query(mysql, "SLAVE START"))
+ if (mysql_query(mysql, "START SLAVE"))
{
my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL),
mysql_error(mysql));
@@ -803,7 +803,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
puts("Slave started");
break;
case ADMIN_STOP_SLAVE:
- if (mysql_query(mysql, "SLAVE STOP"))
+ if (mysql_query(mysql, "STOP SLAVE"))
{
my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL),
mysql_error(mysql));