summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorjani@hynda.(none) <>2002-08-05 18:37:43 +0300
committerjani@hynda.(none) <>2002-08-05 18:37:43 +0300
commitfc0d47240e1bb4bdb7efb146af243ce33828e36c (patch)
tree2687a4382645b72ca8e990c39cd729a88dfc689b /client
parent9bc030f68ac0ef7bc69b4897f3251129bd9f7d98 (diff)
downloadmariadb-git-fc0d47240e1bb4bdb7efb146af243ce33828e36c.tar.gz
Added --count=N (-c) to mysqladmin
Diffstat (limited to 'client')
-rw-r--r--client/mysqladmin.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index d890a096542..d6232a38f64 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -23,7 +23,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
-#define ADMIN_VERSION "8.36"
+#define ADMIN_VERSION "8.37"
#define MAX_MYSQL_VAR 128
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -36,7 +36,8 @@ static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
tty_password=0;
-static uint tcp_port = 0, option_wait = 0, option_silent=0;
+static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
+ opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static my_string unix_port=0;
@@ -103,6 +104,10 @@ static TYPELIB command_typelib=
static struct my_option my_long_options[] =
{
+ {"count", 'c',
+ "Number of iterations to make. This works with -i (--sleep) only",
+ (gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@@ -177,6 +182,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int error = 0;
switch(optid) {
+ case 'c':
+ opt_count_iterations= 1;
+ break;
case 'p':
if (argument)
{
@@ -276,7 +284,7 @@ int main(int argc,char *argv[])
else
{
error = 0;
- while (!interrupted)
+ while (!interrupted && (!opt_count_iterations || nr_iterations))
{
new_line = 0;
if ((error=execute_commands(&mysql,argc,commands)))
@@ -303,6 +311,8 @@ int main(int argc,char *argv[])
sleep(interval);
if (new_line)
puts("");
+ if (opt_count_iterations)
+ nr_iterations--;
}
else
break;