summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 4b8bb047e47..8e72bc8edb8 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "2.4"
+#define MTEST_VERSION "2.5"
#include <my_global.h>
#include <mysql_embed.h>
@@ -151,6 +151,7 @@ const char* user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
static int port = 0;
static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0;
static my_bool tty_password= 0, ps_protocol= 0, ps_protocol_enabled= 0;
+static int parsing_disabled= 0;
static uint start_lineno, *lineno;
const char* manager_user="root",*manager_host=0;
char *manager_pass=0;
@@ -308,6 +309,7 @@ Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_EXIT,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_IF,
+Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@@ -399,6 +401,8 @@ const char *command_names[]=
"disable_reconnect",
"enable_reconnect",
"if",
+ "disable_parsing",
+ "enable_parsing",
0
};
@@ -2141,7 +2145,7 @@ int read_line(char* buf, int size)
}
break;
case R_LINE_START:
- if (c == '#' || c == '-')
+ if (c == '#' || c == '-' || parsing_disabled)
{
state = R_COMMENT;
}
@@ -2268,18 +2272,22 @@ int read_query(struct st_query** q_ptr)
/* This goto is to avoid losing the "expected error" info. */
goto end;
}
- memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
- sizeof(global_expected_errno));
- q->expected_errors= global_expected_errors;
- q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
- bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
- global_expected_errors=0;
+ if (!parsing_disabled)
+ {
+ memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
+ sizeof(global_expected_errno));
+ q->expected_errors= global_expected_errors;
+ q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
+ bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
+ global_expected_errors=0;
+ }
+
if (p[0] == '-' && p[1] == '-')
{
q->type= Q_COMMENT_WITH_COMMAND;
p+= 2; /* To calculate first word */
}
- else
+ else if (!parsing_disabled)
{
if (*p == '!')
{
@@ -3586,20 +3594,29 @@ void get_query_type(struct st_query* q)
uint type;
DBUG_ENTER("get_query_type");
- if (*q->query == '}')
+ if (!parsing_disabled && *q->query == '}')
{
q->type = Q_END_BLOCK;
DBUG_VOID_RETURN;
}
if (q->type != Q_COMMENT_WITH_COMMAND)
- q->type = Q_QUERY;
+ q->type= parsing_disabled ? Q_COMMENT : Q_QUERY;
save=q->query[q->first_word_len];
q->query[q->first_word_len]=0;
type=find_type(q->query, &command_typelib, 1+2);
q->query[q->first_word_len]=save;
if (type > 0)
+ {
q->type=(enum enum_commands) type; /* Found command */
+ /*
+ If queries are disabled, only recognize
+ --enable-queries and --disable-queries
+ */
+ if (parsing_disabled && q->type != Q_ENABLE_PARSING &&
+ q->type != Q_DISABLE_PARSING)
+ q->type= Q_COMMENT;
+ }
DBUG_VOID_RETURN;
}
@@ -3963,6 +3980,17 @@ int main(int argc, char **argv)
case Q_ENABLE_RECONNECT:
cur_con->mysql.reconnect= 1;
break;
+ case Q_DISABLE_PARSING:
+ parsing_disabled++;
+ break;
+ case Q_ENABLE_PARSING:
+ /*
+ Ensure we don't get parsing_disabled < 0 as this would accidently
+ disable code we don't want to have disabled
+ */
+ if (parsing_disabled > 0)
+ parsing_disabled--;
+ break;
case Q_EXIT:
abort_flag= 1;