diff options
author | monty@narttu.mysql.fi <> | 2002-08-30 12:40:40 +0300 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2002-08-30 12:40:40 +0300 |
commit | 7134ffec210edde21860a2b2c2654be481de49b4 (patch) | |
tree | 1bb81fd601075133af9ee99bd7ac94baf5ffc46c /client/mysqltest.c | |
parent | 921f7c9c551d9e1bdd5083ebe71d204ab6246ba1 (diff) | |
parent | dd5382187e68ff5337e1fe7ba5f86f0d9cdd31d5 (diff) | |
download | mariadb-git-7134ffec210edde21860a2b2c2654be481de49b4.tar.gz |
Merge with 4.0.3
Some simple optimzations, more comments and indentation changes.
Add ` around database in 'use database' in binary log.
Moved max_error_count and max_warning_count to variables struct.
Removed SHOW_WARNS_COUNT and SHOW_ERRORS_COUNT calls.
Changed string functions to use character set of first string argument as default return characterset
(Each string function can change the above assumption if needed)
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r-- | client/mysqltest.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 987a614a25b..f469a33f063 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -481,9 +481,9 @@ void init_parser() int hex_val(int c) { - if (isdigit(c)) + if (my_isdigit(system_charset_info,c)) return c - '0'; - else if ((c = tolower(c)) >= 'a' && c <= 'f') + else if ((c = my_tolower(system_charset_info,c)) >= 'a' && c <= 'f') return c - 'a' + 10; else return -1; @@ -593,7 +593,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw, { const char* save_var_name = var_name, *end; end = (var_name_end) ? *var_name_end : 0; - while (isvar(*var_name) && var_name != end) + while (my_isvar(system_charset_info,*var_name) && var_name != end) ++var_name; if (var_name == save_var_name) { @@ -753,7 +753,7 @@ int do_server_op(struct st_query* q,const char* op) com_p=strmov(com_p,"_exec "); if (!*p) die("Missing server name in server_%s\n",op); - while (*p && !isspace(*p)) + while (*p && !my_isspace(system_charset_info,*p)) { *com_p++=*p++; } @@ -786,7 +786,7 @@ int do_require_version(struct st_query* q) if (!*p) die("Missing version argument in require_version\n"); ver_arg = p; - while (*p && !isspace(*p)) + while (*p && !my_isspace(system_charset_info,*p)) p++; *p = 0; ver_arg_len = p - ver_arg; @@ -816,7 +816,7 @@ int do_source(struct st_query* q) if (!*p) die("Missing file name in source\n"); name = p; - while (*p && !isspace(*p)) + while (*p && !my_isspace(system_charset_info,*p)) p++; *p = 0; @@ -1042,11 +1042,11 @@ int do_let(struct st_query* q) if (!*p) die("Missing variable name in let\n"); var_name = p; - while (*p && (*p != '=' || isspace(*p))) + while (*p && (*p != '=' || my_isspace(system_charset_info,*p))) p++; var_name_end = p; if (*p == '=') p++; - while (*p && isspace(*p)) + while (*p && my_isspace(system_charset_info,*p)) p++; var_val_start = p; return var_set(var_name, var_name_end, var_val_start, q->end); @@ -1073,12 +1073,13 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused))) } -int do_sleep(struct st_query* q, my_bool real_sleep) +int do_sleep(struct st_query* q) { - char* p=q->first_argument; + char *p=q->first_argument; struct timeval t; int dec_mul = 1000000; - while (*p && isspace(*p)) p++; + while (*p && my_isspace(system_charset_info,*p)) + p++; if (!*p) die("Missing argument in sleep\n"); t.tv_usec = 0; @@ -1089,7 +1090,6 @@ int do_sleep(struct st_query* q, my_bool real_sleep) DosSleep( opt_sleep * 1000); else DosSleep( atof( p) * 1000); - return 0; #else @@ -1098,7 +1098,7 @@ int do_sleep(struct st_query* q, my_bool real_sleep) else { t.tv_sec = atoi(p); - while (*p && *p != '.' && !isspace(*p)) + while (*p && *p != '.' && !my_isspace(system_charset_info,*p)) p++; if (*p == '.') { @@ -1130,7 +1130,7 @@ static void get_file_name(char *filename, struct st_query* q) char* p=q->first_argument; strnmov(filename, p, FN_REFLEN); /* Remove end space */ - while (p > filename && isspace(p[-1])) + while (p > filename && my_isspace(system_charset_info,p[-1])) p--; p[0]=0; } @@ -1216,7 +1216,7 @@ static char *get_string(char **to_ptr, char **from_ptr, if (*from != ' ' && *from) die("Wrong string argument in %s\n", q->query); - while (isspace(*from)) /* Point to next string */ + while (my_isspace(system_charset_info,*from)) /* Point to next string */ from++; *to =0; /* End of string marker */ @@ -1274,8 +1274,8 @@ static void get_replace(struct st_query *q) insert_pointer_name(&to_array,to); } for (i=1,pos=word_end_chars ; i < 256 ; i++) - if (isspace(i)) - *pos++=i; + if (my_isspace(system_charset_info,i)) + *pos++= i; *pos=0; /* End pointer */ if (!(glob_replace=init_replace((char**) from_array.typelib.type_names, (char**) to_array.typelib.type_names, @@ -1309,7 +1309,7 @@ int select_connection(struct st_query* q) if (!*p) die("Missing connection name in connect\n"); name = p; - while (*p && !isspace(*p)) + while (*p && !my_isspace(system_charset_info,*p)) p++; *p = 0; @@ -1335,7 +1335,7 @@ int close_connection(struct st_query* q) if (!*p) die("Missing connection name in connect\n"); name = p; - while (*p && !isspace(*p)) + while (*p && !my_isspace(system_charset_info,*p)) p++; *p = 0; @@ -1371,11 +1371,13 @@ int close_connection(struct st_query* q) char* safe_get_param(char* str, char** arg, const char* msg) { DBUG_ENTER("safe_get_param"); - while (*str && isspace(*str)) str++; + while (*str && my_isspace(system_charset_info,*str)) + str++; *arg = str; for (; *str && *str != ',' && *str != ')' ; str++) { - if (isspace(*str)) *str = 0; + if (my_isspace(system_charset_info,*str)) + *str = 0; } if (!*str) die(msg); @@ -1657,7 +1659,7 @@ int read_line(char* buf, int size) { state = R_COMMENT; } - else if (isspace(c)) + else if (my_isspace(system_charset_info,c)) { if (c == '\n') start_lineno= ++*lineno; /* Query hasn't started yet */ @@ -1783,7 +1785,7 @@ int read_query(struct st_query** q_ptr) { expected_errno = 0; p++; - for (;isdigit(*p);p++) + for (;my_isdigit(system_charset_info,*p);p++) expected_errno = expected_errno * 10 + *p - '0'; q->expected_errno[0] = expected_errno; q->expected_errno[1] = 0; @@ -1791,25 +1793,28 @@ int read_query(struct st_query** q_ptr) } } - while (*p && isspace(*p)) p++ ; + while (*p && my_isspace(system_charset_info,*p)) + p++ ; if (*p == '@') { p++; p1 = q->record_file; - while (!isspace(*p) && + while (!my_isspace(system_charset_info,*p) && p1 < q->record_file + sizeof(q->record_file) - 1) *p1++ = *p++; *p1 = 0; } } - while (*p && isspace(*p)) p++; + while (*p && my_isspace(system_charset_info,*p)) + p++; if (!(q->query_buf=q->query=my_strdup(p,MYF(MY_WME)))) die(NullS); /* Calculate first word and first argument */ - for (p=q->query; *p && !isspace(*p) ; p++) ; + for (p=q->query; *p && !my_isspace(system_charset_info,*p) ; p++) ; q->first_word_len = (uint) (p - q->query); - while (*p && isspace(*p)) p++; + while (*p && my_isspace(system_charset_info,*p)) + p++; q->first_argument=p; q->end = strend(q->query); parser.read_lines++; @@ -2322,7 +2327,8 @@ static void var_from_env(const char* name, const char* def_val) static void init_var_hash() { VAR* v; - if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0))) + if (hash_init(&var_hash, system_charset_info, + 1024, 0, 0, get_var_key, var_free, MYF(0))) die("Variable hash initialization failed"); var_from_env("MASTER_MYPORT", "9306"); var_from_env("SLAVE_MYPORT", "9307"); |