diff options
author | unknown <msvensson@neptunus.(none)> | 2006-02-23 10:30:31 +0100 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-02-23 10:30:31 +0100 |
commit | 897f8eabf5e1dba41d0e7cafdddb781ce1beecaa (patch) | |
tree | 9146ec569bd9bf67b47d52e7e1ecdc29a1d5fb26 /client/mysqltest.c | |
parent | f0cff0f64881798cdb3ae537baf3936ddf430073 (diff) | |
parent | 44e286d215a8aab474c98c32a7c3896a581a0a10 (diff) | |
download | mariadb-git-897f8eabf5e1dba41d0e7cafdddb781ce1beecaa.tar.gz |
Merge neptunus.(none):/home/msvensson/mysql/mysqltest_replace/my50-mysqltest_replace
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
client/mysqltest.c:
Auto merged
mysql-test/r/mysqltest.result:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysql-test/t/mysqltest.test:
Merge
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r-- | client/mysqltest.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 34ddd6b0b8a..57d76a169a7 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -457,7 +457,8 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name); static void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds, const char *from, int len); void free_pointer_array(POINTER_ARRAY *pa); -static void do_eval(DYNAMIC_STRING *query_eval, const char *query); +static void do_eval(DYNAMIC_STRING *query_eval, const char *query, + my_bool pass_through_escape_chars); static void str_to_file(const char *fname, char *str, int size); #ifdef __WIN__ @@ -489,7 +490,8 @@ static void handle_error(const char *query, struct st_query *q, const char *err_sqlstate, DYNAMIC_STRING *ds); static void handle_no_error(struct st_query *q); -static void do_eval(DYNAMIC_STRING* query_eval, const char *query) +static void do_eval(DYNAMIC_STRING* query_eval, const char *query, + my_bool pass_through_escape_chars) { const char *p; register char c, next_c; @@ -524,6 +526,12 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char *query) { /* Set escaped only if next char is \ or $ */ escaped = 1; + + if (pass_through_escape_chars) + { + /* The escape char should be added to the output string. */ + dynstr_append_mem(query_eval, p, 1); + } } else dynstr_append_mem(query_eval, p, 1); @@ -713,7 +721,7 @@ static int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) init_dynamic_string(&res_ds, "", 0, 65536); if (eval_result) { - do_eval(&res_ds, tmp); + do_eval(&res_ds, tmp, FALSE); res_ptr = res_ds.str; if ((res_len = res_ds.length) != ds->length) { @@ -1085,7 +1093,7 @@ static void do_exec(struct st_query *query) init_dynamic_string(&ds_cmd, 0, strlen(cmd)+256, 256); /* Eval the command, thus replacing all environment variables */ - do_eval(&ds_cmd, cmd); + do_eval(&ds_cmd, cmd, TRUE); cmd= ds_cmd.str; DBUG_PRINT("info", ("Executing '%s' as '%s'", @@ -1379,7 +1387,7 @@ int do_system(struct st_query *command) init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256); /* Eval the system command, thus replacing all environment variables */ - do_eval(&ds_cmd, command->first_argument); + do_eval(&ds_cmd, command->first_argument, TRUE); DBUG_PRINT("info", ("running system command '%s' as '%s'", command->first_argument, ds_cmd.str)); @@ -4009,7 +4017,7 @@ static void run_query(MYSQL *mysql, struct st_query *command, int flags) if (command->type == Q_EVAL) { init_dynamic_string(&eval_query, "", 16384, 65536); - do_eval(&eval_query, command->query); + do_eval(&eval_query, command->query, FALSE); query = eval_query.str; query_len = eval_query.length; } |