diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d0c58d2f57b..68668c92e3e 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -132,6 +132,7 @@ struct st_block int line; /* Start line of block */ my_bool ok; /* Should block be executed */ enum block_cmd cmd; /* Command owning the block */ + char delim[MAX_DELIMITER_LENGTH]; /* Delimiter before block */ }; static struct st_block block_stack[32]; @@ -4622,7 +4623,6 @@ void select_connection_name(const char *name) if (!con) die("connection '%s' not found in connection pool", name); - con->pending= FALSE; set_current_connection(con); DBUG_VOID_RETURN; @@ -5143,6 +5143,12 @@ int do_done(struct st_command *command) } else { + if (*cur_block->delim) + { + /* Restore "old" delimiter after false if block */ + strcpy (delimiter, cur_block->delim); + delimiter_length= strlen(delimiter); + } /* Pop block from stack, goto next line */ cur_block--; parser.current_line++; @@ -5201,6 +5207,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) cur_block++; cur_block->cmd= cmd; cur_block->ok= FALSE; + cur_block->delim[0]= '\0'; DBUG_VOID_RETURN; } @@ -5237,6 +5244,15 @@ void do_block(enum block_cmd cmd, struct st_command* command) if (not_expr) cur_block->ok = !cur_block->ok; + if (cur_block->ok) + { + cur_block->delim[0]= '\0'; + } else + { + /* Remember "old" delimiter if entering a false if block */ + strcpy (cur_block->delim, delimiter); + } + DBUG_PRINT("info", ("OK: %d", cur_block->ok)); var_free(&v); @@ -6517,9 +6533,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (flags & QUERY_SEND_FLAG) { - if (cn->pending) - die ("Cannot run query on connection between send and reap"); - /* Send the query */ @@ -7111,6 +7124,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) init_dynamic_string(&ds_warnings, NULL, 0, 256); + if (cn->pending && (flags & QUERY_SEND_FLAG)) + die ("Cannot run query on connection between send and reap"); + /* Evaluate query if this is an eval command */ @@ -7665,7 +7681,14 @@ int main(int argc, char **argv) 1024, 0, 0, get_var_key, var_free, MYF(0))) die("Variable hash initialization failed"); - var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); + var_set_string("MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); + var_set_string("MYSQL_SYSTEM_TYPE", SYSTEM_TYPE); + var_set_string("MYSQL_MACHINE_TYPE", MACHINE_TYPE); + if (sizeof(void *) == 8) { + var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "64"); + } else { + var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "32"); + } memset(&master_pos, 0, sizeof(master_pos)); @@ -7792,7 +7815,8 @@ int main(int argc, char **argv) command->type= Q_COMMENT; } - my_bool ok_to_do= cur_block->ok; + /* delimiter needs to be executed so we can continue to parse */ + my_bool ok_to_do= cur_block->ok || command->type == Q_DELIMITER; /* Some commands need to be "done" the first time if they may get re-iterated over in a true context. This can only happen if there's |