diff options
102 files changed, 959 insertions, 1603 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index b7d66071ca5..0d61ed4ec88 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -112,7 +112,7 @@ extern "C" { #define PROMPT_CHAR '\\' #define DEFAULT_DELIMITER ";" -#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L) +#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L * 1024L) typedef struct st_status { @@ -1974,7 +1974,7 @@ static COMMANDS *find_command(char *name,char cmd_char) (uchar*)commands[i].name,len) && !commands[i].name[len] && (!end || (end && commands[i].takes_params))) || - !name && commands[i].cmd_char == cmd_char)) + (!name && commands[i].cmd_char == cmd_char))) { DBUG_PRINT("exit",("found command: %s", commands[i].name)); DBUG_RETURN(&commands[i]); @@ -2132,7 +2132,7 @@ static bool add_line(String &buffer,char *line,char *in_string, buffer.length(0); } else if (!*ml_comment && (!*in_string && (inchar == '#' || - inchar == '-' && pos[1] == '-' && + (inchar == '-' && pos[1] == '-' && /* The third byte is either whitespace or is the end of the line -- which would occur only @@ -2140,7 +2140,7 @@ static bool add_line(String &buffer,char *line,char *in_string, itself whitespace and should also match. */ (my_isspace(charset_info,pos[2]) || - !pos[2])))) + !pos[2]))))) { // Flush previously accepted characters if (out != line) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 36b86ae7a96..ab78bbea944 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -527,8 +527,8 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, Format events are not concerned by --offset and such, we always need to read them to be able to process the wanted events. */ - if ((rec_count >= offset) && - ((my_time_t)(ev->when) >= start_datetime) || + if (((rec_count >= offset) && + ((my_time_t)(ev->when) >= start_datetime)) || (ev_type == FORMAT_DESCRIPTION_EVENT)) { if (ev_type != FORMAT_DESCRIPTION_EVENT) diff --git a/client/mysqltest.c b/client/mysqltest.c index f81968ee5a2..24d021b7239 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1682,7 +1682,7 @@ void check_result(DYNAMIC_STRING* ds) dynstr_set(ds, NULL); /* Don't create a .log file */ show_diff(NULL, result_file_name, reject_file); - die(mess); + die("%s", mess); break; } default: /* impossible */ diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c index fc7bebfd813..aa5bd3d829a 100644 --- a/cmd-line-utils/readline/bind.c +++ b/cmd-line-utils/readline/bind.c @@ -79,7 +79,7 @@ static int _rl_read_init_file PARAMS((const char *, int)); static int glean_key_from_name PARAMS((char *)); static int find_boolean_var PARAMS((const char *)); -static char *_rl_get_string_variable_value PARAMS((const char *)); +static const char *_rl_get_string_variable_value PARAMS((const char *)); static int substring_member_of_array PARAMS((char *, const char **)); static int currently_reading_init_file; @@ -442,7 +442,7 @@ rl_translate_keyseq (seq, array, len) { register int i, c, l, temp; - for (i = l = 0; c = seq[i]; i++) + for (i = l = 0; (c = seq[i]); i++) { if (c == '\\') { @@ -776,7 +776,8 @@ _rl_read_file (filename, sizep) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ - if (file_size != finfo.st_size || file_size + 1 < file_size) +if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + file_size + 1 < file_size) { if (file >= 0) close (file); @@ -807,7 +808,7 @@ _rl_read_file (filename, sizep) /* Re-read the current keybindings file. */ int rl_re_read_init_file (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { int r; r = rl_read_init_file ((const char *)NULL); @@ -1031,7 +1032,7 @@ parser_if (args) /* Invert the current parser state if there is anything on the stack. */ static int parser_else (args) - char *args; + char *args __attribute__((unused)); { register int i; @@ -1062,7 +1063,7 @@ parser_else (args) _rl_parsing_conditionalized_out from the stack. */ static int parser_endif (args) - char *args; + char *args __attribute__((unused)); { if (if_stack_depth) _rl_parsing_conditionalized_out = if_stack[--if_stack_depth]; @@ -1185,7 +1186,7 @@ rl_parse_and_bind (string) { int passc = 0; - for (i = 1; c = string[i]; i++) + for (i = 1; (c = string[i]); i++) { if (passc) { @@ -1276,7 +1277,7 @@ rl_parse_and_bind (string) int delimiter, passc; delimiter = string[i++]; - for (passc = 0; c = string[i]; i++) + for (passc = 0; (c = string[i]); i++) { if (passc) { @@ -1436,7 +1437,7 @@ static struct { #if defined (VISIBLE_STATS) { "visible-stats", &rl_visible_stats, 0 }, #endif /* VISIBLE_STATS */ - { (char *)NULL, (int *)NULL } + { (char *)NULL, (int *)NULL, 0 } }; static int @@ -1505,7 +1506,7 @@ static struct { { "editing-mode", V_STRING, sv_editmode }, { "isearch-terminators", V_STRING, sv_isrchterm }, { "keymap", V_STRING, sv_keymap }, - { (char *)NULL, 0 } + { (char *)NULL, 0, (_rl_sv_func_t*)NULL } }; static int @@ -1532,7 +1533,7 @@ bool_to_int (value) (value[0] == '1' && value[1] == '\0')); } -char * +const char * rl_variable_value (name) const char *name; { @@ -1799,7 +1800,7 @@ rl_set_keymap_from_edit_mode () #endif /* VI_MODE */ } -char * +const char * rl_get_keymap_name_from_edit_mode () { if (rl_editing_mode == emacs_mode) @@ -2048,7 +2049,7 @@ rl_function_dumper (print_readably) fprintf (rl_outstream, "\n"); - for (i = 0; name = names[i]; i++) + for (i = 0; (name = names[i]); i++) { rl_command_func_t *function; char **invokers; @@ -2108,7 +2109,7 @@ rl_function_dumper (print_readably) the output in such a way that it can be read back in. */ int rl_dump_functions (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (rl_dispatching) fprintf (rl_outstream, "\r\n"); @@ -2188,7 +2189,7 @@ rl_macro_dumper (print_readably) int rl_dump_macros (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (rl_dispatching) fprintf (rl_outstream, "\r\n"); @@ -2197,12 +2198,13 @@ rl_dump_macros (count, key) return (0); } -static char * +static const char * _rl_get_string_variable_value (name) const char *name; { static char numbuf[32]; - char *ret; + const char *ret; + char *tmp; if (_rl_stricmp (name, "bell-style") == 0) { @@ -2230,11 +2232,11 @@ _rl_get_string_variable_value (name) { if (_rl_isearch_terminators == 0) return 0; - ret = _rl_untranslate_macro_value (_rl_isearch_terminators); - if (ret) + tmp = _rl_untranslate_macro_value (_rl_isearch_terminators); + if (tmp) { - strncpy (numbuf, ret, sizeof (numbuf) - 1); - free (ret); + strncpy (numbuf, tmp, sizeof (numbuf) - 1); + free (tmp); numbuf[sizeof(numbuf) - 1] = '\0'; } else @@ -2257,7 +2259,7 @@ rl_variable_dumper (print_readably) int print_readably; { int i; - char *v; + const char *v; for (i = 0; boolean_varlist[i].name; i++) { @@ -2286,7 +2288,7 @@ rl_variable_dumper (print_readably) the output in such a way that it can be read back in. */ int rl_dump_variables (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (rl_dispatching) fprintf (rl_outstream, "\r\n"); diff --git a/cmd-line-utils/readline/complete.c b/cmd-line-utils/readline/complete.c index d0c9e772f0f..97423507d5b 100644 --- a/cmd-line-utils/readline/complete.c +++ b/cmd-line-utils/readline/complete.c @@ -358,14 +358,14 @@ rl_complete (ignore, invoking_key) /* List the possible completions. See description of rl_complete (). */ int rl_possible_completions (ignore, invoking_key) - int ignore, invoking_key; + int ignore __attribute__((unused)), invoking_key __attribute__((unused)); { return (rl_complete_internal ('?')); } int rl_insert_completions (ignore, invoking_key) - int ignore, invoking_key; + int ignore __attribute__((unused)), invoking_key __attribute__((unused)); { return (rl_complete_internal ('*')); } @@ -695,7 +695,8 @@ print_filename (to_print, full_pathname) char *to_print, *full_pathname; { int printed_len, extension_char, slen, tlen; - char *s, c, *new_full_pathname, *dn; + char *s, c, *new_full_pathname; + const char *dn; extension_char = 0; printed_len = fnprint (to_print); @@ -782,7 +783,7 @@ print_filename (to_print, full_pathname) static char * rl_quote_filename (s, rtype, qcp) char *s; - int rtype; + int rtype __attribute__((unused)); char *qcp; { char *r; @@ -883,7 +884,7 @@ _rl_find_completion_word (fp, dp) /* We didn't find an unclosed quoted substring upon which to do completion, so use the word break characters to find the substring on which to complete. */ - while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)) + while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))) { scan = rl_line_buffer[rl_point]; @@ -1802,7 +1803,7 @@ rl_completion_matches (text, entry_function) match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); match_list[1] = (char *)NULL; - while (string = (*entry_function) (text, matches)) + while ((string = (*entry_function) (text, matches))) { if (matches + 1 == match_list_size) match_list = (char **)xrealloc @@ -2110,7 +2111,7 @@ rl_filename_completion_function (text, state) ring the bell, and reset the counter to zero. */ int rl_menu_complete (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { rl_compentry_func_t *our_func; int matching_filenames, found_quote; diff --git a/cmd-line-utils/readline/display.c b/cmd-line-utils/readline/display.c index 842a586b76b..fa5b67a8e69 100644 --- a/cmd-line-utils/readline/display.c +++ b/cmd-line-utils/readline/display.c @@ -127,7 +127,7 @@ int _rl_want_redisplay = 0; /* The stuff that gets printed out before the actual text of the line. This is usually pointing to rl_prompt. */ -char *rl_display_prompt = (char *)NULL; +const char *rl_display_prompt = (const char *)NULL; /* Pseudo-global variables declared here. */ @@ -229,7 +229,10 @@ expand_prompt (pmt, lp, lip, niflp, vlp) int *lp, *lip, *niflp, *vlp; { char *r, *ret, *p, *igstart; - int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars; + int l, rl, last, ignoring, ninvis, invfl, invflset, physchars; +#if defined (HANDLE_MULTIBYTE) + int ind, pind; +#endif /* Short-circuit if we can. */ if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0) @@ -242,7 +245,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp) if (niflp) *niflp = 0; if (vlp) - *vlp = lp ? *lp : strlen (r); + *vlp = lp ? *lp : (int)strlen (r); return r; } @@ -459,9 +462,10 @@ rl_redisplay () register int in, out, c, linenum, cursor_linenum; register char *line; int inv_botlin, lb_botlin, lb_linenum, o_cpos; - int newlines, lpos, temp, modmark, n0, num; - char *prompt_this_line; + int newlines, lpos, temp, modmark; + const char *prompt_this_line; #if defined (HANDLE_MULTIBYTE) + int num, n0; wchar_t wc; size_t wc_bytes; int wc_width; @@ -626,7 +630,6 @@ rl_redisplay () contents of the command line? */ while (lpos >= _rl_screenwidth) { - int z; /* fix from Darin Johnson <darin@acuson.com> for prompt string with invisible characters that is longer than the screen width. The prompt_invis_chars_first_line variable could be made into an array @@ -635,6 +638,7 @@ rl_redisplay () prompts that exceed two physical lines? Additional logic fix from Edward Catmur <ed@catmur.co.uk> */ #if defined (HANDLE_MULTIBYTE) + int z; if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { n0 = num; @@ -878,6 +882,7 @@ rl_redisplay () if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { int nleft, pos, changed_screen_line, tx; + char empty_str[1] = { 0 }; if (!rl_display_fixed || forced_display) { @@ -902,7 +907,7 @@ rl_redisplay () #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) #define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) #define VIS_CHARS(line) (visible_line + vis_lbreaks[line]) -#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line) +#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? empty_str : VIS_CHARS(line) #define INV_LINE(line) (invisible_line + inv_lbreaks[line]) /* For each line in the buffer, do the updating display. */ @@ -969,7 +974,7 @@ rl_redisplay () _rl_move_vert (linenum); _rl_move_cursor_relative (0, tt); _rl_clear_to_eol - ((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth); + ((linenum == _rl_vis_botlin) ? (int)strlen (tt) : _rl_screenwidth); } } _rl_vis_botlin = inv_botlin; @@ -2261,7 +2266,7 @@ static void redraw_prompt (t) char *t; { - char *oldp; + const char *oldp; oldp = rl_display_prompt; rl_save_prompt (); diff --git a/cmd-line-utils/readline/histexpand.c b/cmd-line-utils/readline/histexpand.c index 45377fc3b5e..ab8d8ecc866 100644 --- a/cmd-line-utils/readline/histexpand.c +++ b/cmd-line-utils/readline/histexpand.c @@ -87,14 +87,14 @@ char history_comment_char = '\0'; /* The list of characters which inhibit the expansion of text if found immediately following history_expansion_char. */ -char *history_no_expand_chars = " \t\n\r="; +const char *history_no_expand_chars = " \t\n\r="; /* If set to a non-zero value, single quotes inhibit history expansion. The default is 0. */ int history_quotes_inhibit_expansion = 0; /* Used to split words by history_tokenize_internal. */ -char *history_word_delimiters = HISTORY_WORD_DELIMITERS; +const char *history_word_delimiters = HISTORY_WORD_DELIMITERS; /* If set, this points to a function that is called to verify that a particular history expansion should be performed. */ @@ -203,7 +203,7 @@ get_history_event (string, caller_index, delimiting_quote) } /* Only a closing `?' or a newline delimit a substring search string. */ - for (local_index = i; c = string[i]; i++) + for (local_index = i; (c = string[i]); i++) { #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index d98293d933c..118c5ebd328 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -186,7 +186,8 @@ read_history_range (filename, from, to) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ - if (file_size != finfo.st_size || file_size + 1 < file_size) +if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + file_size + 1 < file_size) { errno = overflow_errno; goto error_and_exit; @@ -339,7 +340,8 @@ history_truncate_file (fname, lines) file_size = (size_t)finfo.st_size; /* check for overflow on very large files */ - if (file_size != finfo.st_size || file_size + 1 < file_size) +if ((sizeof(off_t) > sizeof(size_t) && finfo.st_size > (off_t)(size_t)~0) || + file_size + 1 < file_size) { close (file); #if defined (EFBIG) diff --git a/cmd-line-utils/readline/history.h b/cmd-line-utils/readline/history.h index 14ca2a996c7..5790ed1c71d 100644 --- a/cmd-line-utils/readline/history.h +++ b/cmd-line-utils/readline/history.h @@ -243,9 +243,9 @@ extern int history_length; extern int history_max_entries; extern char history_expansion_char; extern char history_subst_char; -extern char *history_word_delimiters; +extern const char *history_word_delimiters; extern char history_comment_char; -extern char *history_no_expand_chars; +extern const char *history_no_expand_chars; extern char *history_search_delimiter_chars; extern int history_quotes_inhibit_expansion; diff --git a/cmd-line-utils/readline/input.c b/cmd-line-utils/readline/input.c index 62c0443d890..84c0422059a 100644 --- a/cmd-line-utils/readline/input.c +++ b/cmd-line-utils/readline/input.c @@ -420,7 +420,7 @@ rl_read_key () else { /* If input is coming from a macro, then use that. */ - if (c = _rl_next_macro_key ()) + if ((c = _rl_next_macro_key ())) return (c); /* If the user has an event function, then call it periodically. */ diff --git a/cmd-line-utils/readline/isearch.c b/cmd-line-utils/readline/isearch.c index 8060adb97cd..305c847d8da 100644 --- a/cmd-line-utils/readline/isearch.c +++ b/cmd-line-utils/readline/isearch.c @@ -75,7 +75,7 @@ static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int)); static char *last_isearch_string; static int last_isearch_string_len; -static char *default_isearch_terminators = "\033\012"; +static const char *default_isearch_terminators = "\033\012"; _rl_search_cxt * _rl_scxt_alloc (type, flags) @@ -119,7 +119,7 @@ _rl_scxt_alloc (type, flags) void _rl_scxt_dispose (cxt, flags) _rl_search_cxt *cxt; - int flags; + int flags __attribute__((unused)); { FREE (cxt->search_string); FREE (cxt->allocated_line); @@ -154,7 +154,7 @@ rl_forward_search_history (sign, key) static void rl_display_search (search_string, reverse_p, where) char *search_string; - int reverse_p, where; + int reverse_p, where __attribute__((unused)); { char *message; int msglen, searchlen; @@ -614,7 +614,7 @@ _rl_isearch_cleanup (cxt, r) backwards. */ static int rl_search_history (direction, invoking_key) - int direction, invoking_key; + int direction, invoking_key __attribute__((unused)); { _rl_search_cxt *cxt; /* local for now, but saved globally */ int c, r; diff --git a/cmd-line-utils/readline/kill.c b/cmd-line-utils/readline/kill.c index 42c53948689..adae2e1cd07 100644 --- a/cmd-line-utils/readline/kill.c +++ b/cmd-line-utils/readline/kill.c @@ -79,7 +79,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int)); of kill material. */ int rl_set_retained_kills (num) - int num; + int num __attribute__((unused)); { return 0; } @@ -296,7 +296,7 @@ rl_backward_kill_line (direction, ignore) /* Kill the whole line, no matter where point is. */ int rl_kill_full_line (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { rl_begin_undo_group (); rl_point = 0; @@ -314,7 +314,7 @@ rl_kill_full_line (count, ignore) using behaviour that they expect. */ int rl_unix_word_rubout (count, key) - int count, key; + int count, key __attribute__((unused)); { int orig_point; @@ -347,7 +347,7 @@ rl_unix_word_rubout (count, key) deletes backward to directory separator (`/') or whitespace. */ int rl_unix_filename_rubout (count, key) - int count, key; + int count, key __attribute__((unused)); { int orig_point, c; @@ -391,7 +391,7 @@ rl_unix_filename_rubout (count, key) doing. */ int rl_unix_line_discard (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (rl_point == 0) rl_ding (); @@ -428,7 +428,7 @@ region_kill_internal (delete) /* Copy the text in the region to the kill ring. */ int rl_copy_region_to_kill (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { return (region_kill_internal (0)); } @@ -436,7 +436,7 @@ rl_copy_region_to_kill (count, ignore) /* Kill the text between the point and mark. */ int rl_kill_region (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { int r, npoint; @@ -501,7 +501,7 @@ rl_copy_backward_word (count, key) /* Yank back the last killed text. This ignores arguments. */ int rl_yank (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { if (rl_kill_ring == 0) { @@ -520,7 +520,7 @@ rl_yank (count, ignore) yank back some other text. */ int rl_yank_pop (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { int l, n; diff --git a/cmd-line-utils/readline/macro.c b/cmd-line-utils/readline/macro.c index 3473f705335..0ee7b3077c3 100644 --- a/cmd-line-utils/readline/macro.c +++ b/cmd-line-utils/readline/macro.c @@ -201,7 +201,7 @@ _rl_kill_kbd_macro () re-executing the existing macro. */ int rl_start_kbd_macro (ignore1, ignore2) - int ignore1, ignore2; + int ignore1 __attribute__((unused)), ignore2 __attribute__((unused)); { if (RL_ISSTATE (RL_STATE_MACRODEF)) { @@ -226,7 +226,7 @@ rl_start_kbd_macro (ignore1, ignore2) that many times, counting the definition as the first time. */ int rl_end_kbd_macro (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { if (RL_ISSTATE (RL_STATE_MACRODEF) == 0) { @@ -246,7 +246,7 @@ rl_end_kbd_macro (count, ignore) COUNT says how many times to execute it. */ int rl_call_last_kbd_macro (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { if (current_macro == 0) _rl_abort_internal (); diff --git a/cmd-line-utils/readline/mbutil.c b/cmd-line-utils/readline/mbutil.c index e21708fb748..b571afa18bb 100644 --- a/cmd-line-utils/readline/mbutil.c +++ b/cmd-line-utils/readline/mbutil.c @@ -346,8 +346,8 @@ _rl_char_value (buf, ind) #undef _rl_find_next_mbchar int _rl_find_next_mbchar (string, seed, count, flags) - char *string; - int seed, count, flags; + char *string __attribute__((unused)); + int seed, count, flags __attribute__((unused)); { #if defined (HANDLE_MULTIBYTE) return _rl_find_next_mbchar_internal (string, seed, count, flags); @@ -362,8 +362,8 @@ _rl_find_next_mbchar (string, seed, count, flags) #undef _rl_find_prev_mbchar int _rl_find_prev_mbchar (string, seed, flags) - char *string; - int seed, flags; + char *string __attribute__((unused)); + int seed, flags __attribute__((unused)); { #if defined (HANDLE_MULTIBYTE) return _rl_find_prev_mbchar_internal (string, seed, flags); diff --git a/cmd-line-utils/readline/misc.c b/cmd-line-utils/readline/misc.c index e0e6893c60e..f5f0370fb6a 100644 --- a/cmd-line-utils/readline/misc.c +++ b/cmd-line-utils/readline/misc.c @@ -228,7 +228,7 @@ _rl_reset_argument () /* Start a numeric argument with initial value KEY */ int rl_digit_argument (ignore, key) - int ignore, key; + int ignore __attribute__((unused)), key; { _rl_arg_init (); if (RL_ISSTATE (RL_STATE_CALLBACK)) @@ -249,7 +249,7 @@ rl_digit_argument (ignore, key) dispatch on it. If the key is the abort character then abort. */ int rl_universal_argument (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { _rl_arg_init (); rl_numeric_arg *= 4; @@ -413,7 +413,7 @@ _rl_history_set_point () void rl_replace_from_history (entry, flags) HIST_ENTRY *entry; - int flags; /* currently unused */ + int flags __attribute__((unused)); /* currently unused */ { /* Can't call with `1' because rl_undo_list might point to an undo list from a history entry, just like we're setting up here. */ @@ -440,7 +440,7 @@ rl_replace_from_history (entry, flags) /* Meta-< goes to the start of the history. */ int rl_beginning_of_history (count, key) - int count, key; + int count __attribute__((unused)), key; { return (rl_get_previous_history (1 + where_history (), key)); } @@ -448,7 +448,7 @@ rl_beginning_of_history (count, key) /* Meta-> goes to the end of the history. (The current line). */ int rl_end_of_history (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { rl_maybe_replace_line (); using_history (); @@ -553,7 +553,7 @@ rl_get_previous_history (count, key) /* How to toggle back and forth between editing modes. */ int rl_vi_editing_mode (count, key) - int count, key; + int count __attribute__((unused)), key; { #if defined (VI_MODE) _rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */ @@ -566,7 +566,7 @@ rl_vi_editing_mode (count, key) int rl_emacs_editing_mode (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { rl_editing_mode = emacs_mode; _rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */ @@ -577,7 +577,7 @@ rl_emacs_editing_mode (count, key) /* Function for the rest of the library to use to set insert/overwrite mode. */ void _rl_set_insert_mode (im, force) - int im, force; + int im, force __attribute__((unused)); { #ifdef CURSOR_MODE _rl_set_cursor (im, force); @@ -590,7 +590,7 @@ _rl_set_insert_mode (im, force) mode. A negative or zero explicit argument selects insert mode. */ int rl_overwrite_mode (count, key) - int count, key; + int count, key __attribute__((unused)); { if (rl_explicit_arg == 0) _rl_set_insert_mode (rl_insert_mode ^ 1, 0); diff --git a/cmd-line-utils/readline/nls.c b/cmd-line-utils/readline/nls.c index 6ec685ed9ea..ff40b14228c 100644 --- a/cmd-line-utils/readline/nls.c +++ b/cmd-line-utils/readline/nls.c @@ -101,7 +101,8 @@ _rl_init_eightbit () /* If we have setlocale(3), just check the current LC_CTYPE category value, and go into eight-bit mode if it's not C or POSIX. */ #if defined (HAVE_SETLOCALE) - char *lspec, *t; + const char *lspec; + char *t; /* Set the LC_CTYPE locale category from environment variables. */ lspec = _rl_get_locale_var ("LC_CTYPE"); @@ -127,7 +128,8 @@ _rl_init_eightbit () return (0); #else /* !HAVE_SETLOCALE */ - char *lspec, *t; + const char *lspec; + char *t; int i; /* We don't have setlocale. Finesse it. Check the environment for the diff --git a/cmd-line-utils/readline/readline.c b/cmd-line-utils/readline/readline.c index 8c3cad52d36..fb92becdbf9 100644 --- a/cmd-line-utils/readline/readline.c +++ b/cmd-line-utils/readline/readline.c @@ -90,7 +90,7 @@ static void bind_arrow_keys_internal PARAMS((Keymap)); static void bind_arrow_keys PARAMS((void)); static void readline_default_bindings PARAMS((void)); -static void reset_default_bindings PARAMS((void)); +static void reset_default_bindings PARAMS((void)) __attribute__((unused)); static int _rl_subseq_result PARAMS((int, Keymap, int, int)); static int _rl_subseq_getchar PARAMS((int)); diff --git a/cmd-line-utils/readline/readline.h b/cmd-line-utils/readline/readline.h index b71bf98d204..668a452c765 100644 --- a/cmd-line-utils/readline/readline.h +++ b/cmd-line-utils/readline/readline.h @@ -304,7 +304,7 @@ extern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *)) extern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap)); extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap)); -extern char *rl_variable_value PARAMS((const char *)); +extern const char *rl_variable_value PARAMS((const char *)); extern int rl_variable_bind PARAMS((const char *, const char *)); /* Backwards compatibility, use rl_bind_keyseq_in_map instead. */ @@ -343,7 +343,7 @@ extern void rl_set_keymap PARAMS((Keymap)); extern Keymap rl_get_keymap PARAMS((void)); /* Undocumented; used internally only. */ extern void rl_set_keymap_from_edit_mode PARAMS((void)); -extern char *rl_get_keymap_name_from_edit_mode PARAMS((void)); +extern const char *rl_get_keymap_name_from_edit_mode PARAMS((void)); /* Functions for manipulating the funmap, which maps command names to functions. */ extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *)); @@ -406,7 +406,7 @@ extern void rl_set_screen_size PARAMS((int, int)); extern void rl_get_screen_size PARAMS((int *, int *)); extern void rl_reset_screen_size PARAMS((void)); -extern char *rl_get_termcap PARAMS((const char *)); +extern const char *rl_get_termcap PARAMS((const char *)); /* Functions for character input. */ extern int rl_stuff_char PARAMS((int)); diff --git a/cmd-line-utils/readline/rlprivate.h b/cmd-line-utils/readline/rlprivate.h index 64aa7bdd3fa..1ab696766b0 100644 --- a/cmd-line-utils/readline/rlprivate.h +++ b/cmd-line-utils/readline/rlprivate.h @@ -77,7 +77,7 @@ typedef struct __rl_search_context int sline_len; int sline_index; - char *search_terminators; + const char *search_terminators; } _rl_search_cxt; /* Callback data for reading numeric arguments */ @@ -164,7 +164,7 @@ extern int rl_set_retained_kills PARAMS((int)); extern void _rl_set_screen_size PARAMS((int, int)); /* undo.c */ -extern int _rl_fix_last_undo_of_type PARAMS((int, int, int)); +extern int _rl_fix_last_undo_of_type PARAMS((enum undo_code, int, int)); /* util.c */ extern char *_rl_savestring PARAMS((const char *)); @@ -359,7 +359,7 @@ extern int _rl_vis_botlin; extern int _rl_last_c_pos; extern int _rl_suppress_redisplay; extern int _rl_want_redisplay; -extern char *rl_display_prompt; +extern const char *rl_display_prompt; /* isearch.c */ extern char *_rl_isearch_terminators; @@ -398,17 +398,17 @@ extern _rl_search_cxt *_rl_nscxt; /* terminal.c */ extern int _rl_enable_keypad; extern int _rl_enable_meta; -extern char *_rl_term_clreol; -extern char *_rl_term_clrpag; -extern char *_rl_term_im; -extern char *_rl_term_ic; -extern char *_rl_term_ei; -extern char *_rl_term_DC; -extern char *_rl_term_up; -extern char *_rl_term_dc; -extern char *_rl_term_cr; -extern char *_rl_term_IC; -extern char *_rl_term_forward_char; +extern const char *_rl_term_clreol; +extern const char *_rl_term_clrpag; +extern const char *_rl_term_im; +extern const char *_rl_term_ic; +extern const char *_rl_term_ei; +extern const char *_rl_term_DC; +extern const char *_rl_term_up; +extern const char *_rl_term_dc; +extern const char *_rl_term_cr; +extern const char *_rl_term_IC; +extern const char *_rl_term_forward_char; extern int _rl_screenheight; extern int _rl_screenwidth; extern int _rl_screenchars; diff --git a/cmd-line-utils/readline/rltty.c b/cmd-line-utils/readline/rltty.c index b5bc5d367a5..08e3ef945ef 100644 --- a/cmd-line-utils/readline/rltty.c +++ b/cmd-line-utils/readline/rltty.c @@ -765,7 +765,7 @@ rl_deprep_terminal () int rl_restart_output (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { #if defined (__MINGW32__) return 0; @@ -803,7 +803,7 @@ rl_restart_output (count, key) int rl_stop_output (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { #if defined (__MINGW32__) return 0; diff --git a/cmd-line-utils/readline/search.c b/cmd-line-utils/readline/search.c index cfa5db1dc17..1da450a692a 100644 --- a/cmd-line-utils/readline/search.c +++ b/cmd-line-utils/readline/search.c @@ -211,7 +211,7 @@ _rl_nsearch_init (dir, pchar) rl_end = rl_point = 0; p = _rl_make_prompt_for_search (pchar ? pchar : ':'); - rl_message ("%s", p, 0); + rl_message ("%s", p); free (p); RL_SETSTATE(RL_STATE_NSEARCH); @@ -383,7 +383,7 @@ noninc_search (dir, pchar) code calls this, KEY will be `?'. */ int rl_noninc_forward_search (count, key) - int count, key; + int count __attribute__((unused)), key; { return noninc_search (1, (key == '?') ? '?' : 0); } @@ -392,7 +392,7 @@ rl_noninc_forward_search (count, key) calls this, KEY will be `/'. */ int rl_noninc_reverse_search (count, key) - int count, key; + int count __attribute__((unused)), key; { return noninc_search (-1, (key == '/') ? '/' : 0); } @@ -401,7 +401,7 @@ rl_noninc_reverse_search (count, key) for. If there is no saved search string, abort. */ int rl_noninc_forward_search_again (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { int r; @@ -418,7 +418,7 @@ rl_noninc_forward_search_again (count, key) for. If there is no saved search string, abort. */ int rl_noninc_reverse_search_again (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { int r; diff --git a/cmd-line-utils/readline/terminal.c b/cmd-line-utils/readline/terminal.c index a630bc02e05..3f92821f9dd 100644 --- a/cmd-line-utils/readline/terminal.c +++ b/cmd-line-utils/readline/terminal.c @@ -104,34 +104,36 @@ char PC, *BC, *UP; #endif /* __linux__ */ /* Some strings to control terminal actions. These are output by tputs (). */ -char *_rl_term_clreol; -char *_rl_term_clrpag; -char *_rl_term_cr; -char *_rl_term_backspace; -char *_rl_term_goto; -char *_rl_term_pc; +const char *_rl_term_clreol; +const char *_rl_term_clrpag; +const char *_rl_term_cr; +const char *_rl_term_backspace; +char _rl_term_backspace_default[2] = { '\b', 0 }; +const char *_rl_term_goto; +const char *_rl_term_pc; /* Non-zero if we determine that the terminal can do character insertion. */ int _rl_terminal_can_insert = 0; /* How to insert characters. */ -char *_rl_term_im; -char *_rl_term_ei; -char *_rl_term_ic; -char *_rl_term_ip; -char *_rl_term_IC; +const char *_rl_term_im; +const char *_rl_term_ei; +const char *_rl_term_ic; +const char *_rl_term_ip; +const char *_rl_term_IC; /* How to delete characters. */ -char *_rl_term_dc; -char *_rl_term_DC; +const char *_rl_term_dc; +const char *_rl_term_DC; -char *_rl_term_forward_char; +const char *_rl_term_forward_char; /* How to go up a line. */ -char *_rl_term_up; +const char *_rl_term_up; +char _rl_term_up_default[2] = { 0, 0 }; /* A visible bell; char if the terminal can be made to flash the screen. */ -static char *_rl_visible_bell; +static const char *_rl_visible_bell; /* Non-zero means the terminal can auto-wrap lines. */ int _rl_term_autowrap = -1; @@ -141,33 +143,33 @@ static int term_has_meta; /* The sequences to write to turn on and off the meta key, if this terminal has one. */ -static char *_rl_term_mm; -static char *_rl_term_mo; +static const char *_rl_term_mm; +static const char *_rl_term_mo; /* The key sequences output by the arrow keys, if this terminal has any. */ -static char *_rl_term_ku; -static char *_rl_term_kd; -static char *_rl_term_kr; -static char *_rl_term_kl; +static const char *_rl_term_ku; +static const char *_rl_term_kd; +static const char *_rl_term_kr; +static const char *_rl_term_kl; /* How to initialize and reset the arrow keys, if this terminal has any. */ -static char *_rl_term_ks; -static char *_rl_term_ke; +static const char *_rl_term_ks; +static const char *_rl_term_ke; /* The key sequences sent by the Home and End keys, if any. */ -static char *_rl_term_kh; -static char *_rl_term_kH; -static char *_rl_term_at7; /* @7 */ +static const char *_rl_term_kh; +static const char *_rl_term_kH; +static const char *_rl_term_at7; /* @7 */ /* Delete key */ -static char *_rl_term_kD; +static const char *_rl_term_kD; /* Insert key */ -static char *_rl_term_kI; +static const char *_rl_term_kI; /* Cursor control */ -static char *_rl_term_vs; /* very visible */ -static char *_rl_term_ve; /* normal */ +static const char *_rl_term_vs; /* very visible */ +static const char *_rl_term_ve; /* normal */ static void bind_termcap_arrow_keys PARAMS((Keymap)); @@ -362,7 +364,7 @@ rl_resize_terminal () struct _tc_string { const char *tc_var; - char **tc_value; + const char **tc_value; }; /* This should be kept sorted, just in case we decide to change the @@ -409,7 +411,7 @@ get_term_capabilities (bp) char **bp; { #if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */ - register int i; + register unsigned int i; for (i = 0; i < NUM_TC_STRINGS; i++) *(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp); @@ -496,8 +498,9 @@ _rl_init_terminal_io (terminal_name) tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we change that later... */ PC = '\0'; - BC = _rl_term_backspace = "\b"; - UP = _rl_term_up; + _rl_term_backspace = _rl_term_backspace_default; + BC = (char*)_rl_term_backspace; + UP = (char*)_rl_term_up; return 0; } @@ -507,8 +510,8 @@ _rl_init_terminal_io (terminal_name) /* Set up the variables that the termcap library expects the application to provide. */ PC = _rl_term_pc ? *_rl_term_pc : 0; - BC = _rl_term_backspace; - UP = _rl_term_up; + BC = (char*)_rl_term_backspace; + UP = (char*)_rl_term_up; if (!_rl_term_cr) _rl_term_cr = "\r"; @@ -568,11 +571,11 @@ bind_termcap_arrow_keys (map) _rl_keymap = xkeymap; } -char * +const char * rl_get_termcap (cap) const char *cap; { - register int i; + register unsigned int i; if (tcap_initialized == 0) return ((char *)NULL); diff --git a/cmd-line-utils/readline/text.c b/cmd-line-utils/readline/text.c index b26afeda525..272848c798c 100644 --- a/cmd-line-utils/readline/text.c +++ b/cmd-line-utils/readline/text.c @@ -410,7 +410,7 @@ rl_backward (count, key) /* Move to the beginning of the line. */ int rl_beg_of_line (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { rl_point = 0; return 0; @@ -419,7 +419,7 @@ rl_beg_of_line (count, key) /* Move to the end of the line. */ int rl_end_of_line (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { rl_point = rl_end; return 0; @@ -527,7 +527,7 @@ rl_backward_word (count, key) /* Clear the current line. Numeric argument to C-l does this. */ int rl_refresh_line (ignore1, ignore2) - int ignore1, ignore2; + int ignore1 __attribute__((unused)), ignore2 __attribute__((unused)); { int curr_line; @@ -566,7 +566,7 @@ rl_clear_screen (count, key) int rl_arrow_keys (count, c) - int count, c; + int count, c __attribute__((unused)); { int ch; @@ -884,7 +884,7 @@ _rl_insert_next_callback (data) int rl_quoted_insert (count, key) - int count, key; + int count, key __attribute__((unused)); { /* Let's see...should the callback interface futz with signal handling? */ #if defined (HANDLE_SIGNALS) @@ -907,7 +907,7 @@ rl_quoted_insert (count, key) /* Insert a tab character. */ int rl_tab_insert (count, key) - int count, key; + int count, key __attribute__((unused)); { return (_rl_insert_char (count, '\t')); } @@ -917,7 +917,7 @@ rl_tab_insert (count, key) meaning in the future. */ int rl_newline (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { rl_done = 1; @@ -951,7 +951,7 @@ rl_newline (count, key) is special cased. */ int rl_do_lowercase_version (ignore1, ignore2) - int ignore1, ignore2; + int ignore1 __attribute__((unused)), ignore2 __attribute__((unused)); { return 0; } @@ -1118,7 +1118,7 @@ rl_rubout_or_delete (count, key) /* Delete all spaces and tabs around point. */ int rl_delete_horizontal_space (count, ignore) - int count, ignore; + int count __attribute__((unused)), ignore __attribute__((unused)); { int start = rl_point; @@ -1163,9 +1163,9 @@ rl_delete_or_show_completions (count, key) A K*rn shell style function. */ int rl_insert_comment (count, key) - int count, key; + int count __attribute__((unused)), key; { - char *rl_comment_text; + const char *rl_comment_text; int rl_comment_len; rl_beg_of_line (1, key); @@ -1202,7 +1202,7 @@ rl_insert_comment (count, key) /* Uppercase the word at point. */ int rl_upcase_word (count, key) - int count, key; + int count, key __attribute__((unused)); { return (rl_change_case (count, UpCase)); } @@ -1210,7 +1210,7 @@ rl_upcase_word (count, key) /* Lowercase the word at point. */ int rl_downcase_word (count, key) - int count, key; + int count, key __attribute__((unused)); { return (rl_change_case (count, DownCase)); } @@ -1218,7 +1218,7 @@ rl_downcase_word (count, key) /* Upcase the first letter, downcase the rest. */ int rl_capitalize_word (count, key) - int count, key; + int count, key __attribute__((unused)); { return (rl_change_case (count, CapCase)); } @@ -1381,7 +1381,7 @@ rl_transpose_words (count, key) then transpose the characters before point. */ int rl_transpose_chars (count, key) - int count, key; + int count, key __attribute__((unused)); { #if defined (HANDLE_MULTIBYTE) char *dummy; @@ -1557,7 +1557,7 @@ _rl_char_search_callback (data) int rl_char_search (count, key) - int count, key; + int count, key __attribute__((unused)); { #if defined (READLINE_CALLBACKS) if (RL_ISSTATE (RL_STATE_CALLBACK)) @@ -1575,7 +1575,7 @@ rl_char_search (count, key) int rl_backward_char_search (count, key) - int count, key; + int count, key __attribute__((unused)); { #if defined (READLINE_CALLBACKS) if (RL_ISSTATE (RL_STATE_CALLBACK)) @@ -1612,7 +1612,7 @@ _rl_set_mark_at_pos (position) /* A bindable command to set the mark. */ int rl_set_mark (count, key) - int count, key; + int count, key __attribute__((unused)); { return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point)); } @@ -1620,7 +1620,7 @@ rl_set_mark (count, key) /* Exchange the position of mark and point. */ int rl_exchange_point_and_mark (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (rl_mark > rl_end) rl_mark = -1; diff --git a/cmd-line-utils/readline/tilde.c b/cmd-line-utils/readline/tilde.c index d50f7a0ffa4..128cc26d9a7 100644 --- a/cmd-line-utils/readline/tilde.c +++ b/cmd-line-utils/readline/tilde.c @@ -196,7 +196,7 @@ tilde_expand (string) int result_size, result_index; result_index = result_size = 0; - if (result = strchr (string, '~')) + if ((result = strchr (string, '~'))) result = (char *)xmalloc (result_size = (strlen (string) + 16)); else result = (char *)xmalloc (result_size = (strlen (string) + 1)); diff --git a/cmd-line-utils/readline/undo.c b/cmd-line-utils/readline/undo.c index 5699193b14c..79846c26024 100644 --- a/cmd-line-utils/readline/undo.c +++ b/cmd-line-utils/readline/undo.c @@ -231,7 +231,8 @@ rl_do_undo () int _rl_fix_last_undo_of_type (type, start, end) - int type, start, end; + enum undo_code type; + int start, end; { UNDO_LIST *rl; @@ -289,7 +290,7 @@ rl_modifying (start, end) /* Revert the current line to its previous state. */ int rl_revert_line (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { if (!rl_undo_list) rl_ding (); @@ -309,7 +310,7 @@ rl_revert_line (count, key) /* Do some undoing of things that were done. */ int rl_undo_command (count, key) - int count, key; + int count, key __attribute__((unused)); { if (count < 0) return 0; /* Nothing to do. */ diff --git a/cmd-line-utils/readline/util.c b/cmd-line-utils/readline/util.c index 935c9c927c2..50cfea75cb9 100644 --- a/cmd-line-utils/readline/util.c +++ b/cmd-line-utils/readline/util.c @@ -115,14 +115,14 @@ _rl_abort_internal () int rl_abort (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { return (_rl_abort_internal ()); } int rl_tty_status (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { #if defined (TIOCSTAT) ioctl (1, TIOCSTAT, (char *)0); @@ -172,7 +172,7 @@ rl_extend_line_buffer (len) /* A function for simple tilde expansion. */ int rl_tilde_expand (ignore, key) - int ignore, key; + int ignore __attribute__((unused)), key __attribute__((unused)); { register int start, end; char *homedir, *temp; diff --git a/cmd-line-utils/readline/vi_mode.c b/cmd-line-utils/readline/vi_mode.c index 25213cb762f..620bb863c7b 100644 --- a/cmd-line-utils/readline/vi_mode.c +++ b/cmd-line-utils/readline/vi_mode.c @@ -131,7 +131,7 @@ static int _rl_vi_callback_char_search PARAMS((_rl_callback_generic_arg *)); void _rl_vi_initialize_line () { - register int i; + register size_t i; for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++) vi_mark_chars[i] = -1; @@ -190,7 +190,7 @@ _rl_vi_stuff_insert (count) puts you back into insert mode. */ int rl_vi_redo (count, c) - int count, c; + int count, c __attribute__((unused)); { int r; @@ -238,7 +238,7 @@ rl_vi_undo (count, key) /* Yank the nth arg from the previous line into this line at point. */ int rl_vi_yank_arg (count, key) - int count, key; + int count, key __attribute__((unused)); { /* Readline thinks that the first word on a line is the 0th, while vi thinks the first word on a line is the 1st. Compensate. */ @@ -321,7 +321,7 @@ rl_vi_search (count, key) /* Completion, from vi's point of view. */ int rl_vi_complete (ignore, key) - int ignore, key; + int ignore __attribute__((unused)), key; { if ((rl_point < rl_end) && (!whitespace (rl_line_buffer[rl_point]))) { @@ -348,7 +348,7 @@ rl_vi_complete (ignore, key) /* Tilde expansion for vi mode. */ int rl_vi_tilde_expand (ignore, key) - int ignore, key; + int ignore __attribute__((unused)), key; { rl_tilde_expand (0, key); rl_vi_start_inserting (key, 1, rl_arg_sign); @@ -419,7 +419,7 @@ rl_vi_end_word (count, key) /* Move forward a word the way that 'W' does. */ int rl_vi_fWord (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point < (rl_end - 1)) { @@ -436,7 +436,7 @@ rl_vi_fWord (count, ignore) int rl_vi_bWord (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point > 0) { @@ -460,7 +460,7 @@ rl_vi_bWord (count, ignore) int rl_vi_eWord (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point < (rl_end - 1)) { @@ -491,7 +491,7 @@ rl_vi_eWord (count, ignore) int rl_vi_fword (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point < (rl_end - 1)) { @@ -517,7 +517,7 @@ rl_vi_fword (count, ignore) int rl_vi_bword (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point > 0) { @@ -556,7 +556,7 @@ rl_vi_bword (count, ignore) int rl_vi_eword (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { while (count-- && rl_point < rl_end - 1) { @@ -581,7 +581,7 @@ rl_vi_eword (count, ignore) int rl_vi_insert_beg (count, key) - int count, key; + int count __attribute__((unused)), key; { rl_beg_of_line (1, key); rl_vi_insertion_mode (1, key); @@ -610,7 +610,7 @@ _rl_vi_append_forward (key) int rl_vi_append_mode (count, key) - int count, key; + int count __attribute__((unused)), key; { _rl_vi_append_forward (key); rl_vi_start_inserting (key, 1, rl_arg_sign); @@ -619,7 +619,7 @@ rl_vi_append_mode (count, key) int rl_vi_append_eol (count, key) - int count, key; + int count __attribute__((unused)), key; { rl_end_of_line (1, key); rl_vi_append_mode (1, key); @@ -629,7 +629,7 @@ rl_vi_append_eol (count, key) /* What to do in the case of C-d. */ int rl_vi_eof_maybe (count, c) - int count, c; + int count __attribute__((unused)), c __attribute__((unused)); { return (rl_newline (1, '\n')); } @@ -640,7 +640,7 @@ rl_vi_eof_maybe (count, c) switching keymaps. */ int rl_vi_insertion_mode (count, key) - int count, key; + int count __attribute__((unused)), key; { _rl_keymap = vi_insertion_keymap; _rl_vi_last_key_before_insert = key; @@ -703,7 +703,7 @@ _rl_vi_done_inserting () int rl_vi_movement_mode (count, key) - int count, key; + int count __attribute__((unused)), key; { if (rl_point > 0) rl_backward_char (1, key); @@ -783,7 +783,7 @@ _rl_vi_change_mbchar_case (count) int rl_vi_change_case (count, ignore) - int count, ignore; + int count, ignore __attribute__((unused)); { int c, p; @@ -1031,7 +1031,7 @@ rl_digit_loop1 () int rl_vi_delete_to (count, key) - int count, key; + int count __attribute__((unused)), key; { int c; @@ -1057,7 +1057,7 @@ rl_vi_delete_to (count, key) int rl_vi_change_to (count, key) - int count, key; + int count __attribute__((unused)), key; { int c, start_pos; @@ -1110,7 +1110,7 @@ rl_vi_change_to (count, key) int rl_vi_yank_to (count, key) - int count, key; + int count __attribute__((unused)), key; { int c, save; @@ -1202,7 +1202,7 @@ rl_vi_delete (count, key) int rl_vi_back_to_indent (count, key) - int count, key; + int count __attribute__((unused)), key; { rl_beg_of_line (1, key); while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point])) @@ -1212,7 +1212,7 @@ rl_vi_back_to_indent (count, key) int rl_vi_first_print (count, key) - int count, key; + int count __attribute__((unused)), key; { return (rl_vi_back_to_indent (1, key)); } @@ -1319,7 +1319,7 @@ rl_vi_char_search (count, key) /* Match brackets */ int rl_vi_match (ignore, key) - int ignore, key; + int ignore __attribute__((unused)), key; { int count = 1, brack, pos, tmp, pre; @@ -1426,7 +1426,7 @@ rl_vi_bracktype (c) static int _rl_vi_change_char (count, c, mb) int count, c; - char *mb; + char *mb __attribute__((unused)); { int p; @@ -1458,8 +1458,8 @@ _rl_vi_change_char (count, c, mb) static int _rl_vi_callback_getchar (mb, mlen) - char *mb; - int mlen; + char *mb __attribute__((unused)); + int mlen __attribute__((unused)); { int c; @@ -1494,7 +1494,7 @@ _rl_vi_callback_change_char (data) int rl_vi_change_char (count, key) - int count, key; + int count, key __attribute__((unused)); { int c; char mb[MB_LEN_MAX]; @@ -1582,7 +1582,7 @@ rl_vi_overstrike_delete (count, key) int rl_vi_replace (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { int i; @@ -1663,7 +1663,7 @@ _rl_vi_set_mark () #if defined (READLINE_CALLBACKS) static int _rl_vi_callback_set_mark (data) - _rl_callback_generic_arg *data; + _rl_callback_generic_arg *data __attribute__((unused)); { _rl_callback_func = 0; _rl_want_redisplay = 1; @@ -1674,7 +1674,7 @@ _rl_vi_callback_set_mark (data) int rl_vi_set_mark (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { #if defined (READLINE_CALLBACKS) if (RL_ISSTATE (RL_STATE_CALLBACK)) @@ -1721,7 +1721,7 @@ _rl_vi_goto_mark () #if defined (READLINE_CALLBACKS) static int _rl_vi_callback_goto_mark (data) - _rl_callback_generic_arg *data; + _rl_callback_generic_arg *data __attribute__((unused)); { _rl_callback_func = 0; _rl_want_redisplay = 1; @@ -1732,7 +1732,7 @@ _rl_vi_callback_goto_mark (data) int rl_vi_goto_mark (count, key) - int count, key; + int count __attribute__((unused)), key __attribute__((unused)); { #if defined (READLINE_CALLBACKS) if (RL_ISSTATE (RL_STATE_CALLBACK)) diff --git a/configure.in b/configure.in index 4fcb1f13f35..ddebde47d12 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.84) +AM_INIT_AUTOMAKE(mysql, 5.0.85) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=84 +NDB_VERSION_BUILD=85 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? @@ -1756,7 +1756,7 @@ esac # Build optimized or debug version ? # First check for gcc and g++ -if test "$ac_cv_prog_gcc" = "yes" +if test "$GCC" = "yes" then DEBUG_CFLAGS="-g" DEBUG_OPTIMIZE_CC="-O" @@ -1764,9 +1764,16 @@ then else DEBUG_CFLAGS="-g" DEBUG_OPTIMIZE_CC="" - OPTIMIZE_CFLAGS="-O" + case $SYSTEM_TYPE in + *solaris*) + OPTIMIZE_CFLAGS="-O1" + ;; + *) + OPTIMIZE_CFLAGS="-O" + ;; + esac fi -if test "$ac_cv_prog_cxx_g" = "yes" +if test "$GXX" = "yes" then DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="-O" @@ -1774,7 +1781,14 @@ then else DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="" - OPTIMIZE_CXXFLAGS="-O" + case $SYSTEM_TYPE in + *solaris*) + OPTIMIZE_CXXFLAGS="-O1" + ;; + *) + OPTIMIZE_CXXFLAGS="-O" + ;; + esac fi if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 262b5cb3b8b..b4d9005af15 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -790,15 +790,17 @@ void processReply(SSL& ssl) if (ssl.GetError()) return; if (DoProcessReply(ssl)) + { // didn't complete process if (!ssl.getSocket().IsNonBlocking()) { // keep trying now, blocking ok while (!ssl.GetError()) if (DoProcessReply(ssl) == 0) break; - } + } else // user will have try again later, non blocking ssl.SetError(YasslError(SSL_ERROR_WANT_READ)); + } } @@ -873,10 +875,12 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer) void sendChangeCipher(SSL& ssl, BufferOutput buffer) { if (ssl.getSecurity().get_parms().entity_ == server_end) + { if (ssl.getSecurity().get_resuming()) ssl.verifyState(clientKeyExchangeComplete); else ssl.verifyState(clientFinishedComplete); + } if (ssl.GetError()) return; ChangeCipherSpec ccs; diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index 4ee0fb99d3a..2b2efbbe04f 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -1272,6 +1272,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl) ssl.useSecurity().use_connection().sessionID_Set_ = false; if (ssl.getSecurity().get_resuming()) + { if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(), ID_LEN) == 0) { ssl.set_masterSecret(ssl.getSecurity().get_resume().GetSecret()); @@ -1286,6 +1287,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl) ssl.useSecurity().set_resuming(false); ssl.useLog().Trace("server denied resumption"); } + } if (ssl.CompressionOn() && !compression_method_) ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp index d1ebce7568b..4575fe1414b 100644 --- a/extra/yassl/taocrypt/include/modes.hpp +++ b/extra/yassl/taocrypt/include/modes.hpp @@ -96,10 +96,12 @@ inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz) if (mode_ == ECB) ECB_Process(out, in, sz); else if (mode_ == CBC) + { if (dir_ == ENCRYPTION) CBC_Encrypt(out, in, sz); else CBC_Decrypt(out, in, sz); + } } diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 3b1c1c2136a..78200841bda 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -781,10 +781,12 @@ void CertDecoder::GetDate(DateType dt) source_.advance(length); if (!ValidateDate(date, b, dt) && verify_) + { if (dt == BEFORE) source_.SetError(BEFORE_DATE_E); else source_.SetError(AFTER_DATE_E); + } // save for later use if (dt == BEFORE) { @@ -1062,6 +1064,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) } word32 rLen = GetLength(source); if (rLen != 20) + { if (rLen == 21) { // zero at front, eat source.next(); --rLen; @@ -1074,6 +1077,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) source.SetError(DSA_SZ_E); return 0; } + } memcpy(decoded, source.get_buffer() + source.get_index(), rLen); source.advance(rLen); @@ -1084,6 +1088,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) } word32 sLen = GetLength(source); if (sLen != 20) + { if (sLen == 21) { source.next(); // zero at front, eat --sLen; @@ -1096,6 +1101,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) source.SetError(DSA_SZ_E); return 0; } + } memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen); source.advance(sLen); diff --git a/include/hash.h b/include/hash.h index 97e947d7c6a..56b54a15a8c 100644 --- a/include/hash.h +++ b/include/hash.h @@ -63,7 +63,7 @@ void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row); my_bool hash_check(HASH *hash); /* Only in debug library */ #define hash_clear(H) bzero((char*) (H),sizeof(*(H))) -#define hash_inited(H) ((H)->array.buffer != 0) +#define hash_inited(H) ((H)->blength != 0) #define hash_init_opt(A,B,C,D,E,F,G,H) \ (!hash_inited(A) && _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)) diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 9e28fabe491..2349539eafd 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -581,6 +581,8 @@ struct row_prebuilt_struct { byte* ins_upd_rec_buff;/* buffer for storing data converted to the Innobase format from the MySQL format */ + const void* default_rec; /* the default values of all columns + (a "default row") in MySQL format */ ulint hint_need_to_fetch_extra_cols; /* normally this is set to 0; if this is set to ROW_RETRIEVE_PRIMARY_KEY, diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index d7213b25145..75c54cec4b3 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -625,7 +625,11 @@ row_create_prebuilt( prebuilt->ins_node = NULL; prebuilt->ins_upd_rec_buff = NULL; - + + prebuilt->default_rec = NULL; + + prebuilt->hint_need_to_fetch_extra_cols = 0; + prebuilt->upd_node = NULL; prebuilt->ins_graph = NULL; prebuilt->upd_graph = NULL; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index c956492900d..7fbf7fe7328 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2423,8 +2423,9 @@ row_sel_store_mysql_rec( byte* data; ulint len; ulint i; - + ut_ad(prebuilt->mysql_template); + ut_ad(prebuilt->default_rec); ut_ad(rec_offs_validate(rec, NULL, offsets)); if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) { @@ -2520,58 +2521,15 @@ row_sel_store_mysql_rec( ~(byte) (templ->mysql_null_bit_mask); } } else { - /* MySQL seems to assume the field for an SQL NULL - value is set to zero or space. Not taking this into - account caused seg faults with NULL BLOB fields, and - bug number 154 in the MySQL bug database: GROUP BY - and DISTINCT could treat NULL values inequal. */ - int pad_char; + /* MySQL assumes that the field for an SQL + NULL value is set to the default value. */ mysql_rec[templ->mysql_null_byte_offset] |= (byte) (templ->mysql_null_bit_mask); - switch (templ->type) { - case DATA_VARCHAR: - case DATA_BINARY: - case DATA_VARMYSQL: - if (templ->mysql_type - == DATA_MYSQL_TRUE_VARCHAR) { - /* This is a >= 5.0.3 type - true VARCHAR. Zero the field. */ - pad_char = 0x00; - break; - } - /* Fall through */ - case DATA_CHAR: - case DATA_FIXBINARY: - case DATA_MYSQL: - /* MySQL pads all string types (except - BLOB, TEXT and true VARCHAR) with space. */ - if (UNIV_UNLIKELY(templ->mbminlen == 2)) { - /* Treat UCS2 as a special case. */ - data = mysql_rec - + templ->mysql_col_offset; - len = templ->mysql_col_len; - /* There are two UCS2 bytes per char, - so the length has to be even. */ - ut_a(!(len & 1)); - /* Pad with 0x0020. */ - while (len) { - *data++ = 0x00; - *data++ = 0x20; - len -= 2; - } - continue; - } - pad_char = 0x20; - break; - default: - pad_char = 0x00; - break; - } - - ut_ad(!pad_char || templ->mbminlen == 1); - memset(mysql_rec + templ->mysql_col_offset, - pad_char, templ->mysql_col_len); + memcpy(mysql_rec + templ->mysql_col_offset, + (const byte*) prebuilt->default_rec + + templ->mysql_col_offset, + templ->mysql_col_len); } } diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index d8745c38f57..d0689af5bff 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -68,7 +68,7 @@ Warnings: Error 1259 ZLIB: Input data corrupted Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted) drop table t1; -set @@max_allowed_packet=1048576*100; +set @@global.max_allowed_packet=1048576*100; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null 0 diff --git a/mysql-test/r/innodb_bug40565.result b/mysql-test/r/innodb_bug40565.result new file mode 100644 index 00000000000..21e923d9336 --- /dev/null +++ b/mysql-test/r/innodb_bug40565.result @@ -0,0 +1,9 @@ +create table bug40565(value decimal(4,2)) engine=innodb; +insert into bug40565 values (1), (null); +update bug40565 set value=NULL; +affected rows: 1 +info: Rows matched: 2 Changed: 1 Warnings: 0 +update bug40565 set value=NULL; +affected rows: 0 +info: Rows matched: 2 Changed: 0 Warnings: 0 +drop table bug40565; diff --git a/mysql-test/r/mysql-bug45236.result b/mysql-test/r/mysql-bug45236.result new file mode 100644 index 00000000000..cefcb1d314c --- /dev/null +++ b/mysql-test/r/mysql-bug45236.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS t1; +SET @old_max_allowed_packet= @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 1024 * 1024 + 1024; +CREATE TABLE t1(data LONGBLOB); +INSERT INTO t1 SELECT CONCAT(REPEAT('1', 1024*1024 - 27), +"\'\r dummydb dummyhost"); +DROP TABLE t1; +SET @@global.max_allowed_packet = @old_max_allowed_packet; diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result index 5cc63c4690d..ecbb47d4ee0 100644 --- a/mysql-test/r/packet.result +++ b/mysql-test/r/packet.result @@ -3,32 +3,22 @@ set @net_buffer_length=@@global.net_buffer_length; set global max_allowed_packet=100; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '100' -set max_allowed_packet=100; -Warnings: -Warning 1292 Truncated incorrect max_allowed_packet value: '100' set global net_buffer_length=100; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '100' -set net_buffer_length=100; -Warnings: -Warning 1292 Truncated incorrect net_buffer_length value: '100' SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; len 1024 select repeat('a',2000); repeat('a',2000) -NULL -Warnings: -Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa select @@net_buffer_length, @@max_allowed_packet; @@net_buffer_length @@max_allowed_packet 1024 1024 SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes set global max_allowed_packet=default; -set max_allowed_packet=default; set global net_buffer_length=default; -set net_buffer_length=default; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; len 100 diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 0f4d0fa8dad..7f1ae19035f 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -949,3 +949,4 @@ use test; drop procedure mysqltestbug36570_p1; drop procedure ` mysqltestbug36570_p2`; drop function mysqltestbug36570_f1; +set global log_bin_trust_function_creators = 0; diff --git a/mysql-test/r/sp-fib.result b/mysql-test/r/sp-fib.result index c51aa7d7ad1..a26e104c1e8 100644 --- a/mysql-test/r/sp-fib.result +++ b/mysql-test/r/sp-fib.result @@ -10,24 +10,17 @@ declare c cursor for select f from t3 order by f desc limit 2; open c; fetch c into y; fetch c into x; -close c; insert into t3 values (x+y); call fib(n-1); +## Close the cursor AFTER the recursion to ensure that the stack +## frame is somewhat intact. +close c; end; end if; end| set @@max_sp_recursion_depth= 20| insert into t3 values (0), (1)| -call fib(3)| -select * from t3 order by f asc| -f -0 -1 -1 -2 -delete from t3| -insert into t3 values (0), (1)| -call fib(10)| +call fib(4)| select * from t3 order by f asc| f 0 @@ -35,12 +28,6 @@ f 1 2 3 -5 -8 -13 -21 -34 -55 drop table t3| drop procedure fib| set @@max_sp_recursion_depth= 0| diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index fbec38c9a9f..496f0b69fb8 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -187,7 +187,7 @@ Variable_name Value myisam_max_sort_file_size FILE_SIZE set global net_retry_count=10, session net_retry_count=10; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; -set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; +set session net_write_timeout=500, net_read_timeout=600; show global variables like 'net_%'; Variable_name Value net_buffer_length 1024 @@ -196,35 +196,39 @@ net_retry_count 10 net_write_timeout 200 show session variables like 'net_%'; Variable_name Value -net_buffer_length 2048 +net_buffer_length 16384 net_read_timeout 600 net_retry_count 10 net_write_timeout 500 -set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; +set global net_buffer_length=8000, net_read_timeout=900, net_write_timeout=1000; show global variables like 'net_%'; Variable_name Value -net_buffer_length 1024 +net_buffer_length 7168 net_read_timeout 900 net_retry_count 10 net_write_timeout 1000 show session variables like 'net_%'; Variable_name Value -net_buffer_length 7168 +net_buffer_length 16384 net_read_timeout 600 net_retry_count 10 net_write_timeout 500 -set net_buffer_length=1; +set global net_buffer_length=1; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '1' -show variables like 'net_buffer_length'; +show global variables like 'net_buffer_length'; Variable_name Value net_buffer_length 1024 -set net_buffer_length=2000000000; +set global net_buffer_length=2000000000; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '2000000000' -show variables like 'net_buffer_length'; +show global variables like 'net_buffer_length'; Variable_name Value net_buffer_length 1048576 +set session net_buffer_length=1024; +ERROR HY000: SESSION variable net_buffer_length is read-only. Use SET GLOBAL net_buffer_length to assign the value +set session max_allowed_packet=1024; +ERROR HY000: SESSION variable max_allowed_packet is read-only. Use SET GLOBAL max_allowed_packet to assign the value set character set cp1251_koi8; show variables like "character_set_client"; Variable_name Value @@ -393,7 +397,7 @@ set last_insert_id=1; set global local_infile=1; set long_query_time=100; set low_priority_updates=1; -set max_allowed_packet=100; +set global max_allowed_packet=100; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '100' set global max_binlog_cache_size=100; @@ -417,7 +421,7 @@ select @@max_user_connections; 100 set global max_write_lock_count=100; set myisam_sort_buffer_size=100; -set net_buffer_length=100; +set global net_buffer_length=100; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '100' set net_read_timeout=100; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index a7ac971ef45..715fb225550 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3723,6 +3723,117 @@ DROP TABLE t1; # -- End of test case for Bug#40825 +# +# Bug #45806 crash when replacing into a view with a join! +# +CREATE TABLE t1(a INT UNIQUE); +CREATE VIEW v1 AS SELECT t1.a FROM t1, t1 AS a; +INSERT INTO t1 VALUES (1), (2); +REPLACE INTO v1(a) SELECT 1 FROM t1,t1 AS c; +SELECT * FROM v1; +a +1 +2 +1 +2 +REPLACE INTO v1(a) SELECT 3 FROM t1,t1 AS c; +SELECT * FROM v1; +a +1 +2 +3 +1 +2 +3 +1 +2 +3 +DELETE FROM t1 WHERE a=3; +INSERT INTO v1(a) SELECT 1 FROM t1,t1 AS c +ON DUPLICATE KEY UPDATE `v1`.`a`= 1; +SELECT * FROM v1; +a +1 +2 +1 +2 +CREATE VIEW v2 AS SELECT t1.a FROM t1, v1 AS a; +REPLACE INTO v2(a) SELECT 1 FROM t1,t1 AS c; +SELECT * FROM v2; +a +1 +2 +1 +2 +1 +2 +1 +2 +REPLACE INTO v2(a) SELECT 3 FROM t1,t1 AS c; +SELECT * FROM v2; +a +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +INSERT INTO v2(a) SELECT 1 FROM t1,t1 AS c +ON DUPLICATE KEY UPDATE `v2`.`a`= 1; +SELECT * FROM v2; +a +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +DROP VIEW v1; +DROP VIEW v2; +DROP TABLE t1; +# -- End of test case for Bug#45806 # ----------------------------------------------------------------- # -- End of 5.0 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/r/charset_collation.result b/mysql-test/suite/funcs_1/r/charset_collation.result new file mode 100644 index 00000000000..b3183ba48e1 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/charset_collation.result @@ -0,0 +1,40 @@ +DROP USER dbdict_test@localhost; +CREATE USER dbdict_test@localhost; +# Establish connection con (user=dbdict_test) + +SELECT * +FROM information_schema.character_sets +WHERE character_set_name IN ('utf8','latin1','binary') +ORDER BY character_set_name; +CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN +binary binary Binary pseudo charset 1 +latin1 latin1_swedish_ci cp1252 West European 1 +utf8 utf8_general_ci UTF-8 Unicode 3 + +SELECT * +FROM information_schema.collations +WHERE character_set_name IN ('utf8','latin1','binary') +AND (collation_name LIKE CONCAT(character_set_name,'_general_ci') +OR +collation_name LIKE CONCAT(character_set_name,'_bin')) +ORDER BY collation_name; +COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN +latin1_bin latin1 47 Yes 1 +latin1_general_ci latin1 48 Yes 1 +utf8_bin utf8 83 Yes 1 +utf8_general_ci utf8 33 Yes Yes 1 + +SELECT * +FROM information_schema.collation_character_set_applicability +WHERE character_set_name IN ('utf8','latin1','binary') +AND (collation_name LIKE CONCAT(character_set_name,'_general_ci') +OR +collation_name LIKE CONCAT(character_set_name,'_bin')) +ORDER BY collation_name, character_set_name; +COLLATION_NAME CHARACTER_SET_NAME +latin1_bin latin1 +latin1_general_ci latin1 +utf8_bin utf8 +utf8_general_ci utf8 +# Switch to connection default + disconnect con +DROP USER dbdict_test@localhost; diff --git a/mysql-test/suite/funcs_1/r/charset_collation_1.result b/mysql-test/suite/funcs_1/r/charset_collation_1.result deleted file mode 100644 index d397c671321..00000000000 --- a/mysql-test/suite/funcs_1/r/charset_collation_1.result +++ /dev/null @@ -1,309 +0,0 @@ -DROP USER dbdict_test@localhost; -CREATE USER dbdict_test@localhost; -# Establish connection con (user=dbdict_test) - -SELECT * -FROM information_schema.character_sets -ORDER BY character_set_name; -CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN -armscii8 armscii8_general_ci ARMSCII-8 Armenian 1 -ascii ascii_general_ci US ASCII 1 -big5 big5_chinese_ci Big5 Traditional Chinese 2 -binary binary Binary pseudo charset 1 -cp1250 cp1250_general_ci Windows Central European 1 -cp1251 cp1251_general_ci Windows Cyrillic 1 -cp1256 cp1256_general_ci Windows Arabic 1 -cp1257 cp1257_general_ci Windows Baltic 1 -cp850 cp850_general_ci DOS West European 1 -cp852 cp852_general_ci DOS Central European 1 -cp866 cp866_general_ci DOS Russian 1 -cp932 cp932_japanese_ci SJIS for Windows Japanese 2 -dec8 dec8_swedish_ci DEC West European 1 -eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 -euckr euckr_korean_ci EUC-KR Korean 2 -gb2312 gb2312_chinese_ci GB2312 Simplified Chinese 2 -gbk gbk_chinese_ci GBK Simplified Chinese 2 -geostd8 geostd8_general_ci GEOSTD8 Georgian 1 -greek greek_general_ci ISO 8859-7 Greek 1 -hebrew hebrew_general_ci ISO 8859-8 Hebrew 1 -hp8 hp8_english_ci HP West European 1 -keybcs2 keybcs2_general_ci DOS Kamenicky Czech-Slovak 1 -koi8r koi8r_general_ci KOI8-R Relcom Russian 1 -koi8u koi8u_general_ci KOI8-U Ukrainian 1 -latin1 latin1_swedish_ci cp1252 West European 1 -latin2 latin2_general_ci ISO 8859-2 Central European 1 -latin5 latin5_turkish_ci ISO 8859-9 Turkish 1 -latin7 latin7_general_ci ISO 8859-13 Baltic 1 -macce macce_general_ci Mac Central European 1 -macroman macroman_general_ci Mac West European 1 -sjis sjis_japanese_ci Shift-JIS Japanese 2 -swe7 swe7_swedish_ci 7bit Swedish 1 -tis620 tis620_thai_ci TIS620 Thai 1 -ucs2 ucs2_general_ci UCS-2 Unicode 2 -ujis ujis_japanese_ci EUC-JP Japanese 3 -utf8 utf8_general_ci UTF-8 Unicode 3 - -SELECT * -FROM information_schema.collations -ORDER BY collation_name; -COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN -armscii8_bin armscii8 64 0 -armscii8_general_ci armscii8 32 Yes 0 -ascii_bin ascii 65 0 -ascii_general_ci ascii 11 Yes 0 -big5_bin big5 84 Yes 1 -big5_chinese_ci big5 1 Yes Yes 1 -binary binary 63 Yes Yes 1 -cp1250_bin cp1250 66 Yes 1 -cp1250_croatian_ci cp1250 44 Yes 1 -cp1250_czech_cs cp1250 34 Yes 2 -cp1250_general_ci cp1250 26 Yes Yes 1 -cp1251_bin cp1251 50 0 -cp1251_bulgarian_ci cp1251 14 0 -cp1251_general_ci cp1251 51 Yes 0 -cp1251_general_cs cp1251 52 0 -cp1251_ukrainian_ci cp1251 23 0 -cp1256_bin cp1256 67 0 -cp1256_general_ci cp1256 57 Yes 0 -cp1257_bin cp1257 58 0 -cp1257_general_ci cp1257 59 Yes 0 -cp1257_lithuanian_ci cp1257 29 0 -cp850_bin cp850 80 0 -cp850_general_ci cp850 4 Yes 0 -cp852_bin cp852 81 0 -cp852_general_ci cp852 40 Yes 0 -cp866_bin cp866 68 0 -cp866_general_ci cp866 36 Yes 0 -cp932_bin cp932 96 Yes 1 -cp932_japanese_ci cp932 95 Yes Yes 1 -dec8_bin dec8 69 0 -dec8_swedish_ci dec8 3 Yes 0 -eucjpms_bin eucjpms 98 Yes 1 -eucjpms_japanese_ci eucjpms 97 Yes Yes 1 -euckr_bin euckr 85 Yes 1 -euckr_korean_ci euckr 19 Yes Yes 1 -gb2312_bin gb2312 86 Yes 1 -gb2312_chinese_ci gb2312 24 Yes Yes 1 -gbk_bin gbk 87 Yes 1 -gbk_chinese_ci gbk 28 Yes Yes 1 -geostd8_bin geostd8 93 0 -geostd8_general_ci geostd8 92 Yes 0 -greek_bin greek 70 0 -greek_general_ci greek 25 Yes 0 -hebrew_bin hebrew 71 0 -hebrew_general_ci hebrew 16 Yes 0 -hp8_bin hp8 72 0 -hp8_english_ci hp8 6 Yes 0 -keybcs2_bin keybcs2 73 0 -keybcs2_general_ci keybcs2 37 Yes 0 -koi8r_bin koi8r 74 0 -koi8r_general_ci koi8r 7 Yes 0 -koi8u_bin koi8u 75 0 -koi8u_general_ci koi8u 22 Yes 0 -latin1_bin latin1 47 Yes 1 -latin1_danish_ci latin1 15 Yes 1 -latin1_general_ci latin1 48 Yes 1 -latin1_general_cs latin1 49 Yes 1 -latin1_german1_ci latin1 5 Yes 1 -latin1_german2_ci latin1 31 Yes 2 -latin1_spanish_ci latin1 94 Yes 1 -latin1_swedish_ci latin1 8 Yes Yes 1 -latin2_bin latin2 77 Yes 1 -latin2_croatian_ci latin2 27 Yes 1 -latin2_czech_cs latin2 2 Yes 4 -latin2_general_ci latin2 9 Yes Yes 1 -latin2_hungarian_ci latin2 21 Yes 1 -latin5_bin latin5 78 0 -latin5_turkish_ci latin5 30 Yes 0 -latin7_bin latin7 79 0 -latin7_estonian_cs latin7 20 0 -latin7_general_ci latin7 41 Yes 0 -latin7_general_cs latin7 42 0 -macce_bin macce 43 0 -macce_general_ci macce 38 Yes 0 -macroman_bin macroman 53 0 -macroman_general_ci macroman 39 Yes 0 -sjis_bin sjis 88 Yes 1 -sjis_japanese_ci sjis 13 Yes Yes 1 -swe7_bin swe7 82 0 -swe7_swedish_ci swe7 10 Yes 0 -tis620_bin tis620 89 Yes 1 -tis620_thai_ci tis620 18 Yes Yes 4 -ucs2_bin ucs2 90 Yes 1 -ucs2_czech_ci ucs2 138 Yes 8 -ucs2_danish_ci ucs2 139 Yes 8 -ucs2_esperanto_ci ucs2 145 Yes 8 -ucs2_estonian_ci ucs2 134 Yes 8 -ucs2_general_ci ucs2 35 Yes Yes 1 -ucs2_hungarian_ci ucs2 146 Yes 8 -ucs2_icelandic_ci ucs2 129 Yes 8 -ucs2_latvian_ci ucs2 130 Yes 8 -ucs2_lithuanian_ci ucs2 140 Yes 8 -ucs2_persian_ci ucs2 144 Yes 8 -ucs2_polish_ci ucs2 133 Yes 8 -ucs2_romanian_ci ucs2 131 Yes 8 -ucs2_roman_ci ucs2 143 Yes 8 -ucs2_slovak_ci ucs2 141 Yes 8 -ucs2_slovenian_ci ucs2 132 Yes 8 -ucs2_spanish2_ci ucs2 142 Yes 8 -ucs2_spanish_ci ucs2 135 Yes 8 -ucs2_swedish_ci ucs2 136 Yes 8 -ucs2_turkish_ci ucs2 137 Yes 8 -ucs2_unicode_ci ucs2 128 Yes 8 -ujis_bin ujis 91 Yes 1 -ujis_japanese_ci ujis 12 Yes Yes 1 -utf8_bin utf8 83 Yes 1 -utf8_czech_ci utf8 202 Yes 8 -utf8_danish_ci utf8 203 Yes 8 -utf8_esperanto_ci utf8 209 Yes 8 -utf8_estonian_ci utf8 198 Yes 8 -utf8_general_ci utf8 33 Yes Yes 1 -utf8_hungarian_ci utf8 210 Yes 8 -utf8_icelandic_ci utf8 193 Yes 8 -utf8_latvian_ci utf8 194 Yes 8 -utf8_lithuanian_ci utf8 204 Yes 8 -utf8_persian_ci utf8 208 Yes 8 -utf8_polish_ci utf8 197 Yes 8 -utf8_romanian_ci utf8 195 Yes 8 -utf8_roman_ci utf8 207 Yes 8 -utf8_slovak_ci utf8 205 Yes 8 -utf8_slovenian_ci utf8 196 Yes 8 -utf8_spanish2_ci utf8 206 Yes 8 -utf8_spanish_ci utf8 199 Yes 8 -utf8_swedish_ci utf8 200 Yes 8 -utf8_turkish_ci utf8 201 Yes 8 -utf8_unicode_ci utf8 192 Yes 8 - - -SELECT * -FROM information_schema.collation_character_set_applicability -ORDER BY collation_name, character_set_name; -COLLATION_NAME CHARACTER_SET_NAME -armscii8_bin armscii8 -armscii8_general_ci armscii8 -ascii_bin ascii -ascii_general_ci ascii -big5_bin big5 -big5_chinese_ci big5 -binary binary -cp1250_bin cp1250 -cp1250_croatian_ci cp1250 -cp1250_czech_cs cp1250 -cp1250_general_ci cp1250 -cp1251_bin cp1251 -cp1251_bulgarian_ci cp1251 -cp1251_general_ci cp1251 -cp1251_general_cs cp1251 -cp1251_ukrainian_ci cp1251 -cp1256_bin cp1256 -cp1256_general_ci cp1256 -cp1257_bin cp1257 -cp1257_general_ci cp1257 -cp1257_lithuanian_ci cp1257 -cp850_bin cp850 -cp850_general_ci cp850 -cp852_bin cp852 -cp852_general_ci cp852 -cp866_bin cp866 -cp866_general_ci cp866 -cp932_bin cp932 -cp932_japanese_ci cp932 -dec8_bin dec8 -dec8_swedish_ci dec8 -eucjpms_bin eucjpms -eucjpms_japanese_ci eucjpms -euckr_bin euckr -euckr_korean_ci euckr -gb2312_bin gb2312 -gb2312_chinese_ci gb2312 -gbk_bin gbk -gbk_chinese_ci gbk -geostd8_bin geostd8 -geostd8_general_ci geostd8 -greek_bin greek -greek_general_ci greek -hebrew_bin hebrew -hebrew_general_ci hebrew -hp8_bin hp8 -hp8_english_ci hp8 -keybcs2_bin keybcs2 -keybcs2_general_ci keybcs2 -koi8r_bin koi8r -koi8r_general_ci koi8r -koi8u_bin koi8u -koi8u_general_ci koi8u -latin1_bin latin1 -latin1_danish_ci latin1 -latin1_general_ci latin1 -latin1_general_cs latin1 -latin1_german1_ci latin1 -latin1_german2_ci latin1 -latin1_spanish_ci latin1 -latin1_swedish_ci latin1 -latin2_bin latin2 -latin2_croatian_ci latin2 -latin2_czech_cs latin2 -latin2_general_ci latin2 -latin2_hungarian_ci latin2 -latin5_bin latin5 -latin5_turkish_ci latin5 -latin7_bin latin7 -latin7_estonian_cs latin7 -latin7_general_ci latin7 -latin7_general_cs latin7 -macce_bin macce -macce_general_ci macce -macroman_bin macroman -macroman_general_ci macroman -sjis_bin sjis -sjis_japanese_ci sjis -swe7_bin swe7 -swe7_swedish_ci swe7 -tis620_bin tis620 -tis620_thai_ci tis620 -ucs2_bin ucs2 -ucs2_czech_ci ucs2 -ucs2_danish_ci ucs2 -ucs2_esperanto_ci ucs2 -ucs2_estonian_ci ucs2 -ucs2_general_ci ucs2 -ucs2_hungarian_ci ucs2 -ucs2_icelandic_ci ucs2 -ucs2_latvian_ci ucs2 -ucs2_lithuanian_ci ucs2 -ucs2_persian_ci ucs2 -ucs2_polish_ci ucs2 -ucs2_romanian_ci ucs2 -ucs2_roman_ci ucs2 -ucs2_slovak_ci ucs2 -ucs2_slovenian_ci ucs2 -ucs2_spanish2_ci ucs2 -ucs2_spanish_ci ucs2 -ucs2_swedish_ci ucs2 -ucs2_turkish_ci ucs2 -ucs2_unicode_ci ucs2 -ujis_bin ujis -ujis_japanese_ci ujis -utf8_bin utf8 -utf8_czech_ci utf8 -utf8_danish_ci utf8 -utf8_esperanto_ci utf8 -utf8_estonian_ci utf8 -utf8_general_ci utf8 -utf8_hungarian_ci utf8 -utf8_icelandic_ci utf8 -utf8_latvian_ci utf8 -utf8_lithuanian_ci utf8 -utf8_persian_ci utf8 -utf8_polish_ci utf8 -utf8_romanian_ci utf8 -utf8_roman_ci utf8 -utf8_slovak_ci utf8 -utf8_slovenian_ci utf8 -utf8_spanish2_ci utf8 -utf8_spanish_ci utf8 -utf8_swedish_ci utf8 -utf8_turkish_ci utf8 -utf8_unicode_ci utf8 -# Switch to connection default + disconnect con -DROP USER dbdict_test@localhost; diff --git a/mysql-test/suite/funcs_1/r/charset_collation_2.result b/mysql-test/suite/funcs_1/r/charset_collation_2.result deleted file mode 100644 index 0035da13c56..00000000000 --- a/mysql-test/suite/funcs_1/r/charset_collation_2.result +++ /dev/null @@ -1,311 +0,0 @@ -DROP USER dbdict_test@localhost; -CREATE USER dbdict_test@localhost; -# Establish connection con (user=dbdict_test) - -SELECT * -FROM information_schema.character_sets -ORDER BY character_set_name; -CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN -armscii8 armscii8_general_ci ARMSCII-8 Armenian 1 -ascii ascii_general_ci US ASCII 1 -big5 big5_chinese_ci Big5 Traditional Chinese 2 -binary binary Binary pseudo charset 1 -cp1250 cp1250_general_ci Windows Central European 1 -cp1251 cp1251_general_ci Windows Cyrillic 1 -cp1256 cp1256_general_ci Windows Arabic 1 -cp1257 cp1257_general_ci Windows Baltic 1 -cp850 cp850_general_ci DOS West European 1 -cp852 cp852_general_ci DOS Central European 1 -cp866 cp866_general_ci DOS Russian 1 -cp932 cp932_japanese_ci SJIS for Windows Japanese 2 -dec8 dec8_swedish_ci DEC West European 1 -eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 -euckr euckr_korean_ci EUC-KR Korean 2 -gb2312 gb2312_chinese_ci GB2312 Simplified Chinese 2 -gbk gbk_chinese_ci GBK Simplified Chinese 2 -geostd8 geostd8_general_ci GEOSTD8 Georgian 1 -greek greek_general_ci ISO 8859-7 Greek 1 -hebrew hebrew_general_ci ISO 8859-8 Hebrew 1 -hp8 hp8_english_ci HP West European 1 -keybcs2 keybcs2_general_ci DOS Kamenicky Czech-Slovak 1 -koi8r koi8r_general_ci KOI8-R Relcom Russian 1 -koi8u koi8u_general_ci KOI8-U Ukrainian 1 -latin1 latin1_swedish_ci cp1252 West European 1 -latin2 latin2_general_ci ISO 8859-2 Central European 1 -latin5 latin5_turkish_ci ISO 8859-9 Turkish 1 -latin7 latin7_general_ci ISO 8859-13 Baltic 1 -macce macce_general_ci Mac Central European 1 -macroman macroman_general_ci Mac West European 1 -sjis sjis_japanese_ci Shift-JIS Japanese 2 -swe7 swe7_swedish_ci 7bit Swedish 1 -tis620 tis620_thai_ci TIS620 Thai 1 -ucs2 ucs2_general_ci UCS-2 Unicode 2 -ujis ujis_japanese_ci EUC-JP Japanese 3 -utf8 utf8_general_ci UTF-8 Unicode 3 - -SELECT * -FROM information_schema.collations -ORDER BY collation_name; -COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN -armscii8_bin armscii8 64 0 -armscii8_general_ci armscii8 32 Yes 0 -ascii_bin ascii 65 0 -ascii_general_ci ascii 11 Yes 0 -big5_bin big5 84 Yes 1 -big5_chinese_ci big5 1 Yes Yes 1 -binary binary 63 Yes Yes 1 -cp1250_bin cp1250 66 Yes 1 -cp1250_croatian_ci cp1250 44 Yes 1 -cp1250_czech_cs cp1250 34 Yes 2 -cp1250_general_ci cp1250 26 Yes Yes 1 -cp1251_bin cp1251 50 0 -cp1251_bulgarian_ci cp1251 14 0 -cp1251_general_ci cp1251 51 Yes 0 -cp1251_general_cs cp1251 52 0 -cp1251_ukrainian_ci cp1251 23 0 -cp1256_bin cp1256 67 0 -cp1256_general_ci cp1256 57 Yes 0 -cp1257_bin cp1257 58 0 -cp1257_general_ci cp1257 59 Yes 0 -cp1257_lithuanian_ci cp1257 29 0 -cp850_bin cp850 80 0 -cp850_general_ci cp850 4 Yes 0 -cp852_bin cp852 81 0 -cp852_general_ci cp852 40 Yes 0 -cp866_bin cp866 68 0 -cp866_general_ci cp866 36 Yes 0 -cp932_bin cp932 96 Yes 1 -cp932_japanese_ci cp932 95 Yes Yes 1 -dec8_bin dec8 69 0 -dec8_swedish_ci dec8 3 Yes 0 -eucjpms_bin eucjpms 98 Yes 1 -eucjpms_japanese_ci eucjpms 97 Yes Yes 1 -euckr_bin euckr 85 Yes 1 -euckr_korean_ci euckr 19 Yes Yes 1 -gb2312_bin gb2312 86 Yes 1 -gb2312_chinese_ci gb2312 24 Yes Yes 1 -gbk_bin gbk 87 Yes 1 -gbk_chinese_ci gbk 28 Yes Yes 1 -geostd8_bin geostd8 93 0 -geostd8_general_ci geostd8 92 Yes 0 -greek_bin greek 70 0 -greek_general_ci greek 25 Yes 0 -hebrew_bin hebrew 71 0 -hebrew_general_ci hebrew 16 Yes 0 -hp8_bin hp8 72 0 -hp8_english_ci hp8 6 Yes 0 -keybcs2_bin keybcs2 73 0 -keybcs2_general_ci keybcs2 37 Yes 0 -koi8r_bin koi8r 74 0 -koi8r_general_ci koi8r 7 Yes 0 -koi8u_bin koi8u 75 0 -koi8u_general_ci koi8u 22 Yes 0 -latin1_bin latin1 47 Yes 1 -latin1_danish_ci latin1 15 Yes 1 -latin1_general_ci latin1 48 Yes 1 -latin1_general_cs latin1 49 Yes 1 -latin1_german1_ci latin1 5 Yes 1 -latin1_german2_ci latin1 31 Yes 2 -latin1_spanish_ci latin1 94 Yes 1 -latin1_swedish_ci latin1 8 Yes Yes 1 -latin2_bin latin2 77 Yes 1 -latin2_croatian_ci latin2 27 Yes 1 -latin2_czech_cs latin2 2 Yes 4 -latin2_general_ci latin2 9 Yes Yes 1 -latin2_hungarian_ci latin2 21 Yes 1 -latin5_bin latin5 78 0 -latin5_turkish_ci latin5 30 Yes 0 -latin7_bin latin7 79 0 -latin7_estonian_cs latin7 20 0 -latin7_general_ci latin7 41 Yes 0 -latin7_general_cs latin7 42 0 -macce_bin macce 43 0 -macce_general_ci macce 38 Yes 0 -macroman_bin macroman 53 0 -macroman_general_ci macroman 39 Yes 0 -sjis_bin sjis 88 Yes 1 -sjis_japanese_ci sjis 13 Yes Yes 1 -swe7_bin swe7 82 0 -swe7_swedish_ci swe7 10 Yes 0 -tis620_bin tis620 89 Yes 1 -tis620_thai_ci tis620 18 Yes Yes 4 -ucs2_bin ucs2 90 Yes 1 -ucs2_czech_ci ucs2 138 Yes 8 -ucs2_danish_ci ucs2 139 Yes 8 -ucs2_esperanto_ci ucs2 145 Yes 8 -ucs2_estonian_ci ucs2 134 Yes 8 -ucs2_general_ci ucs2 35 Yes Yes 1 -ucs2_hungarian_ci ucs2 146 Yes 8 -ucs2_icelandic_ci ucs2 129 Yes 8 -ucs2_latvian_ci ucs2 130 Yes 8 -ucs2_lithuanian_ci ucs2 140 Yes 8 -ucs2_persian_ci ucs2 144 Yes 8 -ucs2_polish_ci ucs2 133 Yes 8 -ucs2_romanian_ci ucs2 131 Yes 8 -ucs2_roman_ci ucs2 143 Yes 8 -ucs2_slovak_ci ucs2 141 Yes 8 -ucs2_slovenian_ci ucs2 132 Yes 8 -ucs2_spanish2_ci ucs2 142 Yes 8 -ucs2_spanish_ci ucs2 135 Yes 8 -ucs2_swedish_ci ucs2 136 Yes 8 -ucs2_turkish_ci ucs2 137 Yes 8 -ucs2_unicode_ci ucs2 128 Yes 8 -ujis_bin ujis 91 Yes 1 -ujis_japanese_ci ujis 12 Yes Yes 1 -utf8_bin utf8 83 Yes 1 -utf8_czech_ci utf8 202 Yes 8 -utf8_danish_ci utf8 203 Yes 8 -utf8_esperanto_ci utf8 209 Yes 8 -utf8_estonian_ci utf8 198 Yes 8 -utf8_general_ci utf8 33 Yes Yes 1 -utf8_general_cs utf8 254 Yes 1 -utf8_hungarian_ci utf8 210 Yes 8 -utf8_icelandic_ci utf8 193 Yes 8 -utf8_latvian_ci utf8 194 Yes 8 -utf8_lithuanian_ci utf8 204 Yes 8 -utf8_persian_ci utf8 208 Yes 8 -utf8_polish_ci utf8 197 Yes 8 -utf8_romanian_ci utf8 195 Yes 8 -utf8_roman_ci utf8 207 Yes 8 -utf8_slovak_ci utf8 205 Yes 8 -utf8_slovenian_ci utf8 196 Yes 8 -utf8_spanish2_ci utf8 206 Yes 8 -utf8_spanish_ci utf8 199 Yes 8 -utf8_swedish_ci utf8 200 Yes 8 -utf8_turkish_ci utf8 201 Yes 8 -utf8_unicode_ci utf8 192 Yes 8 - - -SELECT * -FROM information_schema.collation_character_set_applicability -ORDER BY collation_name, character_set_name; -COLLATION_NAME CHARACTER_SET_NAME -armscii8_bin armscii8 -armscii8_general_ci armscii8 -ascii_bin ascii -ascii_general_ci ascii -big5_bin big5 -big5_chinese_ci big5 -binary binary -cp1250_bin cp1250 -cp1250_croatian_ci cp1250 -cp1250_czech_cs cp1250 -cp1250_general_ci cp1250 -cp1251_bin cp1251 -cp1251_bulgarian_ci cp1251 -cp1251_general_ci cp1251 -cp1251_general_cs cp1251 -cp1251_ukrainian_ci cp1251 -cp1256_bin cp1256 -cp1256_general_ci cp1256 -cp1257_bin cp1257 -cp1257_general_ci cp1257 -cp1257_lithuanian_ci cp1257 -cp850_bin cp850 -cp850_general_ci cp850 -cp852_bin cp852 -cp852_general_ci cp852 -cp866_bin cp866 -cp866_general_ci cp866 -cp932_bin cp932 -cp932_japanese_ci cp932 -dec8_bin dec8 -dec8_swedish_ci dec8 -eucjpms_bin eucjpms -eucjpms_japanese_ci eucjpms -euckr_bin euckr -euckr_korean_ci euckr -gb2312_bin gb2312 -gb2312_chinese_ci gb2312 -gbk_bin gbk -gbk_chinese_ci gbk -geostd8_bin geostd8 -geostd8_general_ci geostd8 -greek_bin greek -greek_general_ci greek -hebrew_bin hebrew -hebrew_general_ci hebrew -hp8_bin hp8 -hp8_english_ci hp8 -keybcs2_bin keybcs2 -keybcs2_general_ci keybcs2 -koi8r_bin koi8r -koi8r_general_ci koi8r -koi8u_bin koi8u -koi8u_general_ci koi8u -latin1_bin latin1 -latin1_danish_ci latin1 -latin1_general_ci latin1 -latin1_general_cs latin1 -latin1_german1_ci latin1 -latin1_german2_ci latin1 -latin1_spanish_ci latin1 -latin1_swedish_ci latin1 -latin2_bin latin2 -latin2_croatian_ci latin2 -latin2_czech_cs latin2 -latin2_general_ci latin2 -latin2_hungarian_ci latin2 -latin5_bin latin5 -latin5_turkish_ci latin5 -latin7_bin latin7 -latin7_estonian_cs latin7 -latin7_general_ci latin7 -latin7_general_cs latin7 -macce_bin macce -macce_general_ci macce -macroman_bin macroman -macroman_general_ci macroman -sjis_bin sjis -sjis_japanese_ci sjis -swe7_bin swe7 -swe7_swedish_ci swe7 -tis620_bin tis620 -tis620_thai_ci tis620 -ucs2_bin ucs2 -ucs2_czech_ci ucs2 -ucs2_danish_ci ucs2 -ucs2_esperanto_ci ucs2 -ucs2_estonian_ci ucs2 -ucs2_general_ci ucs2 -ucs2_hungarian_ci ucs2 -ucs2_icelandic_ci ucs2 -ucs2_latvian_ci ucs2 -ucs2_lithuanian_ci ucs2 -ucs2_persian_ci ucs2 -ucs2_polish_ci ucs2 -ucs2_romanian_ci ucs2 -ucs2_roman_ci ucs2 -ucs2_slovak_ci ucs2 -ucs2_slovenian_ci ucs2 -ucs2_spanish2_ci ucs2 -ucs2_spanish_ci ucs2 -ucs2_swedish_ci ucs2 -ucs2_turkish_ci ucs2 -ucs2_unicode_ci ucs2 -ujis_bin ujis -ujis_japanese_ci ujis -utf8_bin utf8 -utf8_czech_ci utf8 -utf8_danish_ci utf8 -utf8_esperanto_ci utf8 -utf8_estonian_ci utf8 -utf8_general_ci utf8 -utf8_general_cs utf8 -utf8_hungarian_ci utf8 -utf8_icelandic_ci utf8 -utf8_latvian_ci utf8 -utf8_lithuanian_ci utf8 -utf8_persian_ci utf8 -utf8_polish_ci utf8 -utf8_romanian_ci utf8 -utf8_roman_ci utf8 -utf8_slovak_ci utf8 -utf8_slovenian_ci utf8 -utf8_spanish2_ci utf8 -utf8_spanish_ci utf8 -utf8_swedish_ci utf8 -utf8_turkish_ci utf8 -utf8_unicode_ci utf8 -# Switch to connection default + disconnect con -DROP USER dbdict_test@localhost; diff --git a/mysql-test/suite/funcs_1/r/charset_collation_3.result b/mysql-test/suite/funcs_1/r/charset_collation_3.result deleted file mode 100644 index b9a2dbe8a98..00000000000 --- a/mysql-test/suite/funcs_1/r/charset_collation_3.result +++ /dev/null @@ -1,309 +0,0 @@ -DROP USER dbdict_test@localhost; -CREATE USER dbdict_test@localhost; -# Establish connection con (user=dbdict_test) - -SELECT * -FROM information_schema.character_sets -ORDER BY character_set_name; -CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN -armscii8 armscii8_general_ci ARMSCII-8 Armenian 1 -ascii ascii_general_ci US ASCII 1 -big5 big5_chinese_ci Big5 Traditional Chinese 2 -binary binary Binary pseudo charset 1 -cp1250 cp1250_general_ci Windows Central European 1 -cp1251 cp1251_general_ci Windows Cyrillic 1 -cp1256 cp1256_general_ci Windows Arabic 1 -cp1257 cp1257_general_ci Windows Baltic 1 -cp850 cp850_general_ci DOS West European 1 -cp852 cp852_general_ci DOS Central European 1 -cp866 cp866_general_ci DOS Russian 1 -cp932 cp932_japanese_ci SJIS for Windows Japanese 2 -dec8 dec8_swedish_ci DEC West European 1 -eucjpms eucjpms_japanese_ci UJIS for Windows Japanese 3 -euckr euckr_korean_ci EUC-KR Korean 2 -gb2312 gb2312_chinese_ci GB2312 Simplified Chinese 2 -gbk gbk_chinese_ci GBK Simplified Chinese 2 -geostd8 geostd8_general_ci GEOSTD8 Georgian 1 -greek greek_general_ci ISO 8859-7 Greek 1 -hebrew hebrew_general_ci ISO 8859-8 Hebrew 1 -hp8 hp8_english_ci HP West European 1 -keybcs2 keybcs2_general_ci DOS Kamenicky Czech-Slovak 1 -koi8r koi8r_general_ci KOI8-R Relcom Russian 1 -koi8u koi8u_general_ci KOI8-U Ukrainian 1 -latin1 latin1_swedish_ci cp1252 West European 1 -latin2 latin2_general_ci ISO 8859-2 Central European 1 -latin5 latin5_turkish_ci ISO 8859-9 Turkish 1 -latin7 latin7_general_ci ISO 8859-13 Baltic 1 -macce macce_general_ci Mac Central European 1 -macroman macroman_general_ci Mac West European 1 -sjis sjis_japanese_ci Shift-JIS Japanese 2 -swe7 swe7_swedish_ci 7bit Swedish 1 -tis620 tis620_thai_ci TIS620 Thai 1 -ucs2 ucs2_general_ci UCS-2 Unicode 2 -ujis ujis_japanese_ci EUC-JP Japanese 3 -utf8 utf8_general_ci UTF-8 Unicode 3 - -SELECT * -FROM information_schema.collations -ORDER BY collation_name; -COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN -armscii8_bin armscii8 64 Yes 1 -armscii8_general_ci armscii8 32 Yes Yes 1 -ascii_bin ascii 65 Yes 1 -ascii_general_ci ascii 11 Yes Yes 1 -big5_bin big5 84 Yes 1 -big5_chinese_ci big5 1 Yes Yes 1 -binary binary 63 Yes Yes 1 -cp1250_bin cp1250 66 Yes 1 -cp1250_croatian_ci cp1250 44 Yes 1 -cp1250_czech_cs cp1250 34 Yes 2 -cp1250_general_ci cp1250 26 Yes Yes 1 -cp1251_bin cp1251 50 Yes 1 -cp1251_bulgarian_ci cp1251 14 Yes 1 -cp1251_general_ci cp1251 51 Yes Yes 1 -cp1251_general_cs cp1251 52 Yes 1 -cp1251_ukrainian_ci cp1251 23 Yes 1 -cp1256_bin cp1256 67 Yes 1 -cp1256_general_ci cp1256 57 Yes Yes 1 -cp1257_bin cp1257 58 Yes 1 -cp1257_general_ci cp1257 59 Yes Yes 1 -cp1257_lithuanian_ci cp1257 29 Yes 1 -cp850_bin cp850 80 Yes 1 -cp850_general_ci cp850 4 Yes Yes 1 -cp852_bin cp852 81 Yes 1 -cp852_general_ci cp852 40 Yes Yes 1 -cp866_bin cp866 68 Yes 1 -cp866_general_ci cp866 36 Yes Yes 1 -cp932_bin cp932 96 Yes 1 -cp932_japanese_ci cp932 95 Yes Yes 1 -dec8_bin dec8 69 Yes 1 -dec8_swedish_ci dec8 3 Yes Yes 1 -eucjpms_bin eucjpms 98 Yes 1 -eucjpms_japanese_ci eucjpms 97 Yes Yes 1 -euckr_bin euckr 85 Yes 1 -euckr_korean_ci euckr 19 Yes Yes 1 -gb2312_bin gb2312 86 Yes 1 -gb2312_chinese_ci gb2312 24 Yes Yes 1 -gbk_bin gbk 87 Yes 1 -gbk_chinese_ci gbk 28 Yes Yes 1 -geostd8_bin geostd8 93 Yes 1 -geostd8_general_ci geostd8 92 Yes Yes 1 -greek_bin greek 70 Yes 1 -greek_general_ci greek 25 Yes Yes 1 -hebrew_bin hebrew 71 Yes 1 -hebrew_general_ci hebrew 16 Yes Yes 1 -hp8_bin hp8 72 Yes 1 -hp8_english_ci hp8 6 Yes Yes 1 -keybcs2_bin keybcs2 73 Yes 1 -keybcs2_general_ci keybcs2 37 Yes Yes 1 -koi8r_bin koi8r 74 Yes 1 -koi8r_general_ci koi8r 7 Yes Yes 1 -koi8u_bin koi8u 75 Yes 1 -koi8u_general_ci koi8u 22 Yes Yes 1 -latin1_bin latin1 47 Yes 1 -latin1_danish_ci latin1 15 Yes 1 -latin1_general_ci latin1 48 Yes 1 -latin1_general_cs latin1 49 Yes 1 -latin1_german1_ci latin1 5 Yes 1 -latin1_german2_ci latin1 31 Yes 2 -latin1_spanish_ci latin1 94 Yes 1 -latin1_swedish_ci latin1 8 Yes Yes 1 -latin2_bin latin2 77 Yes 1 -latin2_croatian_ci latin2 27 Yes 1 -latin2_czech_cs latin2 2 Yes 4 -latin2_general_ci latin2 9 Yes Yes 1 -latin2_hungarian_ci latin2 21 Yes 1 -latin5_bin latin5 78 Yes 1 -latin5_turkish_ci latin5 30 Yes Yes 1 -latin7_bin latin7 79 Yes 1 -latin7_estonian_cs latin7 20 Yes 1 -latin7_general_ci latin7 41 Yes Yes 1 -latin7_general_cs latin7 42 Yes 1 -macce_bin macce 43 Yes 1 -macce_general_ci macce 38 Yes Yes 1 -macroman_bin macroman 53 Yes 1 -macroman_general_ci macroman 39 Yes Yes 1 -sjis_bin sjis 88 Yes 1 -sjis_japanese_ci sjis 13 Yes Yes 1 -swe7_bin swe7 82 Yes 1 -swe7_swedish_ci swe7 10 Yes Yes 1 -tis620_bin tis620 89 Yes 1 -tis620_thai_ci tis620 18 Yes Yes 4 -ucs2_bin ucs2 90 Yes 1 -ucs2_czech_ci ucs2 138 Yes 8 -ucs2_danish_ci ucs2 139 Yes 8 -ucs2_esperanto_ci ucs2 145 Yes 8 -ucs2_estonian_ci ucs2 134 Yes 8 -ucs2_general_ci ucs2 35 Yes Yes 1 -ucs2_hungarian_ci ucs2 146 Yes 8 -ucs2_icelandic_ci ucs2 129 Yes 8 -ucs2_latvian_ci ucs2 130 Yes 8 -ucs2_lithuanian_ci ucs2 140 Yes 8 -ucs2_persian_ci ucs2 144 Yes 8 -ucs2_polish_ci ucs2 133 Yes 8 -ucs2_romanian_ci ucs2 131 Yes 8 -ucs2_roman_ci ucs2 143 Yes 8 -ucs2_slovak_ci ucs2 141 Yes 8 -ucs2_slovenian_ci ucs2 132 Yes 8 -ucs2_spanish2_ci ucs2 142 Yes 8 -ucs2_spanish_ci ucs2 135 Yes 8 -ucs2_swedish_ci ucs2 136 Yes 8 -ucs2_turkish_ci ucs2 137 Yes 8 -ucs2_unicode_ci ucs2 128 Yes 8 -ujis_bin ujis 91 Yes 1 -ujis_japanese_ci ujis 12 Yes Yes 1 -utf8_bin utf8 83 Yes 1 -utf8_czech_ci utf8 202 Yes 8 -utf8_danish_ci utf8 203 Yes 8 -utf8_esperanto_ci utf8 209 Yes 8 -utf8_estonian_ci utf8 198 Yes 8 -utf8_general_ci utf8 33 Yes Yes 1 -utf8_hungarian_ci utf8 210 Yes 8 -utf8_icelandic_ci utf8 193 Yes 8 -utf8_latvian_ci utf8 194 Yes 8 -utf8_lithuanian_ci utf8 204 Yes 8 -utf8_persian_ci utf8 208 Yes 8 -utf8_polish_ci utf8 197 Yes 8 -utf8_romanian_ci utf8 195 Yes 8 -utf8_roman_ci utf8 207 Yes 8 -utf8_slovak_ci utf8 205 Yes 8 -utf8_slovenian_ci utf8 196 Yes 8 -utf8_spanish2_ci utf8 206 Yes 8 -utf8_spanish_ci utf8 199 Yes 8 -utf8_swedish_ci utf8 200 Yes 8 -utf8_turkish_ci utf8 201 Yes 8 -utf8_unicode_ci utf8 192 Yes 8 - - -SELECT * -FROM information_schema.collation_character_set_applicability -ORDER BY collation_name, character_set_name; -COLLATION_NAME CHARACTER_SET_NAME -armscii8_bin armscii8 -armscii8_general_ci armscii8 -ascii_bin ascii -ascii_general_ci ascii -big5_bin big5 -big5_chinese_ci big5 -binary binary -cp1250_bin cp1250 -cp1250_croatian_ci cp1250 -cp1250_czech_cs cp1250 -cp1250_general_ci cp1250 -cp1251_bin cp1251 -cp1251_bulgarian_ci cp1251 -cp1251_general_ci cp1251 -cp1251_general_cs cp1251 -cp1251_ukrainian_ci cp1251 -cp1256_bin cp1256 -cp1256_general_ci cp1256 -cp1257_bin cp1257 -cp1257_general_ci cp1257 -cp1257_lithuanian_ci cp1257 -cp850_bin cp850 -cp850_general_ci cp850 -cp852_bin cp852 -cp852_general_ci cp852 -cp866_bin cp866 -cp866_general_ci cp866 -cp932_bin cp932 -cp932_japanese_ci cp932 -dec8_bin dec8 -dec8_swedish_ci dec8 -eucjpms_bin eucjpms -eucjpms_japanese_ci eucjpms -euckr_bin euckr -euckr_korean_ci euckr -gb2312_bin gb2312 -gb2312_chinese_ci gb2312 -gbk_bin gbk -gbk_chinese_ci gbk -geostd8_bin geostd8 -geostd8_general_ci geostd8 -greek_bin greek -greek_general_ci greek -hebrew_bin hebrew -hebrew_general_ci hebrew -hp8_bin hp8 -hp8_english_ci hp8 -keybcs2_bin keybcs2 -keybcs2_general_ci keybcs2 -koi8r_bin koi8r -koi8r_general_ci koi8r -koi8u_bin koi8u -koi8u_general_ci koi8u -latin1_bin latin1 -latin1_danish_ci latin1 -latin1_general_ci latin1 -latin1_general_cs latin1 -latin1_german1_ci latin1 -latin1_german2_ci latin1 -latin1_spanish_ci latin1 -latin1_swedish_ci latin1 -latin2_bin latin2 -latin2_croatian_ci latin2 -latin2_czech_cs latin2 -latin2_general_ci latin2 -latin2_hungarian_ci latin2 -latin5_bin latin5 -latin5_turkish_ci latin5 -latin7_bin latin7 -latin7_estonian_cs latin7 -latin7_general_ci latin7 -latin7_general_cs latin7 -macce_bin macce -macce_general_ci macce -macroman_bin macroman -macroman_general_ci macroman -sjis_bin sjis -sjis_japanese_ci sjis -swe7_bin swe7 -swe7_swedish_ci swe7 -tis620_bin tis620 -tis620_thai_ci tis620 -ucs2_bin ucs2 -ucs2_czech_ci ucs2 -ucs2_danish_ci ucs2 -ucs2_esperanto_ci ucs2 -ucs2_estonian_ci ucs2 -ucs2_general_ci ucs2 -ucs2_hungarian_ci ucs2 -ucs2_icelandic_ci ucs2 -ucs2_latvian_ci ucs2 -ucs2_lithuanian_ci ucs2 -ucs2_persian_ci ucs2 -ucs2_polish_ci ucs2 -ucs2_romanian_ci ucs2 -ucs2_roman_ci ucs2 -ucs2_slovak_ci ucs2 -ucs2_slovenian_ci ucs2 -ucs2_spanish2_ci ucs2 -ucs2_spanish_ci ucs2 -ucs2_swedish_ci ucs2 -ucs2_turkish_ci ucs2 -ucs2_unicode_ci ucs2 -ujis_bin ujis -ujis_japanese_ci ujis -utf8_bin utf8 -utf8_czech_ci utf8 -utf8_danish_ci utf8 -utf8_esperanto_ci utf8 -utf8_estonian_ci utf8 -utf8_general_ci utf8 -utf8_hungarian_ci utf8 -utf8_icelandic_ci utf8 -utf8_latvian_ci utf8 -utf8_lithuanian_ci utf8 -utf8_persian_ci utf8 -utf8_polish_ci utf8 -utf8_romanian_ci utf8 -utf8_roman_ci utf8 -utf8_slovak_ci utf8 -utf8_slovenian_ci utf8 -utf8_spanish2_ci utf8 -utf8_spanish_ci utf8 -utf8_swedish_ci utf8 -utf8_turkish_ci utf8 -utf8_unicode_ci utf8 -# Switch to connection default + disconnect con -DROP USER dbdict_test@localhost; diff --git a/mysql-test/suite/funcs_1/datadict/charset_collation.inc b/mysql-test/suite/funcs_1/t/charset_collation.test index ae03996b073..186eb1f5b85 100644 --- a/mysql-test/suite/funcs_1/datadict/charset_collation.inc +++ b/mysql-test/suite/funcs_1/t/charset_collation.test @@ -1,58 +1,16 @@ -# suite/funcs_1/datadict/charset_collation.inc +# suite/funcs_1/t/charset_collation.test # # Tests checking the content of the information_schema tables # character_sets # collations # collation_character_set_applicability # -# -# The amount and properties of character_sets/collations depend on the -# build type -# 2007-12 MySQL 5.0, 2008-06 MySQL 5.1 -# --------------------------------------------------------------------- -# -# Variant 1 fits to -# version_comment MySQL Enterprise Server (Commercial) -# version_comment MySQL Enterprise Server (GPL) -# version_comment MySQL Classic Server (Commercial) -# version_comment MySQL Pushbuild Edition, build <number> -# (version_comment Source distribution -# and -# compile was without "max" - > no collation 'utf8_general_ci') -# -# Variant 2 fits to -# version_comment MySQL Enterprise Server (GPL) -# version_comment MySQL Classic Server (Commercial) -# version_comment MySQL Pushbuild Edition, build <number> -# (version_comment Source distribution -# and -# compile was without "max" - > collation 'utf8_general_ci' exists) -# -# Difference between variant 1 and 2 is the collation 'utf8_general_ci'. -# -# Variant 3 fits to -# version_comment MySQL Community Server (GPL) -# version_comment MySQL Cluster Server (Commercial) -# version_comment MySQL Advanced Server (GPL) 5.1 -# version_comment MySQL Advanced Server (Commercial) 5.1 -# -# Difference between variant 3 and 2 is within the collation properties -# IS_COMPILED and SORTLEN. -# -# 2008-06 All time excluded variant is "vanilla". -# How to build "vanilla": -# ./BUILD/autorun.sh -# ./configure -# ./make -# Some properties of "vanilla" -# version_comment Source distribution -# Compared to the variants 1 to 3 a lot of character sets are missing. -# Example: "ucs2_bin" is in variant 1 to 3 but not in "vanilla". -# # Created: -# 2007-12-18 mleich - remove the unstable character_set/collation subtests -# from include/datadict-master.inc -# - create this new test +# 2009-04-28 mleich Replace the charset_collation_* test which failed too often +# because of changes +# - in general available character sets and collations +# - in build types +# (Bug#40545, Bug#40209, Bug#40618, Bug#38346) # # Create a low privileged user. @@ -61,7 +19,6 @@ DROP USER dbdict_test@localhost; CREATE USER dbdict_test@localhost; --echo # Establish connection con (user=dbdict_test) ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (con,localhost,dbdict_test,,); ################################################################################ # @@ -97,32 +54,48 @@ connect (con,localhost,dbdict_test,,); # combinations for which the current user and PUBLIC have no # USAGE privilege. # -# Notes (2007-12-19 mleich): +# Notes (2009-04-28 mleich): # - The requirements are outdated because grant/revoke privilege for using a # characterset/collation were never implemented. -# Therefore the tests should simply check the content of these tables. -# +# Therefore the tests focus on the completeness and correctness of the +# content (rows and columns) of these tables. # - The amount of collations/character sets grows with new MySQL releases. -# -# - Even within the same release the amount of records within these tables +# Even within the same release the amount of records within these tables # can differ between different build types (community, enterprise, source,...) -# +# Therefore we limit the queries to character sets and collations which +# - exist in all build types +# - have in all build types the same "state". +# The character set +# - utf8 is used for Metadata +# - ascii is a quite usual +# The collations <character set>_general_ci and <character set>_bin seem +# to be available all time. # ################################################################################ + +let $char_set_condition= character_set_name IN ('utf8','latin1','binary'); +let $collation_condition= + (collation_name LIKE CONCAT(character_set_name,'_general_ci') + OR + collation_name LIKE CONCAT(character_set_name,'_bin')); --echo -SELECT * +eval SELECT * FROM information_schema.character_sets +WHERE $char_set_condition ORDER BY character_set_name; --echo -SELECT * +eval SELECT * FROM information_schema.collations +WHERE $char_set_condition + AND $collation_condition ORDER BY collation_name; -echo; --echo -SELECT * +eval SELECT * FROM information_schema.collation_character_set_applicability +WHERE $char_set_condition + AND $collation_condition ORDER BY collation_name, character_set_name; diff --git a/mysql-test/suite/funcs_1/t/charset_collation_1.test b/mysql-test/suite/funcs_1/t/charset_collation_1.test deleted file mode 100644 index 15777062a72..00000000000 --- a/mysql-test/suite/funcs_1/t/charset_collation_1.test +++ /dev/null @@ -1,32 +0,0 @@ -# Tests checking the content of the information_schema tables -# character_sets -# collations -# collation_character_set_applicability -# -# Content variant 1 which should fit to -# Enterprise or Classic builds (binaries provided by MySQL) -# Pushbuilds -# Source builds without "max" -# -# Please read suite/funcs_1/datadict/charset_collation.inc for -# additional information. -# -# Created: -# 2007-12-18 mleich - remove the unstable character_set/collation subtests -# from include/datadict-master.inc -# - create this new test -# - -if (`SELECT EXISTS (SELECT 1 FROM information_schema.collations - WHERE collation_name = 'utf8_general_cs') - OR ( @@version_comment NOT LIKE '%Source%' - AND @@version_comment NOT LIKE '%Enterprise%' - AND @@version_comment NOT LIKE '%Classic%' - AND @@version_comment NOT LIKE '%Pushbuild%') - OR (SELECT count(*) = 0 FROM information_schema.collations - WHERE collation_name = 'ucs2_bin')`) -{ - skip Test needs Enterprise, Classic , regular Pushbuild or Source-without-max build; -} - ---source suite/funcs_1/datadict/charset_collation.inc diff --git a/mysql-test/suite/funcs_1/t/charset_collation_2.test b/mysql-test/suite/funcs_1/t/charset_collation_2.test deleted file mode 100644 index d4924953b7d..00000000000 --- a/mysql-test/suite/funcs_1/t/charset_collation_2.test +++ /dev/null @@ -1,24 +0,0 @@ -# Tests checking the content of the information_schema tables -# character_sets -# collations -# collation_character_set_applicability -# -# Content variant 2 (compile from source with "max") -# -# Please read suite/funcs_1/datadict/charset_collation.inc for -# additional information. -# -# Created: -# 2007-12-18 mleich - remove the unstable character_set/collation subtests -# from include/datadict-master.inc -# - create this new test -# - -if (`SELECT @@version_comment NOT LIKE '%Source%' - OR NOT EXISTS (SELECT 1 FROM information_schema.collations - WHERE collation_name = 'utf8_general_cs')`) -{ - skip Test needs Source build with "max"; -} - ---source suite/funcs_1/datadict/charset_collation.inc diff --git a/mysql-test/suite/funcs_1/t/charset_collation_3.test b/mysql-test/suite/funcs_1/t/charset_collation_3.test deleted file mode 100644 index e88b44e4a0f..00000000000 --- a/mysql-test/suite/funcs_1/t/charset_collation_3.test +++ /dev/null @@ -1,25 +0,0 @@ -# Tests checking the content of the information_schema tables -# character_sets -# collations -# collation_character_set_applicability -# -# Content variant 3 which should fit to -# Community and Cluster builds (binaries provided by MySQL) -# -# Please read suite/funcs_1/datadict/charset_collation.inc for -# additional information. -# -# Created: -# 2007-12-18 mleich - remove the unstable character_set/collation subtests -# from include/datadict-master.inc -# - create this new test -# - -if (`SELECT @@version_comment NOT LIKE '%Community%' - AND @@version_comment NOT LIKE '%Cluster%' - AND @@version_comment NOT LIKE '%Advanced%'`) -{ - skip Test needs Community, Cluster or Advanced build; -} - ---source suite/funcs_1/datadict/charset_collation.inc diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index da7b4f70a46..062667c249e 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -18,3 +18,10 @@ im_options_unset : Bug#20294: Instance manager tests fail randomly im_utils : Bug#20294: Instance manager tests fail randomly rpl_log_pos : Bug#8693 Test 'rpl_log_pos' fails sometimes kill : Bug#29149 Test "kill" fails on Windows +ps_7ndb : Bug#38315 "Cluster Failure" in ps_7ndb +strict_autoinc_5ndb : Bug#35148 "Error '4009 Cluster Failure' in various tests on various platforms" +rpl_slave_skip : Bug#45521: rpl_slave_skip fails in pb2 +loaddata_autocom_ndb : Bug#35148: Error '4009 Cluster Failure' in various tests on various platforms +ndb_autodiscover3 : Bug#35148: Error '4009 Cluster Failure' in various tests on various platforms +ndb_autodiscover : Bug#45972: ndb.ndb_autodiscover fails occasionally with pb2 +ndb_autodiscover2 : Bug#45972: ndb.ndb_autodiscover fails occasionally with pb2 diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index c84f22c5595..2ee222c6a10 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -43,8 +43,10 @@ drop table t1; # note that when LOW_MEMORY is set the "test" below is meaningless # -set @@max_allowed_packet=1048576*100; +set @@global.max_allowed_packet=1048576*100; --replace_result "''" XXX "'1'" XXX +# reconnect to make the new max packet size take effect +--connect (newconn, localhost, root,,) eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null; # diff --git a/mysql-test/t/innodb_bug40565.test b/mysql-test/t/innodb_bug40565.test new file mode 100644 index 00000000000..d7aa0fd514a --- /dev/null +++ b/mysql-test/t/innodb_bug40565.test @@ -0,0 +1,10 @@ +# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows" +-- source include/have_innodb.inc + +create table bug40565(value decimal(4,2)) engine=innodb; +insert into bug40565 values (1), (null); +--enable_info +update bug40565 set value=NULL; +update bug40565 set value=NULL; +--disable_info +drop table bug40565; diff --git a/mysql-test/t/lock_multi_bug38499.test b/mysql-test/t/lock_multi_bug38499.test index 8178987e802..def58187ced 100644 --- a/mysql-test/t/lock_multi_bug38499.test +++ b/mysql-test/t/lock_multi_bug38499.test @@ -1,6 +1,7 @@ # Bug38499 flush tables and multitable table update with derived table cause crash # MySQL >= 5.0 # +--source include/big_test.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc diff --git a/mysql-test/t/mysql-bug45236.test b/mysql-test/t/mysql-bug45236.test new file mode 100644 index 00000000000..efc10ed19ea --- /dev/null +++ b/mysql-test/t/mysql-bug45236.test @@ -0,0 +1,45 @@ +# +# Bug #45236: large blob inserts from mysqldump fail, possible memory issue ? +# +# This test consumes a significant amount of resources. +# Therefore it should be kept separated from other tests. +# Otherwise we might suffer from problems like +# Bug#43801 mysql.test takes too long, fails due to expired timeout +# on debx86-b in PB +# + +-- source include/not_embedded.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# Have to change the global variable as the session variable is +# read-only. +SET @old_max_allowed_packet= @@global.max_allowed_packet; +# ~1 MB blob length + some space for the rest of INSERT query +SET @@global.max_allowed_packet = 1024 * 1024 + 1024; + +# Create a new connection since the global max_allowed_packet +# has no effect onr the current one +connect (con1, localhost, root,,); + +CREATE TABLE t1(data LONGBLOB); +INSERT INTO t1 SELECT CONCAT(REPEAT('1', 1024*1024 - 27), + "\'\r dummydb dummyhost"); + +let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql; +--error 0,1 +remove_file $outfile; +--exec $MYSQL_DUMP --compact -t test t1 > $outfile +# Check that the mysql client does not interpret the "\r" sequence as a command +--exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1 + +DROP TABLE t1; + +# Cleanup +disconnect con1; +--source include/wait_until_disconnected.inc +remove_file $outfile; +connection default; +SET @@global.max_allowed_packet = @old_max_allowed_packet; diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test index 6210e9986ad..7e08a0f6c3f 100644 --- a/mysql-test/t/packet.test +++ b/mysql-test/t/packet.test @@ -15,31 +15,33 @@ set @max_allowed_packet=@@global.max_allowed_packet; set @net_buffer_length=@@global.net_buffer_length; -connect (con1,localhost,root,,); -connection con1; + +# setting values below minimum threshold of 1024 will cause truncating set global max_allowed_packet=100; -set max_allowed_packet=100; set global net_buffer_length=100; -set net_buffer_length=100; -# Have to be > 1024 as min value of net_buffer_length is 1024 + +# is not yet in effect SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; -# Should return NULL as 2000 is bigger than max_allowed_packet select repeat('a',2000); -connection default; -disconnect con1; # -# Connection 2 should get error for too big packets +# Connection 1 should get error for too big packets # -connect (con2,localhost,root,,); -connection con2; +connect (con1,localhost,root,,); +connection con1; select @@net_buffer_length, @@max_allowed_packet; --error ER_NET_PACKET_TOO_LARGE SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +connection default; +disconnect con1; + +# +# Reset to default values and reconnect +# set global max_allowed_packet=default; -set max_allowed_packet=default; set global net_buffer_length=default; -set net_buffer_length=default; +connect (con2,localhost,root,,); +connection con2; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; select length(repeat('a',2000)); connection default; diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index f045257d279..6ac6729e662 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -7,6 +7,9 @@ # accepted). The old name could be removed in 5.1 or 6.0. source include/master-slave.inc; +# Save the current value and restore at end of testing +let $log_bin_trust_function_creators= + `SELECT @@global.log_bin_trust_function_creators`; # we need a db != test, where we don't have automatic grants --disable_warnings @@ -629,3 +632,10 @@ use test; drop procedure mysqltestbug36570_p1; drop procedure ` mysqltestbug36570_p2`; drop function mysqltestbug36570_f1; + +# Cleanup +sync_slave_with_master; +# Restore the initial value of log_bin_trust_function_creators +eval +set global log_bin_trust_function_creators = $log_bin_trust_function_creators; + diff --git a/mysql-test/t/sp-fib.test b/mysql-test/t/sp-fib.test index e6682395a2c..24a51b99c2d 100644 --- a/mysql-test/t/sp-fib.test +++ b/mysql-test/t/sp-fib.test @@ -22,13 +22,14 @@ begin begin declare x, y bigint unsigned; declare c cursor for select f from t3 order by f desc limit 2; - open c; fetch c into y; fetch c into x; - close c; insert into t3 values (x+y); call fib(n-1); + ## Close the cursor AFTER the recursion to ensure that the stack + ## frame is somewhat intact. + close c; end; end if; end| @@ -36,24 +37,17 @@ end| # Enable recursion set @@max_sp_recursion_depth= 20| -# Minimum test: recursion of 3 levels - insert into t3 values (0), (1)| -call fib(3)| +# The small number of recursion levels is intentional. +# We need to avoid +# Bug#15866 main.sp fails (thread stack limit +# insufficient for recursive call "fib(20)") +# which affects some platforms. +call fib(4)| select * from t3 order by f asc| -delete from t3| - -# The original test, 20 levels, ran into memory limits on some machines -# and builds. Try 10 instead... - -insert into t3 values (0), (1)| - -call fib(10)| - -select * from t3 order by f asc| drop table t3| drop procedure fib| set @@max_sp_recursion_depth= 0| diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 424776dfda4..91f75cf6cd4 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -131,17 +131,22 @@ show global variables like 'myisam_max_sort_file_size'; set global net_retry_count=10, session net_retry_count=10; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; -set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; +set session net_write_timeout=500, net_read_timeout=600; show global variables like 'net_%'; show session variables like 'net_%'; -set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; +set global net_buffer_length=8000, net_read_timeout=900, net_write_timeout=1000; show global variables like 'net_%'; show session variables like 'net_%'; -set net_buffer_length=1; -show variables like 'net_buffer_length'; +set global net_buffer_length=1; +show global variables like 'net_buffer_length'; #warning 1292 -set net_buffer_length=2000000000; -show variables like 'net_buffer_length'; +set global net_buffer_length=2000000000; +show global variables like 'net_buffer_length'; + +--error ER_UNKNOWN_ERROR +set session net_buffer_length=1024; +--error ER_UNKNOWN_ERROR +set session max_allowed_packet=1024; set character set cp1251_koi8; show variables like "character_set_client"; @@ -272,7 +277,7 @@ set last_insert_id=1; set global local_infile=1; set long_query_time=100; set low_priority_updates=1; -set max_allowed_packet=100; +set global max_allowed_packet=100; set global max_binlog_cache_size=100; set global max_binlog_size=100; set global max_connect_errors=100; @@ -286,7 +291,7 @@ set global max_user_connections=100; select @@max_user_connections; set global max_write_lock_count=100; set myisam_sort_buffer_size=100; -set net_buffer_length=100; +set global net_buffer_length=100; set net_read_timeout=100; set net_write_timeout=100; set global query_cache_limit=100; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 89e68e4bd99..6f03ff12448 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3703,6 +3703,38 @@ DROP TABLE t1; --echo # -- End of test case for Bug#40825 --echo +--echo # +--echo # Bug #45806 crash when replacing into a view with a join! +--echo # +CREATE TABLE t1(a INT UNIQUE); +CREATE VIEW v1 AS SELECT t1.a FROM t1, t1 AS a; +INSERT INTO t1 VALUES (1), (2); + +REPLACE INTO v1(a) SELECT 1 FROM t1,t1 AS c; +SELECT * FROM v1; +REPLACE INTO v1(a) SELECT 3 FROM t1,t1 AS c; +SELECT * FROM v1; +DELETE FROM t1 WHERE a=3; +INSERT INTO v1(a) SELECT 1 FROM t1,t1 AS c +ON DUPLICATE KEY UPDATE `v1`.`a`= 1; +SELECT * FROM v1; + +CREATE VIEW v2 AS SELECT t1.a FROM t1, v1 AS a; + +REPLACE INTO v2(a) SELECT 1 FROM t1,t1 AS c; +SELECT * FROM v2; +REPLACE INTO v2(a) SELECT 3 FROM t1,t1 AS c; +SELECT * FROM v2; +INSERT INTO v2(a) SELECT 1 FROM t1,t1 AS c +ON DUPLICATE KEY UPDATE `v2`.`a`= 1; +SELECT * FROM v2; + +DROP VIEW v1; +DROP VIEW v2; +DROP TABLE t1; + +--echo # -- End of test case for Bug#45806 + --echo # ----------------------------------------------------------------- --echo # -- End of 5.0 tests. --echo # ----------------------------------------------------------------- diff --git a/mysys/hash.c b/mysys/hash.c index 9e8404248eb..4aab75609f4 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -45,6 +45,32 @@ static uint calc_hash(const HASH *hash, const byte *key, uint length) return nr1; } +/** + @brief Initialize the hash + + @details + + Initialize the hash, by defining and giving valid values for + its elements. The failure to allocate memory for the + hash->array element will not result in a fatal failure. The + dynamic array that is part of the hash will allocate memory + as required during insertion. + + @param[in,out] hash The hash that is initialized + @param[in] charset The charater set information + @param[in] size The hash size + @param[in] key_offest The key offset for the hash + @param[in] key_length The length of the key used in + the hash + @param[in] get_key get the key for the hash + @param[in] free_element pointer to the function that + does cleanup + @param[in] CALLER_INFO_PROTO flag that define the behaviour + of the hash + @return inidicates success or failure of initialization + @retval 0 success + @retval 1 failure +*/ my_bool _hash_init(HASH *hash,CHARSET_INFO *charset, uint size,uint key_offset,uint key_length, @@ -55,11 +81,6 @@ _hash_init(HASH *hash,CHARSET_INFO *charset, DBUG_PRINT("enter",("hash: 0x%lx size: %d", (long) hash, size)); hash->records=0; - if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0)) - { - hash->free=0; /* Allow call to hash_free */ - DBUG_RETURN(1); - } hash->key_offset=key_offset; hash->key_length=key_length; hash->blength=1; @@ -67,7 +88,8 @@ _hash_init(HASH *hash,CHARSET_INFO *charset, hash->free=free_element; hash->flags=flags; hash->charset=charset; - DBUG_RETURN(0); + DBUG_RETURN(my_init_dynamic_array_ci(&hash->array, + sizeof(HASH_LINK), size, 0)); } @@ -113,6 +135,7 @@ void hash_free(HASH *hash) hash_free_elements(hash); hash->free= 0; delete_dynamic(&hash->array); + hash->blength= 0; DBUG_VOID_RETURN; } diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 3cb4665eb1c..a6330055f99 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -1,7 +1,7 @@ #!/usr/bin/perl use Getopt::Long; -use POSIX qw(strftime); +use POSIX qw(strftime getcwd); $|=1; $VER="2.16"; @@ -295,6 +295,7 @@ sub start_mysqlds() { @options = defaults_for_group($groups[$i]); + $basedir_found= 0; # The default $mysqld_found= 1; # The default $mysqld_found= 0 if (!length($mysqld)); $com= "$mysqld"; @@ -310,6 +311,14 @@ sub start_mysqlds() $com= $options[$j]; $mysqld_found= 1; } + elsif ("--basedir=" eq substr($options[$j], 0, 10)) + { + $basedir= $options[$j]; + $basedir =~ s/^--basedir=//; + $basedir_found= 1; + $options[$j]= quote_shell_word($options[$j]); + $tmp.= " $options[$j]"; + } else { $options[$j]= quote_shell_word($options[$j]); @@ -337,7 +346,16 @@ sub start_mysqlds() print "group [$groups[$i]] separately.\n"; exit(1); } + if ($basedir_found) + { + $curdir=getcwd(); + chdir($basedir) or die "Can't change to datadir $basedir"; + } system($com); + if ($basedir_found) + { + chdir($curdir) or die "Can't change back to original dir $curdir"; + } } if (!$i && !$opt_no_log) { diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc index 7871cad7814..cdd7ebcf04b 100644 --- a/server-tools/instance-manager/user_map.cc +++ b/server-tools/instance-manager/user_map.cc @@ -145,8 +145,8 @@ int User_map::load(const char *password_file_name) while (fgets(line, sizeof(line), file)) { /* skip comments and empty lines */ - if (line[0] == '#' || line[0] == '\n' && - (line[1] == '\0' || line[1] == '\r')) + if (line[0] == '#' || (line[0] == '\n' && + (line[1] == '\0' || line[1] == '\r'))) continue; if ((user= new User) == 0) goto done; diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h index 98cba8bf4cd..a00e8887c7e 100644 --- a/sql/examples/ha_tina.h +++ b/sql/examples/ha_tina.h @@ -29,7 +29,7 @@ typedef struct st_tina_share { THR_LOCK lock; } TINA_SHARE; -typedef struct tina_set { +struct tina_set { off_t begin; off_t end; }; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 7beb41b8ff1..630372dfac1 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -761,8 +761,8 @@ int field_conv(Field *to,Field *from) to->table->s->db_low_byte_first == from->table->s->db_low_byte_first && (!(to->table->in_use->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || - to->type() != FIELD_TYPE_DATE && - to->type() != FIELD_TYPE_DATETIME) && + (to->type() != FIELD_TYPE_DATE && + to->type() != FIELD_TYPE_DATETIME)) && (from->real_type() != MYSQL_TYPE_VARCHAR || ((Field_varstring*)from)->length_bytes == ((Field_varstring*)to)->length_bytes)) diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 6944dc5a030..9c2f73912ea 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -2596,30 +2596,27 @@ int ha_federated::info(uint flag) if (!(row= mysql_fetch_row(result))) goto error; - if (flag & HA_STATUS_VARIABLE | HA_STATUS_CONST) - { - /* - deleted is set in ha_federated::info - */ - /* - need to figure out what this means as far as federated is concerned, - since we don't have a "file" + /* + deleted is set in ha_federated::info + */ + /* + need to figure out what this means as far as federated is concerned, + since we don't have a "file" - data_file_length = ? - index_file_length = ? - delete_length = ? - */ - if (row[4] != NULL) - records= (ha_rows) my_strtoll10(row[4], (char**) 0, &error); + data_file_length = ? + index_file_length = ? + delete_length = ? + */ + if (row[4] != NULL) + records= (ha_rows) my_strtoll10(row[4], (char**) 0, &error); - mean_rec_length= table->s->reclength; - data_file_length= records * mean_rec_length; + mean_rec_length= table->s->reclength; + data_file_length= records * mean_rec_length; - if (row[12] != NULL) - update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); - if (row[13] != NULL) - check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); - } + if (row[12] != NULL) + update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); + if (row[13] != NULL) + check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); /* size of IO operations (This is based on a good guess, no high science diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index f71e891e88d..7eb6ef05d9c 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2253,6 +2253,9 @@ ha_innobase::open( ((row_prebuilt_t*)innobase_prebuilt)->mysql_row_len = table->s->reclength; + ((row_prebuilt_t*)innobase_prebuilt)->default_rec + = table->s->default_values; + ut_ad(table->s->default_values); /* Looks like MySQL-3.23 sometimes has primary key number != 0 */ diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 086b1209a7a..dadd39bb6e8 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -97,7 +97,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, if (!thd->vio_ok()) { - sql_print_error(msgbuf); + sql_print_error("%s", msgbuf); return; } diff --git a/sql/item.cc b/sql/item.cc index c20089694db..1e379527fb7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1477,8 +1477,6 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags) { set(dt); } - else - ; // Do nothing } else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) && left_is_superset(this, &dt)) diff --git a/sql/log_event.cc b/sql/log_event.cc index 3a6daadd11a..d50c7cc8111 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2257,8 +2257,8 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) fprintf(file," at startup"); fputc('\n', file); if (flags & LOG_EVENT_BINLOG_IN_USE_F) - fprintf(file, "# Warning: this binlog was not closed properly. " - "Most probably mysqld crashed writing it.\n"); + fprintf(file, "# Warning: this binlog is either in use or was not " + "closed properly.\n"); } if (!artificial_event && created) { @@ -3096,7 +3096,7 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info, { if (i) fputc(',', file); - fprintf(file, field); + fprintf(file, "%s", field); field += field_lens[i] + 1; } @@ -5203,7 +5203,7 @@ void Execute_load_query_log_event::print(FILE* file, { my_fwrite(file, (byte*) query, fn_pos_start, MYF(MY_NABP | MY_WME)); fprintf(file, " LOCAL INFILE \'"); - fprintf(file, local_fname); + fprintf(file, "%s", local_fname); fprintf(file, "\'"); if (dup_handling == LOAD_DUP_REPLACE) fprintf(file, " REPLACE"); diff --git a/sql/set_var.cc b/sql/set_var.cc index 7a85c1c0fa3..aebebb3b465 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -228,8 +228,8 @@ sys_var_thd_bool sys_sql_low_priority_updates("sql_low_priority_updates", &SV::low_priority_updates, fix_low_priority_updates); #endif -sys_var_thd_ulong sys_max_allowed_packet("max_allowed_packet", - &SV::max_allowed_packet); +sys_var_thd_ulong_session_readonly sys_max_allowed_packet("max_allowed_packet", + &SV::max_allowed_packet); sys_var_long_ptr sys_max_binlog_cache_size("max_binlog_cache_size", &max_binlog_cache_size); sys_var_long_ptr sys_max_binlog_size("max_binlog_size", @@ -296,8 +296,8 @@ sys_var_thd_enum sys_myisam_stats_method("myisam_stats_method", &myisam_stats_method_typelib, NULL); -sys_var_thd_ulong sys_net_buffer_length("net_buffer_length", - &SV::net_buffer_length); +sys_var_thd_ulong_session_readonly sys_net_buffer_length("net_buffer_length", + &SV::net_buffer_length); sys_var_thd_ulong sys_net_read_timeout("net_read_timeout", &SV::net_read_timeout, 0, fix_net_read_timeout); @@ -2948,6 +2948,21 @@ byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, } +bool sys_var_thd_ulong_session_readonly::check(THD *thd, set_var *var) +{ + if (var->type != OPT_GLOBAL) + { + /* Due to backporting, this is actually ER_VARIABLE_IS_READONLY in 5.1+ */ + my_printf_error(ER_UNKNOWN_ERROR, + "SESSION variable %s is read-only. Use SET GLOBAL %s " + "to assign the value", MYF(0), name, name); + return TRUE; + } + + return sys_var_thd_ulong::check(thd, var); +} + + bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) { MY_LOCALE *locale_match; diff --git a/sql/set_var.h b/sql/set_var.h index f43d3b75cee..5fb883e8b86 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -873,6 +873,28 @@ public: byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); }; + +/** + * @brief This is a specialization of sys_var_thd_ulong that implements a + read-only session variable. The class overrides check() and check_default() + to achieve the read-only property for the session part of the variable. + */ +class sys_var_thd_ulong_session_readonly : public sys_var_thd_ulong +{ +public: + sys_var_thd_ulong_session_readonly(const char *name_arg, ulong SV::*offset_arg, + sys_check_func c_func= NULL, + sys_after_update_func au_func= NULL): + sys_var_thd_ulong(name_arg, offset_arg, c_func, au_func) + { } + bool check(THD *thd, set_var *var); + bool check_default(enum_var_type type) + { + return type != OPT_GLOBAL || !option_limits; + } +}; + + class sys_var_trust_routine_creators :public sys_var_bool_ptr { /* We need a derived class only to have a warn_deprecated() */ diff --git a/sql/slave.cc b/sql/slave.cc index dd80b13ed46..33ce8c21963 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1435,7 +1435,7 @@ static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi) if (errmsg) { - sql_print_error(errmsg); + sql_print_error("%s", errmsg); return 1; } @@ -1558,7 +1558,7 @@ be equal for replication to work"; err: if (errmsg) { - sql_print_error(errmsg); + sql_print_error("%s", errmsg); return 1; } @@ -1968,7 +1968,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", DBUG_RETURN(error); err: - sql_print_error(msg); + sql_print_error("%s", msg); end_io_cache(&rli->info_file); if (info_fd >= 0) my_close(info_fd, MYF(0)); diff --git a/sql/spatial.h b/sql/spatial.h index 837ae153310..07aba4f925f 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -116,12 +116,12 @@ struct MBR int touches(const MBR *mbr) { /* The following should be safe, even if we compare doubles */ - return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) && - ((mbr->ymin >= ymin) && (mbr->ymin <= ymax) || - (mbr->ymax >= ymin) && (mbr->ymax <= ymax))) || - (((mbr->ymin == ymax) || (mbr->ymax == ymin)) && - ((mbr->xmin >= xmin) && (mbr->xmin <= xmax) || - (mbr->xmax >= xmin) && (mbr->xmax <= xmax)))); + return ((mbr->xmin == xmax || mbr->xmax == xmin) && + ((mbr->ymin >= ymin && mbr->ymin <= ymax) || + (mbr->ymax >= ymin && mbr->ymax <= ymax))) || + ((mbr->ymin == ymax || mbr->ymax == ymin) && + ((mbr->xmin >= xmin && mbr->xmin <= xmax) || + (mbr->xmax >= xmin && mbr->xmax <= xmax))); } int within(const MBR *mbr) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d5b79eaca4e..34d7e773ca2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1046,12 +1046,12 @@ static void acl_update_user(const char *user, const char *host, for (uint i=0 ; i < acl_users.elements ; i++) { ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*); - if (!acl_user->user && !user[0] || - acl_user->user && !strcmp(user,acl_user->user)) + if ((!acl_user->user && !user[0]) || + (acl_user->user && !strcmp(user,acl_user->user))) { - if (!acl_user->host.hostname && !host[0] || - acl_user->host.hostname && - !my_strcasecmp(system_charset_info, host, acl_user->host.hostname)) + if ((!acl_user->host.hostname && !host[0]) || + (acl_user->host.hostname && + !my_strcasecmp(system_charset_info, host, acl_user->host.hostname))) { acl_user->access=privileges; if (mqh->specified_limits & USER_RESOURCES::QUERIES_PER_HOUR) @@ -1129,16 +1129,16 @@ static void acl_update_db(const char *user, const char *host, const char *db, for (uint i=0 ; i < acl_dbs.elements ; i++) { ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*); - if (!acl_db->user && !user[0] || - acl_db->user && - !strcmp(user,acl_db->user)) + if ((!acl_db->user && !user[0]) || + (acl_db->user && + !strcmp(user,acl_db->user))) { - if (!acl_db->host.hostname && !host[0] || - acl_db->host.hostname && - !strcmp(host, acl_db->host.hostname)) + if ((!acl_db->host.hostname && !host[0]) || + (acl_db->host.hostname && + !strcmp(host, acl_db->host.hostname))) { - if (!acl_db->db && !db[0] || - acl_db->db && !strcmp(db,acl_db->db)) + if ((!acl_db->db && !db[0]) || + (acl_db->db && !strcmp(db,acl_db->db))) { if (privileges) acl_db->access=privileges; @@ -1345,8 +1345,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; VOID(pthread_mutex_lock(&acl_cache->lock)); - if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) || - ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))) + if ((host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host))) || + (ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))) { VOID(pthread_mutex_unlock(&acl_cache->lock)); return 0; // Found host @@ -1564,8 +1564,8 @@ find_acl_user(const char *host, const char *user, my_bool exact) host, acl_user->host.hostname ? acl_user->host.hostname : "")); - if (!acl_user->user && !user[0] || - acl_user->user && !strcmp(user,acl_user->user)) + if ((!acl_user->user && !user[0]) || + (acl_user->user && !strcmp(user,acl_user->user))) { if (exact ? !my_strcasecmp(system_charset_info, host, acl_user->host.hostname ? diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 4b3264069b5..7de395d8d91 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -247,7 +247,7 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) } DBUG_RETURN(0); } - for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end + for (str++; *(end - 1) == '0'; end--) ; // jump over zeros at the end if (str == end) // number was something like '123.000' { char *endpos= (char*) str; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 854e603d21a..0f86a3dd311 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1556,7 +1556,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, it can not be cloned. Emit an error for an unsupported behaviour. */ if (table->query_id == thd->query_id || - thd->prelocked_mode && table->query_id) + (thd->prelocked_mode && table->query_id)) { my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias); DBUG_RETURN(0); @@ -1610,8 +1610,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, distance > 0 - we have lock mode higher then we require distance == 0 - we have lock mode exactly which we need */ - if (best_distance < 0 && distance > best_distance || - distance >= 0 && distance < best_distance) + if ((best_distance < 0 && distance > best_distance) || + (distance >= 0 && distance < best_distance)) { best_distance= distance; best_table= table; @@ -2298,8 +2298,8 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) search= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, &state)) { - if (search->locked_by_name && wait_for_name_lock || - search->is_name_opened() && search->needs_reopen_or_name_lock()) + if ((search->locked_by_name && wait_for_name_lock) || + (search->is_name_opened() && search->needs_reopen_or_name_lock())) return 1; // Table is used } } while ((table=table->next)); @@ -5142,7 +5142,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->lex->current_select->cur_pos_in_select_list= 0; while ((item= it++)) { - if (!item->fixed && item->fix_fields(thd, it.ref()) || + if ((!item->fixed && item->fix_fields(thd, it.ref())) || (item= *(it.ref()))->check_cols(1)) { thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; @@ -5476,16 +5476,16 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, DBUG_ASSERT(tables->is_leaf_for_name_resolution()); - if (table_name && my_strcasecmp(table_alias_charset, table_name, - tables->alias) || + if ((table_name && my_strcasecmp(table_alias_charset, table_name, + tables->alias)) || (db_name && strcmp(tables->db,db_name))) continue; #ifndef NO_EMBEDDED_ACCESS_CHECKS /* Ensure that we have access rights to all fields to be inserted. */ - if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL) || - tables->view && (tables->grant.privilege & SELECT_ACL))) && - !any_privileges) + if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) || + (tables->view && (tables->grant.privilege & SELECT_ACL))) && + !any_privileges) { field_iterator.set(tables); if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator)) @@ -5539,7 +5539,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, */ if (any_privileges) { - DBUG_ASSERT(tables->field_translation == NULL && table || + DBUG_ASSERT((tables->field_translation == NULL && table) || tables->is_natural_join); DBUG_ASSERT(item->type() == Item::FIELD_ITEM); Item_field *fld= (Item_field*) item; @@ -5684,7 +5684,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, if (*conds) { thd->where="where clause"; - if (!(*conds)->fixed && (*conds)->fix_fields(thd, conds) || + if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) || (*conds)->check_cols(1)) goto err_no_arena; } @@ -5704,8 +5704,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, { /* Make a join an a expression */ thd->where="on clause"; - if (!embedded->on_expr->fixed && - embedded->on_expr->fix_fields(thd, &embedded->on_expr) || + if ((!embedded->on_expr->fixed && + embedded->on_expr->fix_fields(thd, &embedded->on_expr)) || embedded->on_expr->check_cols(1)) goto err_no_arena; select_lex->cond_count++; @@ -5860,8 +5860,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields, enum trg_event_type event) { return (fill_record(thd, fields, values, ignore_errors) || - triggers && triggers->process_triggers(thd, event, - TRG_ACTION_BEFORE, TRUE)); + (triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE))); } @@ -5955,8 +5955,8 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr, enum trg_event_type event) { return (fill_record(thd, ptr, values, ignore_errors) || - triggers && triggers->process_triggers(thd, event, - TRG_ACTION_BEFORE, TRUE)); + (triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE))); } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 79fc4872f05..30b14209a7c 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -711,7 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err) /* the error was handled or nothing deleted and no side effects return */ if (error_handled || - !thd->transaction.stmt.modified_non_trans_table && !deleted) + (!thd->transaction.stmt.modified_non_trans_table && !deleted)) DBUG_VOID_RETURN; /* Something already deleted so we have to invalidate cache */ diff --git a/sql/sql_help.cc b/sql/sql_help.cc index e369a72fa9f..93610ea22b7 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -522,7 +522,7 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol, String **end= pointers + names->elements; List_iterator<String> it(*names); - for (pos= pointers; pos!=end; (*pos++= it++)); + for (pos= pointers; pos!=end; (*pos++= it++)) ; my_qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6d63a0907df..83f3b181091 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -413,7 +413,7 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type, bool is_multi_insert) { if (duplic == DUP_UPDATE || - duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT) + (duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)) { *lock_type= TL_WRITE_DEFAULT; return; @@ -887,7 +887,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (changed) query_cache_invalidate3(thd, table_list, 1); } - if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table + if ((changed && error <= 0) + || thd->transaction.stmt.modified_non_trans_table || was_insert_delayed) { if (mysql_bin_log.is_open()) @@ -1148,6 +1149,33 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, /* + Get extra info for tables we insert into + + @param table table(TABLE object) we insert into, + might be NULL in case of view + @param table(TABLE_LIST object) or view we insert into +*/ + +static void prepare_for_positional_update(TABLE *table, TABLE_LIST *tables) +{ + if (table) + { + if(table->reginfo.lock_type != TL_WRITE_DELAYED) + table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY); + return; + } + + DBUG_ASSERT(tables->view); + List_iterator<TABLE_LIST> it(*tables->view_tables); + TABLE_LIST *tbl; + while ((tbl= it++)) + prepare_for_positional_update(tbl->table, tbl); + + return; +} + + +/* Prepare items in INSERT statement SYNOPSIS @@ -1297,9 +1325,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, Only call extra() handler method if we are not performing a DELAYED operation. It will instead be executed by delayed insert thread. */ - if ((duplic == DUP_UPDATE || duplic == DUP_REPLACE) && - (table->reginfo.lock_type != TL_WRITE_DELAYED)) - table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY); + if (duplic == DUP_UPDATE || duplic == DUP_REPLACE) + prepare_for_positional_update(table, table_list); DBUG_RETURN(FALSE); } @@ -3016,8 +3043,8 @@ bool select_insert::send_eof() We must invalidate the table in the query cache before binlog writing and ha_autocommit_or_rollback */ - - if (changed= (info.copied || info.deleted || info.updated)) + changed= (info.copied || info.deleted || info.updated); + if (changed) { query_cache_invalidate3(thd, table, 1); if (thd->transaction.stmt.modified_non_trans_table) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 436f41dd209..061a20679e7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -661,7 +661,7 @@ int MYSQLlex(void *arg, void *yythd) else #endif { - for (result_state= c; ident_map[c= yyGet()]; result_state|= c); + for (result_state= c; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; } @@ -673,7 +673,7 @@ int MYSQLlex(void *arg, void *yythd) If we find a space then this can't be an identifier. We notice this below by checking start != lex->ptr. */ - for (; state_map[c] == MY_LEX_SKIP ; c= yyGet()); + for (; state_map[c] == MY_LEX_SKIP ; c= yyGet()) ; } if (start == lip->ptr && c == '.' && ident_map[yyPeek()]) lip->next_state=MY_LEX_IDENT_SEP; @@ -782,7 +782,7 @@ int MYSQLlex(void *arg, void *yythd) else #endif { - for (result_state=0; ident_map[c= yyGet()]; result_state|= c); + for (result_state=0; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; } @@ -872,7 +872,7 @@ int MYSQLlex(void *arg, void *yythd) case MY_LEX_BIN_NUMBER: // Found b'bin-string' yyGet(); // Skip ' - while ((c= yyGet()) == '0' || c == '1'); + while ((c= yyGet()) == '0' || c == '1') ; length= (uint) (lip->ptr - lip->tok_start); // Length of bin-num + 3 if (c != '\'') return(ABORT_SYM); // Illegal hex constant @@ -1080,7 +1080,7 @@ int MYSQLlex(void *arg, void *yythd) [(global | local | session) .]variable_name */ - for (result_state= 0; ident_map[c= yyGet()]; result_state|= c); + for (result_state= 0; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; @@ -1670,7 +1670,7 @@ void st_select_lex::print_limit(THD *thd, String *str) item->substype() == Item_subselect::ALL_SUBS)) { DBUG_ASSERT(!item->fixed || - select_limit->val_int() == LL(1) && offset_limit == 0); + (select_limit->val_int() == LL(1) && offset_limit == 0)); return; } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 5b9f8ea441d..83af6d477db 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -723,9 +723,9 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, real_item= item->real_item(); - if (!read_info.enclosed && + if ((!read_info.enclosed && (enclosed_length && length == 4 && - !memcmp(pos, STRING_WITH_LEN("NULL"))) || + !memcmp(pos, STRING_WITH_LEN("NULL")))) || (length == 1 && read_info.found_null)) { @@ -1132,8 +1132,8 @@ int READ_INFO::read_field() } // End of enclosed field if followed by field_term or line_term if (chr == my_b_EOF || - chr == line_term_char && terminator(line_term_ptr, - line_term_length)) + (chr == line_term_char && terminator(line_term_ptr, + line_term_length))) { // Maybe unexpected linefeed enclosed=1; found_end_of_line=1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 507805ec0c4..bcde4a971d0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -363,7 +363,7 @@ int check_user(THD *thd, enum enum_server_command command, if (opt_secure_auth_local && passwd_len == SCRAMBLE_LENGTH_323) { net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE); - mysql_log.write(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE)); + mysql_log.write(thd, COM_CONNECT, "%s", ER(ER_NOT_SUPPORTED_AUTH_MODE)); DBUG_RETURN(-1); } if (passwd_len != 0 && @@ -500,7 +500,7 @@ int check_user(THD *thd, enum enum_server_command command, else if (res == 2) // client gave short hash, server has long hash { net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE); - mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE)); + mysql_log.write(thd,COM_CONNECT,"%s",ER(ER_NOT_SUPPORTED_AUTH_MODE)); DBUG_RETURN(-1); } net_printf_error(thd, ER_ACCESS_DENIED_ERROR, @@ -1238,7 +1238,7 @@ pthread_handler_t handle_one_connection(void *arg) decrease_user_connections(thd->user_connect); if (thd->killed || - net->vio && net->error && net->report_error) + (net->vio && net->error && net->report_error)) { statistic_increment(aborted_threads, &LOCK_status); } @@ -2096,7 +2096,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } if (check_access(thd,CREATE_ACL,db,0,1,0,is_schema_db(db))) break; - mysql_log.write(thd,command,packet); + mysql_log.write(thd, command, "%s", db); bzero(&create_info, sizeof(create_info)); mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db), &create_info, 0); @@ -2121,7 +2121,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); break; } - mysql_log.write(thd,command,db); + mysql_log.write(thd, command, "%s", db); mysql_rm_db(thd, db, 0, 0); break; } @@ -2366,11 +2366,11 @@ void log_slow_statement(THD *thd) if ((thd->start_time > thd->time_after_lock && (ulong) (thd->start_time - thd->time_after_lock) > thd->variables.long_query_time) || - (thd->server_status & + ((thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && opt_log_queries_not_using_indexes && /* == SQLCOM_END unless this is a SHOW command */ - thd->lex->orig_sql_command == SQLCOM_END) + thd->lex->orig_sql_command == SQLCOM_END)) { thd_proc_info(thd, "logging slow query"); thd->status_var.long_query_count++; @@ -2676,8 +2676,8 @@ mysql_execute_command(THD *thd) variables, but for now this is probably good enough. Don't reset warnings when executing a stored routine. */ - if ((all_tables || &lex->select_lex != lex->all_selects_list || - lex->sroutines.records) && !thd->spcont || + if (((all_tables || &lex->select_lex != lex->all_selects_list || + lex->sroutines.records) && !thd->spcont) || lex->time_zone_tables_used) mysql_reset_errors(thd, 0); @@ -5641,7 +5641,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (schema_db) { - if (!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL) || + if ((!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL)) || (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) { if (!no_errors) @@ -5678,7 +5678,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, DBUG_RETURN(FALSE); } if (((want_access & ~sctx->master_access) & ~(DB_ACLS | EXTRA_ACL)) || - ! db && dont_check_global_grants) + (! db && dont_check_global_grants)) { // We can never grant this DBUG_PRINT("error",("No possible access")); if (!no_errors) @@ -6029,10 +6029,10 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table) { if (access & want_access) { - if (!check_access(thd, access, table->db, + if ((!check_access(thd, access, table->db, &table->grant.privilege, 0, 1, test(table->schema_table)) && - !grant_option || !check_grant(thd, access, table, 0, 1, 1)) + !grant_option) || !check_grant(thd, access, table, 0, 1, 1)) DBUG_RETURN(0); } } @@ -7710,12 +7710,12 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) else if ((check_access(thd, UPDATE_ACL, table->db, &table->grant.privilege, 0, 1, test(table->schema_table)) || - grant_option && - check_grant(thd, UPDATE_ACL, table, 0, 1, 1)) && + (grant_option && + check_grant(thd, UPDATE_ACL, table, 0, 1, 1))) && (check_access(thd, SELECT_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))) + (grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)))) DBUG_RETURN(TRUE); table->table_in_first_from_clause= 1; @@ -7735,7 +7735,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) if (check_access(thd, SELECT_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)) + (grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))) DBUG_RETURN(TRUE); } } @@ -7961,7 +7961,7 @@ static bool check_show_create_table_access(THD *thd, TABLE_LIST *table) return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0); + (grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0)); } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index a20f61436a7..d14f14b526e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1367,7 +1367,7 @@ static bool mysql_test_set_fields(Prepared_statement *stmt, THD *thd= stmt->thd; set_var_base *var; - if (tables && check_table_access(thd, SELECT_ACL, tables, 0) || + if ((tables && check_table_access(thd, SELECT_ACL, tables, 0)) || open_and_lock_tables(thd, tables)) goto error; @@ -2714,7 +2714,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg) void Prepared_statement::setup_set_params() { /* Setup binary logging */ - if (mysql_bin_log.is_open() && is_update_query(lex->sql_command) || + if ((mysql_bin_log.is_open() && is_update_query(lex->sql_command)) || mysql_log.is_open() || mysql_slow_log.is_open()) { set_params_from_vars= insert_params_from_vars_with_log; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 33c2855c20b..3d2cee6433b 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -144,7 +144,7 @@ static int send_file(THD *thd) if (errmsg) { sql_print_error("Failed in send_file() %s", errmsg); - DBUG_PRINT("error", (errmsg)); + DBUG_PRINT("error", ("%s", errmsg)); } DBUG_RETURN(error); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0417460fe4f..672ebaf9259 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1305,7 +1305,7 @@ JOIN::optimize() join_tab[const_tables].type != JT_ALL && join_tab[const_tables].type != JT_FT && join_tab[const_tables].type != JT_REF_OR_NULL && - (order && simple_order || group_list && simple_group)) + ((order && simple_order) || (group_list && simple_group))) { if (add_ref_to_table_cond(thd,&join_tab[const_tables])) { DBUG_RETURN(1); @@ -1809,9 +1809,9 @@ JOIN::exec() like SEC_TO_TIME(SUM(...)). */ - if (curr_join->group_list && (!test_if_subpart(curr_join->group_list, + if ((curr_join->group_list && (!test_if_subpart(curr_join->group_list, curr_join->order) || - curr_join->select_distinct) || + curr_join->select_distinct)) || (curr_join->select_distinct && curr_join->tmp_table_param.using_indirect_summary_function)) { /* Must copy to another table */ @@ -2269,9 +2269,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array, } else { - if (err= join->prepare(rref_pointer_array, tables, wild_num, - conds, og_num, order, group, having, proc_param, - select_lex, unit)) + err= join->prepare(rref_pointer_array, tables, wild_num, + conds, og_num, order, group, having, proc_param, + select_lex, unit); + if (err) { goto err; } @@ -2286,9 +2287,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array, DBUG_RETURN(TRUE); thd_proc_info(thd, "init"); thd->used_tables=0; // Updated by setup_fields - if (err= join->prepare(rref_pointer_array, tables, wild_num, - conds, og_num, order, group, having, proc_param, - select_lex, unit)) + err= join->prepare(rref_pointer_array, tables, wild_num, + conds, og_num, order, group, having, proc_param, + select_lex, unit); + if (err) { goto err; } @@ -3744,7 +3746,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, if (use->key == prev->key && use->table == prev->table) { if (prev->keypart+1 < use->keypart || - prev->keypart == use->keypart && found_eq_constant) + (prev->keypart == use->keypart && found_eq_constant)) continue; /* remove */ } else if (use->keypart != 0) // First found must be 0 @@ -4984,8 +4986,8 @@ best_extension_by_limited_search(JOIN *join, { if (best_record_count > current_record_count || best_read_time > current_read_time || - idx == join->const_tables && // 's' is the first table in the QEP - s->table == join->sort_by_table) + (idx == join->const_tables && // 's' is the first table in the QEP + s->table == join->sort_by_table)) { if (best_record_count >= current_record_count && best_read_time >= current_read_time && @@ -5110,7 +5112,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, double current_read_time=read_time+best; if (best_record_count > current_record_count || best_read_time > current_read_time || - idx == join->const_tables && s->table == join->sort_by_table) + (idx == join->const_tables && s->table == join->sort_by_table)) { if (best_record_count >= current_record_count && best_read_time >= current_read_time && @@ -5955,8 +5957,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) the index if we are using limit and this is the first table */ - if (cond && - (!tab->keys.is_subset(tab->const_keys) && i > 0) || + if ((cond && + (!tab->keys.is_subset(tab->const_keys) && i > 0)) || (!tab->const_keys.is_clear_all() && i == join->const_tables && join->unit->select_limit_cnt < join->best_positions[i].records_read && @@ -7081,7 +7083,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, left_item_equal->merge(right_item_equal); /* Remove the merged multiple equality from the list */ List_iterator<Item_equal> li(cond_equal->current_level); - while ((li++) != right_item_equal); + while ((li++) != right_item_equal) ; li.remove(); } } @@ -9663,9 +9665,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, reclength=1; // Dummy select /* Use packed rows if there is blobs or a lot of space to gain */ if (blob_count || - string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS && + (string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS && (reclength / string_total_length <= RATIO_TO_PACK_ROWS || - string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)) + string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS))) use_packed_rows= 1; table->s->fields= field_count; @@ -10329,8 +10331,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, /* copy row that filled HEAP table */ if ((write_err=new_table.file->write_row(table->record[0]))) { - if (write_err != HA_ERR_FOUND_DUPP_KEY && - write_err != HA_ERR_FOUND_DUPP_UNIQUE || !ignore_last_dupp_key_error) + if ((write_err != HA_ERR_FOUND_DUPP_KEY && + write_err != HA_ERR_FOUND_DUPP_UNIQUE) || !ignore_last_dupp_key_error) goto err; } @@ -12812,8 +12814,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, */ if ((order != join->group_list || !(join->select_options & SELECT_BIG_RESULT) || - select && select->quick && - select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) && + (select && select->quick && + select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) && test_if_skip_sort_order(tab,order,select_limit,0)) DBUG_RETURN(0); for (ORDER *ord= join->order; ord; ord= ord->next) @@ -13641,8 +13643,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, /* Lookup the current GROUP field in the FROM clause. */ order_item_type= order_item->type(); from_field= (Field*) not_found_field; - if (is_group_field && - order_item_type == Item::FIELD_ITEM || + if ((is_group_field && + order_item_type == Item::FIELD_ITEM) || order_item_type == Item::REF_ITEM) { from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables, @@ -14068,7 +14070,7 @@ get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables) if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT))) DBUG_RETURN(0); - for (; !(map & tables->table->map); tables= tables->next_leaf); + for (; !(map & tables->table->map); tables= tables->next_leaf) ; if (map != tables->table->map) DBUG_RETURN(0); // More than one table DBUG_PRINT("exit",("sort by table: %d",tables->table->tablenr)); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 59679c96120..8387c087836 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2987,10 +2987,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, TYPE_ENUM_PROCEDURE)) return 0; - if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && - proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE || - lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC && - proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION || + if ((lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && + proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) || + (lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC && + proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) || lex->orig_sql_command == SQLCOM_END) { restore_record(table, s->default_values); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9952fca6bcb..84370873054 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -982,8 +982,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } /* Don't pack rows in old tables if the user has requested this */ if ((sql_field->flags & BLOB_FLAG) || - sql_field->sql_type == MYSQL_TYPE_VARCHAR && - create_info->row_type != ROW_TYPE_FIXED) + (sql_field->sql_type == MYSQL_TYPE_VARCHAR && + create_info->row_type != ROW_TYPE_FIXED)) (*db_options)|= HA_OPTION_PACK_RECORD; it2.rewind(); } @@ -1422,7 +1422,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->sql_type == MYSQL_TYPE_VARCHAR || sql_field->pack_flag & FIELDFLAG_BLOB))) { - if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) || + if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) || sql_field->sql_type == MYSQL_TYPE_VARCHAR) key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; else @@ -2521,7 +2521,7 @@ send_result_message: { if (!thd->vio_ok()) { - sql_print_error(err_msg); + sql_print_error("%s", err_msg); } else { @@ -3954,9 +3954,9 @@ view_err: } else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db, new_alias) || - (new_name != table_name || new_db != db) && // we also do rename + ((new_name != table_name || new_db != db) && // we also do rename Table_triggers_list::change_table_name(thd, db, table_name, - new_db, new_alias)) + new_db, new_alias))) { // Try to get everything back error=1; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index d2ae494d4eb..1fa8b83f300 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -179,7 +179,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) need second part of condition below, since check_access() function also checks that db is specified. */ - if (!thd->lex->spname->m_db.length || create && !tables->db_length) + if (!thd->lex->spname->m_db.length || (create && !tables->db_length)) { my_error(ER_NO_DB_ERROR, MYF(0)); DBUG_RETURN(TRUE); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 69f876ace39..481fe30c6e7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1532,7 +1532,7 @@ void multi_update::send_error(uint errcode,const char *err) /* the error was handled or nothing deleted and no side effects return */ if (error_handled || - !thd->transaction.stmt.modified_non_trans_table && !updated) + (!thd->transaction.stmt.modified_non_trans_table && !updated)) return; /* Something already updated so we have to invalidate cache */ diff --git a/sql/sql_view.cc b/sql/sql_view.cc index d1d84e76811..96077aeeb12 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, */ if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege, 0, 0, is_schema_db(view->db)) || - grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) || + (grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0))) || (mode != VIEW_CREATE_NEW && (check_access(thd, DROP_ACL, view->db, &view->grant.privilege, 0, 0, is_schema_db(view->db)) || - grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0)))) + (grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0))))) goto err; for (sl= select_lex; sl; sl= sl->next_select()) @@ -322,7 +322,7 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, { if (check_access(thd, SELECT_ACL, tbl->db, &tbl->grant.privilege, 0, 0, test(tbl->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0)) + (grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))) goto err; } } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b6a215a2306..49b7fafcc0b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3943,7 +3943,7 @@ alter_list_item: MYSQL_YYABORT; } if (check_table_name($3->table.str,$3->table.length) || - $3->db.str && check_db_name($3->db.str)) + ($3->db.str && check_db_name($3->db.str))) { my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); MYSQL_YYABORT; @@ -4094,8 +4094,8 @@ slave_until: | UNTIL_SYM slave_until_opts { LEX *lex=Lex; - if ((lex->mi.log_file_name || lex->mi.pos) && - (lex->mi.relay_log_name || lex->mi.relay_log_pos) || + if (((lex->mi.log_file_name || lex->mi.pos) && + (lex->mi.relay_log_name || lex->mi.relay_log_pos)) || !((lex->mi.log_file_name && lex->mi.pos) || (lex->mi.relay_log_name && lex->mi.relay_log_pos))) { diff --git a/sql/table.cc b/sql/table.cc index 55a9b50605d..84b1099d5a2 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2112,8 +2112,8 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type) { const char *save_where= thd->where; thd->where= "check option"; - if (!check_option->fixed && - check_option->fix_fields(thd, &check_option) || + if ((!check_option->fixed && + check_option->fix_fields(thd, &check_option)) || check_option->check_cols(1)) { DBUG_RETURN(TRUE); @@ -2827,7 +2827,7 @@ void Field_iterator_table_ref::set_field_iterator() /* Necesary, but insufficient conditions. */ DBUG_ASSERT(table_ref->is_natural_join || table_ref->nested_join || - table_ref->join_columns && + (table_ref->join_columns && /* This is a merge view. */ ((table_ref->field_translation && table_ref->join_columns->elements == @@ -2836,7 +2836,7 @@ void Field_iterator_table_ref::set_field_iterator() /* This is stored table or a tmptable view. */ (!table_ref->field_translation && table_ref->join_columns->elements == - table_ref->table->s->fields))); + table_ref->table->s->fields)))); field_it= &natural_join_it; DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join", table_ref->alias)); diff --git a/sql/table.h b/sql/table.h index ad578044371..db996d45320 100644 --- a/sql/table.h +++ b/sql/table.h @@ -729,7 +729,7 @@ struct TABLE_LIST void cleanup_items(); bool placeholder() { - return derived || view || schema_table || create && !table->db_stat || + return derived || view || schema_table || (create && !table->db_stat) || !table; } void print(THD *thd, String *str); diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index 4ebcf1c50af..3c0f96fedc1 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -21,7 +21,7 @@ extern "C" { void sql_alloc_error_handler(void) { - sql_print_error(ER(ER_OUT_OF_RESOURCES)); + sql_print_error("%s", ER(ER_OUT_OF_RESOURCES)); THD *thd=current_thd; if (thd) diff --git a/sql/time.cc b/sql/time.cc index fb8a51fd0eb..b9cee5a986a 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -76,8 +76,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) if (l_time->month == 1 && l_time->day <= 7-weekday) { if (!week_year && - (first_weekday && weekday != 0 || - !first_weekday && weekday >= 4)) + ((first_weekday && weekday != 0) || + (!first_weekday && weekday >= 4))) return 0; week_year= 1; (*year)--; @@ -94,8 +94,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) if (week_year && days >= 52*7) { weekday= (weekday + calc_days_in_year(*year)) % 7; - if (!first_weekday && weekday < 4 || - first_weekday && weekday == 0) + if ((!first_weekday && weekday < 4) || + (first_weekday && weekday == 0)) { (*year)++; return 1; diff --git a/sql/tztime.cc b/sql/tztime.cc index d73a1ca0111..73e68ee2b29 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -447,8 +447,8 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage) } if (end_t == MY_TIME_T_MAX || - (cur_off_and_corr > 0) && - (end_t >= MY_TIME_T_MAX - cur_off_and_corr)) + ((cur_off_and_corr > 0) && + (end_t >= MY_TIME_T_MAX - cur_off_and_corr))) /* end of t space */ break; diff --git a/sql/uniques.cc b/sql/uniques.cc index a0d1beaf0f9..86223151d72 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -604,9 +604,9 @@ bool Unique::get(TABLE *table) outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), MYF(MY_ZEROFILL)); - if (!outfile || ! my_b_inited(outfile) && + if (!outfile || (! my_b_inited(outfile) && open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER, - MYF(MY_WME))) + MYF(MY_WME)))) return 1; reinit_io_cache(outfile,WRITE_CACHE,0L,0,0); diff --git a/strings/decimal.c b/strings/decimal.c index 8b431ad9bab..c535d0f73dc 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -306,7 +306,7 @@ int decimal_actual_fraction(decimal_t *from) { for (i= DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1); *buf0 % powers10[i++] == 0; - frac--); + frac--) ; } return frac; } @@ -500,7 +500,7 @@ static void digits_bounds(decimal_t *from, int *start_result, int *end_result) stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1); i= 1; } - for (; *buf_end % powers10[i++] == 0; stop--); + for (; *buf_end % powers10[i++] == 0; stop--) ; *end_result= stop; /* index of position after last decimal digit (from 0) */ } @@ -1005,7 +1005,7 @@ static int ull2dec(ulonglong from, decimal_t *to) sanity(to); - for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE); + for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE) ; if (unlikely(intg1 > to->len)) { intg1=to->len; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 9dfacb7436d..ce1a1a99b04 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -12063,6 +12063,27 @@ static void test_bug6081() } +/* + Verify that bogus database names are handled properly with + COM_CREATE_DB and COM_DROP_DB, i.e., cannot cause SIGSEGV through + the use of printf specifiers in the database name. +*/ +static void test_bug45790() +{ + const char* bogus_db = "%s%s%s%s%s%s%s"; + int rc; + + myheader("test_bug45790"); + rc= simple_command(mysql, COM_CREATE_DB, bogus_db, + (ulong)strlen(bogus_db), 0); + myquery(rc); + + rc= simple_command(mysql, COM_DROP_DB, bogus_db, + (ulong)strlen(bogus_db), 0); + myquery(rc); +} + + static void test_bug6096() { MYSQL_STMT *stmt; @@ -16829,6 +16850,7 @@ static struct my_tests_st my_tests[]= { { "test_bug6059", test_bug6059 }, { "test_bug6046", test_bug6046 }, { "test_bug6081", test_bug6081 }, + { "test_bug45790",test_bug45790 }, { "test_bug6096", test_bug6096 }, { "test_datetime_ranges", test_datetime_ranges }, { "test_bug4172", test_bug4172 }, |