Commit 1daed63e authored by root@home.(none)'s avatar root@home.(none)

mysqltest.c, mysqlimport.c, mysqldump.c, mysqlcheck.c, mysql.cc:

  system_charset_info was removed
parent f71a7e4b
......@@ -92,9 +92,9 @@ extern "C" {
#endif
#ifdef FN_NO_CASE_SENCE
#define cmp_database(A,B) my_strcasecmp(system_charset_info, (A), (B))
#define cmp_database(cs,A,B) my_strcasecmp((cs), (A), (B))
#else
#define cmp_database(A,B) strcmp((A),(B))
#define cmp_database(cs,A,B) strcmp((A),(B))
#endif
#if !defined( __WIN__) && !defined( OS2) && !defined(__NETWARE__) && (!defined(HAVE_mit_thread) || !defined(THREAD))
......@@ -133,7 +133,8 @@ static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *default_charset;
*current_prompt=0,
*default_charset= (char*) MYSQL_CHARSET;
static char *histfile;
static String glob_buffer,old_buffer;
static String processed_prompt;
......@@ -160,6 +161,7 @@ static uint prompt_counter;
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include "sslopt-vars.h"
......@@ -788,11 +790,8 @@ static int get_options(int argc, char **argv)
opt_reconnect= 0;
connect_flag= 0; /* Not in interactive mode */
}
if (default_charset)
{
if (!(system_charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
if (!(charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
exit(1);
}
if (argc > 1)
{
usage(0);
......@@ -919,14 +918,14 @@ static COMMANDS *find_command (char *name,char cmd_char)
}
else
{
while (my_isspace(system_charset_info,*name))
while (my_isspace(charset_info,*name))
name++;
if (strchr(name,';') || strstr(name,"\\g"))
return ((COMMANDS *) 0);
if ((end=strcont(name," \t")))
{
len=(uint) (end - name);
while (my_isspace(system_charset_info,*end))
while (my_isspace(charset_info,*end))
end++;
if (!*end)
end=0; // no arguments to function
......@@ -939,7 +938,7 @@ static COMMANDS *find_command (char *name,char cmd_char)
{
if (commands[i].func &&
((name &&
!my_strncasecmp(system_charset_info,name,commands[i].name,len) &&
!my_strncasecmp(charset_info,name,commands[i].name,len) &&
!commands[i].name[len] &&
(!end || (end && commands[i].takes_params))) ||
!name && commands[i].cmd_char == cmd_char))
......@@ -968,13 +967,13 @@ static bool add_line(String &buffer,char *line,char *in_string,
for (pos=out=line ; (inchar= (uchar) *pos) ; pos++)
{
if (my_isspace(system_charset_info,inchar) && out == line &&
if (my_isspace(charset_info,inchar) && out == line &&
buffer.is_empty())
continue;
#ifdef USE_MB
int l;
if (use_mb(system_charset_info) &&
(l = my_ismbchar(system_charset_info, pos, strend))) {
if (use_mb(charset_info) &&
(l = my_ismbchar(charset_info, pos, strend))) {
while (l--)
*out++ = *pos++;
pos--;
......@@ -993,7 +992,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
if ((com=find_command(NullS,(char) inchar)))
{
const String tmp(line,(uint) (out-line), system_charset_info);
const String tmp(line,(uint) (out-line), charset_info);
buffer.append(tmp);
if ((*com->func)(&buffer,pos-1) > 0)
return 1; // Quit
......@@ -1037,7 +1036,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
else if (!*ml_comment && (!*in_string && (inchar == '#' ||
inchar == '-' && pos[1] == '-' &&
my_isspace(system_charset_info,pos[2]))))
my_isspace(charset_info,pos[2]))))
break; // comment to end of line
else if (!*in_string && inchar == '/' && *(pos+1) == '*' && *(pos+2) != '!')
{
......@@ -1593,7 +1592,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
(void) com_print(buffer,0);
if (skip_updates &&
(buffer->length() < 4 || my_strnncoll(system_charset_info,
(buffer->length() < 4 || my_strnncoll(charset_info,
(const uchar*)buffer->ptr(),4,
(const uchar*)"SET ",4)))
{
......@@ -1784,7 +1783,7 @@ print_table_data(MYSQL_RES *result)
print_field_types(result);
mysql_field_seek(result,0);
}
separator.copy("+",1,system_charset_info);
separator.copy("+",1,charset_info);
while ((field = mysql_fetch_field(result)))
{
uint length= column_names ? field->name_length : 0;
......@@ -2001,8 +2000,8 @@ safe_put_field(const char *pos,ulong length)
{
#ifdef USE_MB
int l;
if (use_mb(system_charset_info) &&
(l = my_ismbchar(system_charset_info, pos, end)))
if (use_mb(charset_info) &&
(l = my_ismbchar(charset_info, pos, end)))
{
while (l--)
tee_putc(*pos++, PAGER);
......@@ -2063,7 +2062,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
if (status.batch)
return 0;
while (my_isspace(system_charset_info,*line))
while (my_isspace(charset_info,*line))
line++;
if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default
{
......@@ -2082,12 +2081,12 @@ com_tee(String *buffer, char *line __attribute__((unused)))
}
/* eliminate the spaces before the parameters */
while (my_isspace(system_charset_info,*param))
while (my_isspace(charset_info,*param))
param++;
end= strmake(file_name, param, sizeof(file_name) - 1);
/* remove end space from command line */
while (end > file_name && (my_isspace(system_charset_info,end[-1]) ||
my_iscntrl(system_charset_info,end[-1])))
while (end > file_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
end[0]= 0;
if (end == file_name)
......@@ -2123,7 +2122,7 @@ com_pager(String *buffer, char *line __attribute__((unused)))
if (status.batch)
return 0;
/* Skip space from file name */
while (my_isspace(system_charset_info,*line))
while (my_isspace(charset_info,*line))
line++;
if (!(param= strchr(line, ' '))) // if pager was not given, use the default
{
......@@ -2139,11 +2138,11 @@ com_pager(String *buffer, char *line __attribute__((unused)))
}
else
{
while (my_isspace(system_charset_info,*param))
while (my_isspace(charset_info,*param))
param++;
end=strmake(pager_name, param, sizeof(pager_name)-1);
while (end > pager_name && (my_isspace(system_charset_info,end[-1]) ||
my_iscntrl(system_charset_info,end[-1])))
while (end > pager_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
end[0]=0;
strmov(pager, pager_name);
......@@ -2327,16 +2326,16 @@ static int com_source(String *buffer, char *line)
FILE *sql_file;
/* Skip space from file name */
while (my_isspace(system_charset_info,*line))
while (my_isspace(charset_info,*line))
line++;
if (!(param = strchr(line, ' '))) // Skip command name
return put_info("Usage: \\. <filename> | source <filename>",
INFO_ERROR, 0);
while (my_isspace(system_charset_info,*param))
while (my_isspace(charset_info,*param))
param++;
end=strmake(source_name,param,sizeof(source_name)-1);
while (end > source_name && (my_isspace(system_charset_info,end[-1]) ||
my_iscntrl(system_charset_info,end[-1])))
while (end > source_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
end[0]=0;
unpack_filename(source_name,source_name);
......@@ -2385,7 +2384,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
put_info("USE must be followed by a database name", INFO_ERROR);
return 0;
}
if (!current_db || cmp_database(current_db, tmp))
if (!current_db || cmp_database(charset_info, current_db, tmp))
{
if (one_database)
skip_updates= 1;
......@@ -2448,16 +2447,16 @@ char *get_arg(char *line, my_bool get_next_arg)
else
{
/* skip leading white spaces */
while (my_isspace(system_charset_info, *ptr))
while (my_isspace(charset_info, *ptr))
ptr++;
if (*ptr == '\\') // short command was used
ptr+= 2;
while (*ptr &&!my_isspace(system_charset_info, *ptr)) // skip command
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
ptr++;
}
if (!*ptr)
return NullS;
while (my_isspace(system_charset_info, *ptr))
while (my_isspace(charset_info, *ptr))
ptr++;
if (*ptr == '\'' || *ptr == '\"' || *ptr == '`')
{
......@@ -2485,7 +2484,7 @@ char *get_arg(char *line, my_bool get_next_arg)
}
}
for (ptr-= count; ptr && *ptr; ptr++)
if (!my_isspace(system_charset_info, *ptr))
if (!my_isspace(charset_info, *ptr))
valid_arg= 1;
return valid_arg ? ptr - count : '\0';
}
......@@ -2636,7 +2635,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
tee_fprintf(stdout, "Client characterset:\t%s\n",
system_charset_info->name);
charset_info->name);
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);
#ifndef EMBEDDED_LIBRARY
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
......@@ -2747,7 +2746,7 @@ static void remove_cntrl(String &buffer)
{
char *start,*end;
end=(start=(char*) buffer.ptr())+buffer.length();
while (start < end && !my_isgraph(system_charset_info,end[-1]))
while (start < end && !my_isgraph(charset_info,end[-1]))
end--;
buffer.length((uint) (end-start));
}
......
......@@ -37,14 +37,15 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
tty_password = 0, opt_frm = 0;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0, *default_charset = 0,
*current_host = 0;
static char *opt_password = 0, *current_user = 0,
*default_charset = (char *)MYSQL_CHARSET, *current_host = 0;
static int first_error = 0;
DYNAMIC_ARRAY tables4repair;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0;
static CHARSET_INFO *charset_info= &my_charset_latin1;
enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE};
......@@ -307,11 +308,8 @@ static int get_options(int *argc, char ***argv)
else
what_to_do = DO_CHECK;
}
if (default_charset)
{
if (!(system_charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
if (!(charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
exit(1);
}
if (*argc > 0 && opt_alldbs)
{
printf("You should give only options, no arguments at all, with option\n");
......
......@@ -84,7 +84,8 @@ static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *default_charset, *opt_compatible_mode_str= 0,
*where=0, *default_charset= (char *)MYSQL_CHARSET,
*opt_compatible_mode_str= 0,
*err_ptr= 0;
static ulong opt_compatible_mode= 0;
static uint opt_mysql_port= 0, err_len= 0;
......@@ -98,6 +99,7 @@ FILE *md_result_file;
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol= 0;
static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *compatible_mode_names[]=
{
......@@ -481,11 +483,8 @@ static int get_options(int *argc, char ***argv)
my_progname);
return(1);
}
if (default_charset)
{
if (!(system_charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
if (!(charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
exit(1);
}
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
{
short_usage();
......@@ -592,7 +591,7 @@ static my_bool test_if_special_chars(const char *str)
{
#if MYSQL_VERSION_ID >= 32300
for ( ; *str ; str++)
if (!my_isvar(system_charset_info,*str) && *str != '$')
if (!my_isvar(charset_info,*str) && *str != '$')
return 1;
#endif
return 0;
......@@ -1138,7 +1137,7 @@ static void dumpTable(uint numFields, char *table)
/* change any strings ("inf","nan",..) into NULL */
char *ptr = row[i];
dynstr_append(&extended_row,
(!my_isalpha(system_charset_info,*ptr)) ?
(!my_isalpha(charset_info,*ptr)) ?
ptr : "NULL");
}
}
......@@ -1172,9 +1171,9 @@ static void dumpTable(uint numFields, char *table)
if (opt_xml)
fprintf(md_result_file, "\t\t<field name=\"%s\">%s</field>\n",
field->name,
!my_isalpha(system_charset_info, *ptr) ? ptr: "NULL");
!my_isalpha(charset_info, *ptr) ? ptr: "NULL");
else
fputs((!my_isalpha(system_charset_info,*ptr)) ?
fputs((!my_isalpha(charset_info,*ptr)) ?
ptr : "NULL", md_result_file);
}
}
......@@ -1481,7 +1480,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length,
char buff[255];
*err_pos= 0; /* No error yet */
while (end > x && my_isspace(system_charset_info, end[-1]))
while (end > x && my_isspace(charset_info, end[-1]))
end--;
*err_len= 0;
......
......@@ -43,10 +43,12 @@ static MYSQL mysql_connection;
static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0, *default_charset;
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_CHARSET;
static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static my_string opt_ignore_lines=0;
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include <sslopt-vars.h>
#ifdef HAVE_SMEM
......@@ -237,11 +239,8 @@ static int get_options(int *argc, char ***argv)
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
return(1);
}
if (default_charset)
{
if (!(system_charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
if (!(charset_info= get_charset_by_name(default_charset, MYF(MY_WME))))
exit(1);
}
if (*argc < 2)
{
usage();
......
......@@ -123,6 +123,7 @@ static int block_stack[BLOCK_STACK_DEPTH];
static int block_ok_stack[BLOCK_STACK_DEPTH];
static uint global_expected_errno[MAX_EXPECTED_ERRORS], global_expected_errors;
static CHARSET_INFO *charset_info= &my_charset_latin1;
DYNAMIC_ARRAY q_lines;
typedef struct
......@@ -489,9 +490,9 @@ void init_parser()
int hex_val(int c)
{
if (my_isdigit(system_charset_info,c))
if (my_isdigit(charset_info,c))
return c - '0';
else if ((c = my_tolower(system_charset_info,c)) >= 'a' && c <= 'f')
else if ((c = my_tolower(charset_info,c)) >= 'a' && c <= 'f')
return c - 'a' + 10;
else
return -1;
......@@ -601,7 +602,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 (my_isvar(system_charset_info,*var_name) && var_name != end)
while (my_isvar(charset_info,*var_name) && var_name != end)
++var_name;
if (var_name == save_var_name)
{
......@@ -752,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 && !my_isspace(system_charset_info,*p))
while (*p && !my_isspace(charset_info,*p))
{
*com_p++=*p++;
}
......@@ -785,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 && !my_isspace(system_charset_info,*p))
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
ver_arg_len = p - ver_arg;
......@@ -815,7 +816,7 @@ int do_source(struct st_query* q)
if (!*p)
die("Missing file name in source\n");
name = p;
while (*p && !my_isspace(system_charset_info,*p))
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
......@@ -1055,11 +1056,11 @@ int do_let(struct st_query* q)
if (!*p)
die("Missing variable name in let\n");
var_name = p;
while (*p && (*p != '=' || my_isspace(system_charset_info,*p)))
while (*p && (*p != '=' || my_isspace(charset_info,*p)))
p++;
var_name_end = p;
if (*p == '=') p++;
while (*p && my_isspace(system_charset_info,*p))
while (*p && my_isspace(charset_info,*p))
p++;
var_val_start = p;
return var_set(var_name, var_name_end, var_val_start, q->end);
......@@ -1089,7 +1090,7 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
int do_sleep(struct st_query* q, my_bool real_sleep)
{
char *p=q->first_argument;
while (*p && my_isspace(system_charset_info,*p))
while (*p && my_isspace(charset_info,*p))
p++;
if (!*p)
die("Missing argument in sleep\n");
......@@ -1105,7 +1106,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 && my_isspace(system_charset_info,p[-1]))
while (p > filename && my_isspace(charset_info,p[-1]))
p--;
p[0]=0;
}
......@@ -1191,7 +1192,7 @@ static char *get_string(char **to_ptr, char **from_ptr,
if (*from != ' ' && *from)
die("Wrong string argument in %s\n", q->query);
while (my_isspace(system_charset_info,*from)) /* Point to next string */
while (my_isspace(charset_info,*from)) /* Point to next string */
from++;
*to =0; /* End of string marker */
......@@ -1248,7 +1249,7 @@ 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 (my_isspace(system_charset_info,i))
if (my_isspace(charset_info,i))
*pos++= i;
*pos=0; /* End pointer */
if (!(glob_replace=init_replace((char**) from_array.typelib.type_names,
......@@ -1285,7 +1286,7 @@ int select_connection(char *p)
if (!*p)
die("Missing connection name in connect\n");
name = p;
while (*p && !my_isspace(system_charset_info,*p))
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
......@@ -1311,7 +1312,7 @@ int close_connection(struct st_query* q)
if (!*p)
die("Missing connection name in connect\n");
name = p;
while (*p && !my_isspace(system_charset_info,*p))
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
......@@ -1348,12 +1349,12 @@ 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 && my_isspace(system_charset_info,*str))
while (*str && my_isspace(charset_info,*str))
str++;
*arg = str;
for (; *str && *str != ',' && *str != ')' ; str++)
{
if (my_isspace(system_charset_info,*str))
if (my_isspace(charset_info,*str))
*str = 0;
}
if (!*str)
......@@ -1636,7 +1637,7 @@ int read_line(char* buf, int size)
{
state = R_COMMENT;
}
else if (my_isspace(system_charset_info,c))
else if (my_isspace(charset_info,c))
{
if (c == '\n')
start_lineno= ++*lineno; /* Query hasn't started yet */
......@@ -1762,7 +1763,7 @@ int read_query(struct st_query** q_ptr)
{
expected_errno = 0;
p++;
for (;my_isdigit(system_charset_info,*p);p++)
for (;my_isdigit(charset_info,*p);p++)
expected_errno = expected_errno * 10 + *p - '0';
q->expected_errno[0] = expected_errno;
q->expected_errno[1] = 0;
......@@ -1770,27 +1771,27 @@ int read_query(struct st_query** q_ptr)
}
}
while (*p && my_isspace(system_charset_info,*p))
while (*p && my_isspace(charset_info,*p))
p++ ;
if (*p == '@')
{
p++;
p1 = q->record_file;
while (!my_isspace(system_charset_info,*p) &&
while (!my_isspace(charset_info,*p) &&
p1 < q->record_file + sizeof(q->record_file) - 1)
*p1++ = *p++;
*p1 = 0;
}
}
while (*p && my_isspace(system_charset_info,*p))
while (*p && my_isspace(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 && !my_isspace(system_charset_info,*p) ; p++) ;
for (p=q->query; *p && !my_isspace(charset_info,*p) ; p++) ;
q->first_word_len = (uint) (p - q->query);
while (*p && my_isspace(system_charset_info,*p))
while (*p && my_isspace(charset_info,*p))
p++;
q->first_argument=p;
q->end = strend(q->query);
......@@ -2346,7 +2347,7 @@ static void init_var_hash()
{
VAR* v;
DBUG_ENTER("init_var_hash");
if (hash_init(&var_hash, system_charset_info,
if (hash_init(&var_hash, charset_info,
1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment