diff --git a/client/my_readline.h b/client/my_readline.h index 47be7fa9294..32d6da4c626 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -29,5 +29,5 @@ typedef struct st_line_buffer extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file); extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str); -extern char *batch_readline(LINE_BUFFER *buffer); +extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated); extern void batch_readline_end(LINE_BUFFER *buffer); diff --git a/client/mysql.cc b/client/mysql.cc index 1a025345190..983d7719c3c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -112,6 +112,8 @@ extern "C" { #define PROMPT_CHAR '\\' #define DEFAULT_DELIMITER ";" +#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L) + typedef struct st_status { int exit_status; @@ -1035,7 +1037,7 @@ static void fix_history(String *final_command); static COMMANDS *find_command(char *name,char cmd_name); static bool add_line(String &buffer,char *line,char *in_string, - bool *ml_comment); + bool *ml_comment, bool truncated); static void remove_cntrl(String &buffer); static void print_table_data(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result); @@ -1117,7 +1119,7 @@ int main(int argc,char *argv[]) exit(1); } if (status.batch && !status.line_buff && - !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin))) + !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) { free_defaults(defaults_argv); my_end(0); @@ -1197,7 +1199,7 @@ int main(int argc,char *argv[]) #endif sprintf(buff, "%s", #ifndef NOT_YET - "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); + "Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n"); #else "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); #endif @@ -1226,7 +1228,7 @@ sig_handler mysql_sigint(int sig) goto err; /* kill_buffer is always big enough because max length of %lu is 15 */ sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); - mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); + mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer)); mysql_close(kill_mysql); tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); @@ -1766,13 +1768,14 @@ static int read_and_execute(bool interactive) ulong line_number=0; bool ml_comment= 0; COMMANDS *com; + bool truncated= 0; status.exit_status=1; for (;;) { if (!interactive) { - line=batch_readline(status.line_buff); + line=batch_readline(status.line_buff, &truncated); /* Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. Editors like "notepad" put this marker in @@ -1891,7 +1894,7 @@ static int read_and_execute(bool interactive) #endif continue; } - if (add_line(glob_buffer,line,&in_string,&ml_comment)) + if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated)) break; } /* if in batch mode, send last query even if it doesn't end with \g or go */ @@ -1977,7 +1980,7 @@ static COMMANDS *find_command(char *name,char cmd_char) static bool add_line(String &buffer,char *line,char *in_string, - bool *ml_comment) + bool *ml_comment, bool truncated) { uchar inchar; char buff[80], *pos, *out; @@ -2224,9 +2227,10 @@ static bool add_line(String &buffer,char *line,char *in_string, { uint length=(uint) (out-line); - if (length < 9 || - my_strnncoll (charset_info, - (uchar *)line, 9, (const uchar *) "delimiter", 9)) + if (!truncated && + (length < 9 || + my_strnncoll (charset_info, + (uchar *)line, 9, (const uchar *) "delimiter", 9))) { /* Don't add a new line in case there's a DELIMITER command to be @@ -2639,7 +2643,7 @@ static void get_current_db() (res= mysql_use_result(&mysql))) { MYSQL_ROW row= mysql_fetch_row(res); - if (row[0]) + if (row && row[0]) current_db= my_strdup(row[0], MYF(MY_WME)); mysql_free_result(res); } @@ -3463,7 +3467,7 @@ static void print_warnings() /* Get the warnings */ query= "show warnings"; - mysql_real_query_for_lazy(query, strlen(query)); + mysql_real_query_for_lazy(query, (uint) strlen(query)); mysql_store_result_for_lazy(&result); /* Bail out when no warnings */ @@ -3886,7 +3890,7 @@ static int com_source(String *buffer, char *line) return put_info(buff, INFO_ERROR, 0); } - if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file))) + if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file))) { my_fclose(sql_file,MYF(0)); return put_info("Can't initialize batch_readline", INFO_ERROR, 0); @@ -4343,7 +4347,8 @@ server_version_string(MYSQL *con) MYSQL_ROW cur = mysql_fetch_row(result); if (cur && cur[0]) { - bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS); + bufp = strxnmov(bufp, (uint) (sizeof buf - (bufp - buf)), " ", cur[0], + NullS); } mysql_free_result(result); } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 74e8c9dd577..e3500c81fb9 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -429,7 +429,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, MYF(MY_WME))) < 0) die("Failed to create temporary file for defaults"); - if (my_write(fd, query, strlen(query), + if (my_write(fd, query, (uint) strlen(query), MYF(MY_FNABP | MY_WME))) { my_close(fd, MYF(0)); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 54f67c5df2d..24b95be8626 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -844,7 +844,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) bool old= (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD); #ifdef __WIN__ - uint pw_len= strlen(pw); + uint pw_len= (uint) strlen(pw); if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') printf("Warning: single quotes were not trimmed from the password by" " your command\nline client, as you might have expected.\n"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index f0a4c8d2abf..ed072902730 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -105,7 +105,7 @@ static MYSQL* safe_connect(); class Load_log_processor { char target_dir_name[FN_REFLEN]; - int target_dir_name_len; + size_t target_dir_name_len; /* When we see first event corresponding to some LOAD DATA statement in @@ -275,7 +275,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, File file; fn_format(filename, le->fname, target_dir_name, "", 1); - len= strlen(filename); + len= (uint) strlen(filename); tail= filename + len; if ((file= create_unique_file(filename,tail)) < 0) @@ -284,7 +284,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, return -1; } - le->set_fname_outside_temp_buf(filename,len+strlen(tail)); + le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail)); return file; } @@ -369,7 +369,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen, uint file_id, Create_file_log_event *ce) { - uint full_len= target_dir_name_len + blen + 9 + 9 + 1; + size_t full_len= target_dir_name_len + blen + 9 + 9 + 1; int error= 0; char *fname, *ptr; File file; @@ -403,7 +403,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen, } if (ce) - ce->set_fname_outside_temp_buf(fname, strlen(fname)); + ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname)); if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP))) error= -1; @@ -416,7 +416,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen, int Load_log_processor::process(Create_file_log_event *ce) { const char *bname= ce->fname + dirname_length(ce->fname); - uint blen= ce->fname_len - (bname-ce->fname); + uint blen= (uint) (ce->fname_len - (bname-ce->fname)); return process_first_event(bname, blen, ce->block, ce->block_len, ce->file_id, ce); @@ -864,7 +864,7 @@ static my_time_t convert_str_to_timestamp(const char* str) long dummy_my_timezone; my_bool dummy_in_dst_time_gap; /* We require a total specification (date AND time) */ - if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) != + if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) != MYSQL_TIMESTAMP_DATETIME || was_cut) { fprintf(stderr, "Incorrect date and time argument: %s\n", str); @@ -1109,7 +1109,7 @@ could be out of memory"); int4store(buf, (uint32)start_position); int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags); - size_s tlen = strlen(logname); + size_t tlen= strlen(logname); if (tlen > UINT_MAX) { fprintf(stderr,"Log name too long\n"); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 513d1974ed0..15922e672a6 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -328,7 +328,7 @@ static int get_options(int *argc, char ***argv) if (!what_to_do) { - int pnlen = strlen(my_progname); + size_t pnlen= strlen(my_progname); if (pnlen < 6) /* name too short */ what_to_do = DO_CHECK; @@ -414,7 +414,8 @@ static int process_selected_tables(char *db, char **table_names, int tables) space is for more readable output in logs and in case of error */ char *table_names_comma_sep, *end; - int i, tot_length = 0; + size_t tot_length= 0; + int i= 0; for (i = 0; i < tables; i++) tot_length+= fixed_name_length(*(table_names + i)) + 2; @@ -430,7 +431,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) *end++= ','; } *--end = 0; - handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1); + handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1)); my_free(table_names_comma_sep, MYF(0)); } else @@ -452,7 +453,7 @@ static uint fixed_name_length(const char *name) else if (*p == '.') extra_length+= 2; } - return (p - name) + extra_length; + return (uint) ((p - name) + extra_length); } diff --git a/client/mysqldump.c b/client/mysqldump.c index 97e8d6ed5ef..a9d2788de05 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -662,7 +662,7 @@ static void free_table_ent(char *key) byte* get_table_key(const char *entry, uint *length, my_bool not_used __attribute__((unused))) { - *length= strlen(entry); + *length= (uint) strlen(entry); return (byte*) entry; } @@ -778,7 +778,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_set_charset= 0; opt_compatible_mode_str= argument; opt_compatible_mode= find_set(&compatible_mode_typelib, - argument, strlen(argument), + argument, (uint) strlen(argument), &err_ptr, &err_len); if (err_len) { @@ -791,7 +791,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), uint size_for_sql_mode= 0; const char **ptr; for (ptr= compatible_mode_names; *ptr; ptr++) - size_for_sql_mode+= strlen(*ptr); + size_for_sql_mode+= (uint) strlen(*ptr); size_for_sql_mode+= sizeof(compatible_mode_names)-1; DBUG_ASSERT(sizeof(compatible_mode_normal_str)>=size_for_sql_mode); } @@ -1039,7 +1039,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name) "SET SESSION character_set_results = '%s'", (const char *) cs_name); - return mysql_real_query(mysql, query_buffer, query_length); + return mysql_real_query(mysql, query_buffer, (uint) query_length); } @@ -1372,7 +1372,8 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, fputs(attribute_name, xml_file); fputc('\"', xml_file); - print_quoted_xml(xml_file, attribute_value, strlen(attribute_value)); + print_quoted_xml(xml_file, attribute_value, + (uint) strlen(attribute_value)); fputc('\"', xml_file); attribute_name= va_arg(arg_list, char *); @@ -1412,7 +1413,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg, fputs("<", xml_file); fputs(stag_atr, xml_file); fputs("\"", xml_file); - print_quoted_xml(xml_file, sval, strlen(sval)); + print_quoted_xml(xml_file, sval, (uint) strlen(sval)); fputs("\" xsi:nil=\"true\" />", xml_file); fputs(line_end, xml_file); check_io(xml_file); @@ -1510,7 +1511,7 @@ static uint dump_routines_for_db(char *db) DBUG_ENTER("dump_routines_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); - mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); + mysql_real_escape_string(mysql, db_name_buff, db, (uint) strlen(db)); /* nice comments */ if (opt_comments) @@ -1602,13 +1603,13 @@ static uint dump_routines_for_db(char *db) Allocate memory for new query string: original string from SHOW statement and version-specific comments. */ - query_str= alloc_query_str(strlen(row[2]) + 23); + query_str= alloc_query_str((uint) strlen(row[2]) + 23); query_str_tail= strnmov(query_str, row[2], - definer_begin - row[2]); + (uint) (definer_begin - row[2])); query_str_tail= strmov(query_str_tail, "*/ /*!50020"); query_str_tail= strnmov(query_str_tail, definer_begin, - definer_end - definer_begin); + (uint) (definer_end - definer_begin)); query_str_tail= strxmov(query_str_tail, "*/ /*!50003", definer_end, NullS); } @@ -2217,7 +2218,7 @@ static void dump_triggers_for_table(char *table, char host_name_str[HOSTNAME_LENGTH + 1]; char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3]; - parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len, + parse_user(row[7], (uint) strlen(row[7]), user_name_str, &user_name_len, host_name_str, &host_name_len); fprintf(sql_file, @@ -3055,7 +3056,7 @@ static int dump_all_tables_in_db(char *database) while ((table= getTableName(0))) { char *end= strmov(afterdot, table); - if (include_table(hash_key, end - hash_key)) + if (include_table(hash_key, (uint) (end - hash_key))) { dump_table(table,database); my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); @@ -3104,6 +3105,11 @@ static my_bool dump_all_views_in_db(char *database) char *table; uint numrows; char table_buff[NAME_LEN*2+3]; + char hash_key[2*NAME_LEN+2]; /* "db.tablename" */ + char *afterdot; + + afterdot= strmov(hash_key, database); + *afterdot++= '.'; if (init_dumping(database, init_dumping_views)) return 1; @@ -3113,10 +3119,15 @@ static my_bool dump_all_views_in_db(char *database) { DYNAMIC_STRING query; init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024); - for (numrows= 0 ; (table= getTableName(1)); numrows++) + for (numrows= 0 ; (table= getTableName(1)); ) { - dynstr_append_checked(&query, quote_name(table, table_buff, 1)); - dynstr_append_checked(&query, " READ /*!32311 LOCAL */,"); + char *end= strmov(afterdot, table); + if (include_table((uchar*) hash_key,end - hash_key)) + { + numrows++; + dynstr_append_checked(&query, quote_name(table, table_buff, 1)); + dynstr_append_checked(&query, " READ /*!32311 LOCAL */,"); + } } if (numrows && mysql_real_query(mysql, query.str, query.length-1)) DB_error(mysql, "when using LOCK TABLES"); @@ -3130,7 +3141,11 @@ static my_bool dump_all_views_in_db(char *database) /* We shall continue here, if --force was given */ } while ((table= getTableName(0))) - get_view_structure(table, database); + { + char *end= strmov(afterdot, table); + if (include_table((uchar*) hash_key, end - hash_key)) + get_view_structure(table, database); + } if (opt_xml) { fputs("\n", md_result_file); @@ -3200,7 +3215,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) DBUG_ENTER("dump_selected_tables"); if (init_dumping(db, init_dumping_tables)) - return 1; + DBUG_RETURN(1); init_alloc_root(&root, 8192, 0); if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) @@ -3562,7 +3577,8 @@ char check_if_ignore_table(const char *table_name, char *table_type) If these two types, we do want to skip dumping the table */ if (!opt_no_data && - (!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM"))) + (!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM") || + !strcmp(table_type,"FEDERATED"))) result= IGNORE_DATA; } mysql_free_result(res); @@ -3623,7 +3639,7 @@ static char *primary_key_fields(const char *table_name) do { quoted_field= quote_name(row[4], buff, 0); - result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */ + result_length+= (uint) strlen(quoted_field) + 1; /* + 1 for ',' or \0 */ } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1); } @@ -3683,7 +3699,8 @@ static int replace(DYNAMIC_STRING *ds_str, return 1; init_dynamic_string_checked(&ds_tmp, "", ds_str->length + replace_len, 256); - dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str); + dynstr_append_mem_checked(&ds_tmp, ds_str->str, + (uint) (start - ds_str->str)); dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len); dynstr_append_checked(&ds_tmp, start + search_len); dynstr_set_checked(ds_str, ds_tmp.str); diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c index 7a857c59743..568358b1cda 100644 --- a/client/mysqlmanager-pwgen.c +++ b/client/mysqlmanager-pwgen.c @@ -134,7 +134,6 @@ void get_pass(char* pw, int len) int main(int argc, char** argv) { FILE* fp; - my_MD5_CTX context; uchar digest[16]; char pw[17]; uint i; @@ -147,9 +146,7 @@ int main(int argc, char** argv) if (!(fp=fopen(outfile,"w"))) die("Could not open '%s'(errno=%d)",outfile,errno); get_pass(pw,sizeof(pw)-1); - my_MD5Init(&context); - my_MD5Update(&context,(uchar*) pw,sizeof(pw)-1); - my_MD5Final(digest,&context); + MY_MD5_HASH(digest,(uchar*) pw,sizeof(pw)-1); fprintf(fp,"%s:",user); for (i=0;i start) { - init_dynamic_string(arg->ds, 0, ptr-start, 32); + init_dynamic_string(arg->ds, 0, (uint) (ptr - start), 32); do_eval(arg->ds, start, ptr, FALSE); } else @@ -1156,16 +1156,16 @@ void warning_msg(const char *fmt, ...) len= my_snprintf(buff, sizeof(buff), "in included file %s ", cur_file->file_name); dynstr_append_mem(&ds_warning_messages, - buff, len); + buff, (uint) len); } len= my_snprintf(buff, sizeof(buff), "at line %d: ", start_lineno); dynstr_append_mem(&ds_warning_messages, - buff, len); + buff, (uint) len); } len= my_vsnprintf(buff, sizeof(buff), fmt, args); - dynstr_append_mem(&ds_warning_messages, buff, len); + dynstr_append_mem(&ds_warning_messages, buff, (uint) len); dynstr_append(&ds_warning_messages, "\n"); va_end(args); @@ -1185,7 +1185,7 @@ void log_msg(const char *fmt, ...) len= my_vsnprintf(buff, sizeof(buff)-1, fmt, args); va_end(args); - dynstr_append_mem(&ds_res, buff, len); + dynstr_append_mem(&ds_res, buff, (uint) len); dynstr_append(&ds_res, "\n"); DBUG_VOID_RETURN; @@ -1222,7 +1222,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename) /* Add fake newline instead of cr and output the line */ *p= '\n'; p++; /* Step past the "fake" newline */ - dynstr_append_mem(ds, start, p-start); + dynstr_append_mem(ds, start, (uint) (p - start)); p++; /* Step past the "fake" newline */ start= p; } @@ -1230,7 +1230,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename) p++; } /* Output any chars that migh be left */ - dynstr_append_mem(ds, start, p-start); + dynstr_append_mem(ds, start, (uint) (p - start)); } my_close(fd, MYF(0)); } @@ -1770,9 +1770,9 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, int val_alloc_len; VAR *tmp_var; if (!name_len && name) - name_len = strlen(name); + name_len = (uint) strlen(name); if (!val_len && val) - val_len = strlen(val) ; + val_len = (uint) strlen(val) ; val_alloc_len = val_len + 16; /* room to grow */ if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var) + name_len+1, MYF(MY_WME)))) @@ -1815,7 +1815,7 @@ VAR* var_from_env(const char *name, const char *def_val) if (!(tmp = getenv(name))) tmp = def_val; - v = var_init(0, name, strlen(name), tmp, strlen(tmp)); + v = var_init(0, name, (uint) strlen(name), tmp, (uint) strlen(tmp)); my_hash_insert(&var_hash, (byte*)v); return v; } @@ -1864,7 +1864,7 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw, { sprintf(v->str_val, "%d", v->int_val); v->int_dirty = 0; - v->str_val_len = strlen(v->str_val); + v->str_val_len = (uint) strlen(v->str_val); } if (var_name_end) *var_name_end = var_name ; @@ -1927,7 +1927,7 @@ void var_set(const char *var_name, const char *var_name_end, { sprintf(v->str_val, "%d", v->int_val); v->int_dirty= 0; - v->str_val_len= strlen(v->str_val); + v->str_val_len= (uint) strlen(v->str_val); } my_snprintf(buf, sizeof(buf), "%.*s=%.*s", v->name_len, v->name, @@ -2006,7 +2006,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end) ++query; /* Eval the query, thus replacing all environment variables */ - init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); + init_dynamic_string(&ds_query, 0, (uint) ((end - query) + 32), 256); do_eval(&ds_query, query, end, FALSE); if (mysql_real_query(mysql, ds_query.str, ds_query.length)) @@ -2223,7 +2223,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end) struct st_command command; memset(&command, 0, sizeof(command)); command.query= (char*)p; - command.first_word_len= len; + command.first_word_len= (uint) len; command.first_argument= command.query + len; command.end= (char*)*p_end; var_set_query_get_value(&command, v); @@ -2413,7 +2413,7 @@ static int replace(DYNAMIC_STRING *ds_str, return 1; init_dynamic_string(&ds_tmp, "", ds_str->length + replace_len, 256); - dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str); + dynstr_append_mem(&ds_tmp, ds_str->str, (uint) (start - ds_str->str)); dynstr_append_mem(&ds_tmp, replace_str, replace_len); dynstr_append(&ds_tmp, start + search_len); dynstr_set(ds_str, ds_tmp.str); @@ -2468,7 +2468,7 @@ void do_exec(struct st_command *command) if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0) { /* Replace echo with our "builtin" echo */ - replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo)); + replace(&ds_cmd, "echo", 4, builtin_echo, (uint) strlen(builtin_echo)); } #ifdef __WIN__ @@ -4627,7 +4627,7 @@ void do_delimiter(struct st_command* command) die("Can't set empty delimiter"); strmake(delimiter, p, sizeof(delimiter) - 1); - delimiter_length= strlen(delimiter); + delimiter_length= (uint) strlen(delimiter); DBUG_PRINT("exit", ("delimiter: %s", delimiter)); command->last_argument= p + delimiter_length; @@ -4753,9 +4753,11 @@ int read_line(char *buf, int size) } else if ((c == '{' && (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5, - (uchar*) buf, min(5, p - buf), 0) || + (uchar*) buf, min(5, (uint) (p - buf)), + 0) || !my_strnncoll_simple(charset_info, (const uchar*) "if", 2, - (uchar*) buf, min(2, p - buf), 0)))) + (uchar*) buf, min(2, (uint) (p - buf)), + 0)))) { /* Only if and while commands can be terminated by { */ *p++= c; @@ -5117,7 +5119,7 @@ int read_command(struct st_command** command_ptr) command->first_argument= p; command->end= strend(command->query); - command->query_len= (command->end - command->query); + command->query_len= (uint) (command->end - command->query); parser.read_lines++; DBUG_RETURN(0); } @@ -6459,7 +6461,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) else { query = command->query; - query_len = strlen(query); + query_len = (uint) strlen(query); } /* @@ -6520,7 +6522,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) */ view_created= 1; query= (char*)"SELECT * FROM mysqltest_tmp_v"; - query_len = strlen(query); + query_len = (uint) strlen(query); /* Collect warnings from create of the view that should otherwise @@ -6568,7 +6570,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) sp_created= 1; query= (char*)"CALL mysqltest_tmp_sp()"; - query_len = strlen(query); + query_len = (uint) strlen(query); } dynstr_free(&query_str); } @@ -6661,9 +6663,9 @@ void init_re_comp(my_regex_t *re, const char* str) if (err) { char erbuf[100]; - int len= my_regerror(err, re, erbuf, sizeof(erbuf)); + size_t len= my_regerror(err, re, erbuf, sizeof(erbuf)); die("error %s, %d/%d `%s'\n", - re_eprint(err), len, (int)sizeof(erbuf), erbuf); + re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf); } } @@ -6717,9 +6719,9 @@ int match_re(my_regex_t *re, char *str) { char erbuf[100]; - int len= my_regerror(err, re, erbuf, sizeof(erbuf)); + size_t len= my_regerror(err, re, erbuf, sizeof(erbuf)); die("error %s, %d/%d `%s'\n", - re_eprint(err), len, (int)sizeof(erbuf), erbuf); + re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf); } return 0; } @@ -7579,7 +7581,7 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds, if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string) { /* No match found */ - dynstr_append_mem(ds, start, from - start - 1); + dynstr_append_mem(ds, start, (uint) (from - start - 1)); DBUG_PRINT("exit", ("Found no more string to replace, appended: %s", start)); DBUG_VOID_RETURN; } @@ -7590,11 +7592,11 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds, rep_str->from_offset, rep_str->replace_string)); /* Append part of original string before replace string */ - dynstr_append_mem(ds, start, (from - rep_str->to_offset) - start); + dynstr_append_mem(ds, start, (uint) ((from - rep_str->to_offset) - start)); /* Append replace string */ dynstr_append_mem(ds, rep_str->replace_string, - strlen(rep_str->replace_string)); + (uint) strlen(rep_str->replace_string)); if (!*(from-=rep_str->from_offset) && rep_pos->found != 2) { @@ -7689,7 +7691,7 @@ struct st_replace_regex* init_replace_regex(char* expr) char* buf,*expr_end; char* p; char* buf_p; - uint expr_len= strlen(expr); + size_t expr_len= strlen(expr); char last_c = 0; struct st_regex reg; @@ -7866,7 +7868,7 @@ void free_replace_regex() */ #define SECURE_REG_BUF if (buf_len < need_buf_len) \ { \ - int off= res_p - buf; \ + size_t off= res_p - buf; \ buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \ res_p= buf + off; \ buf_len= need_buf_len; \ @@ -7898,7 +7900,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, char *res_p,*str_p,*str_end; buf_len= *buf_len_p; - len= strlen(string); + len= (uint) strlen(string); str_end= string + len; /* start with a buffer of a reasonable size that hopefully will not @@ -7950,7 +7952,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, we need at least what we have so far in the buffer + the part before this match */ - need_buf_len= (res_p - buf) + (int) subs[0].rm_so; + need_buf_len= (uint) (res_p - buf) + (int) subs[0].rm_so; /* on this pass, calculate the memory for the result buffer */ while (expr_p < replace_end) @@ -8040,8 +8042,8 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, } else /* no match this time, just copy the string as is */ { - int left_in_str= str_end-str_p; - need_buf_len= (res_p-buf) + left_in_str; + size_t left_in_str= str_end-str_p; + need_buf_len= (uint) ((res_p-buf) + left_in_str); SECURE_REG_BUF memcpy(res_p,str_p,left_in_str); res_p += left_in_str; @@ -8708,7 +8710,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, if (!multi_reg_replace(glob_replace_regex, (char*)val)) { val= glob_replace_regex->buf; - len= strlen(val); + len= (uint) strlen(val); } } @@ -8725,7 +8727,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, /* Append zero-terminated string to ds, with optional replace */ void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val) { - replace_dynstr_append_mem(ds, val, strlen(val)); + replace_dynstr_append_mem(ds, val, (uint) strlen(val)); } /* Append uint to ds, with optional replace */ @@ -8733,7 +8735,7 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val) { char buff[22]; /* This should be enough for any int */ char *end= longlong10_to_str(val, buff, 10); - replace_dynstr_append_mem(ds, buff, end - buff); + replace_dynstr_append_mem(ds, buff, (uint) (end - buff)); } @@ -8771,7 +8773,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input) while (*start && *start != '\n') start++; start++; /* Skip past \n */ - dynstr_append_mem(ds, ds_input->str, start - ds_input->str); + dynstr_append_mem(ds, ds_input->str, (uint) (start - ds_input->str)); /* Insert line(s) in array */ while (*start) diff --git a/client/readline.cc b/client/readline.cc index ad42ed2ee10..726d9cd9415 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -24,7 +24,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size, ulong max_size); static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str); static uint fill_buffer(LINE_BUFFER *buffer); -static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length); +static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated); LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) @@ -42,12 +42,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) } -char *batch_readline(LINE_BUFFER *line_buff) +char *batch_readline(LINE_BUFFER *line_buff, bool *truncated) { char *pos; ulong out_length; + DBUG_ASSERT(truncated != NULL); - if (!(pos=intern_read_line(line_buff,&out_length))) + if (!(pos=intern_read_line(line_buff,&out_length, truncated))) return 0; if (out_length && pos[out_length-1] == '\n') if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */ @@ -149,6 +150,14 @@ static uint fill_buffer(LINE_BUFFER *buffer) read_count=(buffer->bufread - bufbytes)/IO_SIZE; if ((read_count*=IO_SIZE)) break; + if (buffer->bufread * 2 > buffer->max_size) + { + /* + So we must grow the buffer but we cannot due to the max_size limit. + Return 0 w/o setting buffer->eof to signal this condition. + */ + return 0; + } buffer->bufread *= 2; if (!(buffer->buffer = (char*) my_realloc(buffer->buffer, buffer->bufread+1, @@ -172,11 +181,15 @@ static uint fill_buffer(LINE_BUFFER *buffer) DBUG_PRINT("fill_buff", ("Got %d bytes", read_count)); - /* Kludge to pretend every nonempty file ends with a newline. */ - if (!read_count && bufbytes && buffer->end[-1] != '\n') + if (!read_count) { - buffer->eof = read_count = 1; - *buffer->end = '\n'; + buffer->eof = 1; + /* Kludge to pretend every nonempty file ends with a newline. */ + if (bufbytes && buffer->end[-1] != '\n') + { + read_count = 1; + *buffer->end = '\n'; + } } buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes; buffer->end+=read_count; @@ -186,7 +199,7 @@ static uint fill_buffer(LINE_BUFFER *buffer) -char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length) +char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated) { char *pos; uint length; @@ -200,14 +213,23 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length) pos++; if (pos == buffer->end) { - if ((uint) (pos - buffer->start_of_line) < buffer->max_size) + /* + fill_buffer() can return 0 either on EOF in which case we abort + or when the internal buffer has hit the size limit. In the latter case + return what we have read so far and signal string truncation. + */ + if (!(length=fill_buffer(buffer)) || length == (uint) -1) { - if (!(length=fill_buffer(buffer)) || length == (uint) -1) - DBUG_RETURN(0); - continue; + if (buffer->eof) + DBUG_RETURN(0); } + else + continue; pos--; /* break line here */ + *truncated= 1; } + else + *truncated= 0; buffer->end_of_line=pos+1; *out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line); DBUG_RETURN(buffer->start_of_line); diff --git a/client/sql_string.cc b/client/sql_string.cc index 321bddbf69a..4967538ad3b 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -465,7 +465,7 @@ bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s) { - return append(s, strlen(s)); + return append(s, (uint) strlen(s)); } diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 8c3b51ebc5e..aef1eeaf935 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -358,16 +358,19 @@ esac AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP], [ AC_CACHE_VAL(mysql_cv_termcap_lib, -[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses, - [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses, - [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap, - [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo, - mysql_cv_termcap_lib=NOT_FOUND)])])])]) + [AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw, + [AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses, + [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses, + [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap, + [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo, + mysql_cv_termcap_lib=NOT_FOUND)])])])])]) AC_MSG_CHECKING(for termcap functions library) if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then AC_MSG_ERROR([No curses/termcap library found]) elif test "$mysql_cv_termcap_lib" = "libtermcap"; then TERMCAP_LIB=-ltermcap +elif test "$mysql_cv_termcap_lib" = "libncursesw"; then +TERMCAP_LIB=-lncursesw elif test "$mysql_cv_termcap_lib" = "libncurses"; then TERMCAP_LIB=-lncurses elif test "$mysql_cv_termcap_lib" = "libtinfo"; then diff --git a/configure.in b/configure.in index 8c2c4a9cf79..9fdb1930cde 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.79) +AM_INIT_AUTOMAKE(mysql, 5.0.80) 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=79 +NDB_VERSION_BUILD=80 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? @@ -2094,6 +2094,27 @@ esac AC_MSG_CHECKING(for isinf in ) AC_TRY_LINK([#include ], [float f = 0.0; int r = isinf(f); return r], AC_MSG_RESULT(yes) + AC_MSG_CHECKING(whether isinf() is safe to use in C code) + AC_TRY_RUN([ +#include +int main() +{ + double a= 10.0; + double b= 1e308; + + return !isinf(a * b); +} +], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE([HAVE_BROKEN_ISINF], [1], + [Define to 1 if isinf() uses 80-bit register for intermediate values]) + ], + [ +# Let's be optimistic when cross-compiling, since the only compiler known +# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86. + AC_MSG_RESULT([[cross-compiling, assuming 'yes']]) + ]) AC_MSG_CHECKING(whether isinf() can be used in C++ code) AC_LANG_SAVE AC_LANG_CPLUSPLUS diff --git a/extra/comp_err.c b/extra/comp_err.c index 79f591e45fb..8814a045f36 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg) case 'u': case 'x': case 's': - chksum= my_checksum(chksum, start, p-start); + chksum= my_checksum(chksum, start, (uint) (p - start)); start= 0; /* Not in format specifier anymore */ break; diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 0c3f23b0cb8..66107dbe0a9 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -106,7 +106,7 @@ void input_buffer::add_size(uint i) uint input_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } @@ -223,7 +223,7 @@ uint output_buffer::get_size() const uint output_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp index 5eacf9083f9..8caca8f9649 100644 --- a/extra/yassl/src/cert_wrapper.cpp +++ b/extra/yassl/src/cert_wrapper.cpp @@ -236,7 +236,7 @@ uint CertManager::get_privateKeyLength() const int CertManager::Validate() { CertList::reverse_iterator last = peerList_.rbegin(); - int count = peerList_.size(); + size_t count= peerList_.size(); while ( count > 1 ) { TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); @@ -269,13 +269,13 @@ int CertManager::Validate() else peerKeyType_ = dsa_sa_algo; - int iSz = strlen(cert.GetIssuer()) + 1; - int sSz = strlen(cert.GetCommonName()) + 1; - int bSz = strlen(cert.GetBeforeDate()) + 1; - int aSz = strlen(cert.GetAfterDate()) + 1; + size_t iSz= strlen(cert.GetIssuer()) + 1; + size_t sSz= strlen(cert.GetCommonName()) + 1; + size_t bSz= strlen(cert.GetBeforeDate()) + 1; + size_t aSz= strlen(cert.GetAfterDate()) + 1; peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), - sSz, cert.GetBeforeDate(), bSz, - cert.GetAfterDate(), aSz); + sSz, cert.GetBeforeDate(), (int) bSz, + cert.GetAfterDate(), (int) aSz); } return 0; } diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index f09a43be56e..781cfa36a70 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -604,13 +604,13 @@ char* X509_NAME_oneline(X509_NAME* name, char* buffer, int sz) { if (!name->GetName()) return buffer; - int len = strlen(name->GetName()) + 1; - int copySz = min(len, sz); + size_t len= strlen(name->GetName()) + 1; + int copySz = min((int) len, sz); if (!buffer) { buffer = (char*)malloc(len); if (!buffer) return buffer; - copySz = len; + copySz = (int) len; } if (copySz == 0) diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index b43d9c27355..4ee0fb99d3a 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -532,7 +532,7 @@ void Parameters::SetCipherNames() for (int j = 0; j < suites; j++) { int index = suites_[j*2 + 1]; // every other suite is suite id - int len = strlen(cipher_names[index]) + 1; + size_t len = strlen(cipher_names[index]) + 1; strncpy(cipher_list_[pos++], cipher_names[index], len); } cipher_list_[pos][0] = 0; diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 0b6cb89e77e..ba8ee8f66ab 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1034,7 +1034,7 @@ void SSL::fillData(Data& data) { if (GetError()) return; uint dataSz = data.get_length(); // input, data size to fill - uint elements = buffers_.getData().size(); + size_t elements = buffers_.getData().size(); data.set_length(0); // output, actual data filled dataSz = min(dataSz, bufferedData()); @@ -1064,7 +1064,7 @@ void SSL::PeekData(Data& data) { if (GetError()) return; uint dataSz = data.get_length(); // input, data size to fill - uint elements = buffers_.getData().size(); + size_t elements = buffers_.getData().size(); data.set_length(0); // output, actual data filled dataSz = min(dataSz, bufferedData()); @@ -1098,7 +1098,7 @@ void SSL::flushBuffer() buffers_.getHandShake().end(), SumBuffer()).total_; output_buffer out(sz); - uint elements = buffers_.getHandShake().size(); + size_t elements = buffers_.getHandShake().size(); for (uint i = 0; i < elements; i++) { output_buffer* front = buffers_.getHandShake().front(); @@ -1906,7 +1906,7 @@ bool SSL_CTX::SetCipherList(const char* list) int idx = 0; for(;;) { - int len; + size_t len; prev = haystack; haystack = strstr(haystack, needle); @@ -2354,10 +2354,10 @@ ASN1_STRING* X509_NAME::GetEntry(int i) memcpy(entry_.data, &name_[i], sz_ - i); if (entry_.data[sz_ -i - 1]) { entry_.data[sz_ - i] = 0; - entry_.length = sz_ - i; + entry_.length = (int) (sz_ - i); } else - entry_.length = sz_ - i - 1; + entry_.length = (int) (sz_ - i - 1); entry_.type = 0; return &entry_; diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 529a91eee08..bb34db5e07f 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, if (preserve) { A b = A(); typename A::pointer newPointer = b.allocate(newSize, 0); - memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); + memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize)); a.deallocate(p, oldSize); STL::swap(a, b); return newPointer; diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index cb597c41552..c221ce3d6cb 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base, r = buckets[i][buckets[i].size()-1]; if (buckets[i].size() > 1) { - for (int j = buckets[i].size()-2; j >= 1; j--) + for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--) { Accumulate(buckets[i][j], buckets[i][j+1]); Accumulate(r, buckets[i][j]); diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index a06ab658c7b..3b1c1c2136a 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -213,7 +213,7 @@ void PublicKey::AddToEnd(const byte* data, word32 len) Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h) : key_(k, kSz) { - int sz = strlen(n); + size_t sz = strlen(n); memcpy(name_, n, sz); name_[sz] = 0; diff --git a/heap/hp_write.c b/heap/hp_write.c index 19215fcf017..6aa34acf2c3 100644 --- a/heap/hp_write.c +++ b/heap/hp_write.c @@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const byte *record) err: if (my_errno == HA_ERR_FOUND_DUPP_KEY) DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef))); - info->errkey= keydef - share->keydef; + info->errkey= (int) (keydef - share->keydef); /* We don't need to delete non-inserted key from rb-tree. Also, if we got ENOMEM, the key wasn't inserted, so don't try to delete it diff --git a/include/my_global.h b/include/my_global.h index f5a3016bb1e..53b5deaffb1 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -831,9 +831,19 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif #ifdef HAVE_ISINF -/* isinf() can be used in both C and C++ code */ -#define my_isinf(X) isinf(X) +/* Check if C compiler is affected by GCC bug #39228 */ +#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF) +/* Force store/reload of the argument to/from a 64-bit double */ +static inline double my_isinf(double x) +{ + volatile double t= x; + return isinf(t); +} #else +/* System-provided isinf() is available and safe to use */ +#define my_isinf(X) isinf(X) +#endif +#else /* !HAVE_ISINF */ #define my_isinf(X) (!finite(X) && !isnan(X)) #endif diff --git a/include/my_md5.h b/include/my_md5.h index f92976b3beb..6458f27c5cc 100644 --- a/include/my_md5.h +++ b/include/my_md5.h @@ -13,80 +13,42 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* See md5.c for explanation and copyright information. */ -/* MD5.H - header file for MD5C.C +/* + * $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $ */ -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. +/* Unlike previous versions of this code, uint32 need not be exactly + 32 bits, merely 32 bits or more. Choosing a data type which is 32 + bits instead of 64 is not important; speed is considerably more + important. ANSI guarantees that "unsigned long" will be big enough, + and always using it seems to have few disadvantages. */ +typedef uint32 cvs_uint32; -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -/* GLOBAL.H - RSAREF types and constants - */ - -/* PROTOTYPES should be set to one if and only if the compiler supports - function argument prototyping. -The following makes PROTOTYPES default to 0 if it has not already - been defined with C compiler flags. - */ - -/* egcs 1.1.2 under linux didn't defined it.... :( */ - -#ifndef PROTOTYPES -#define PROTOTYPES 1 /* Assume prototypes */ -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -/* UINT2 defines a two byte word */ -typedef uint16 UINT2; /* Fix for MySQL / Alpha */ - -/* UINT4 defines a four byte word */ -typedef uint32 UINT4; /* Fix for MySQL / Alpha */ - -/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. -If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. - */ -#if PROTOTYPES -#define PROTO_LIST(list) list -#else -#define PROTO_LIST(list) () -#endif -/* MD5 context. */ typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} my_MD5_CTX; + cvs_uint32 buf[4]; + cvs_uint32 bits[2]; + unsigned char in[64]; +} my_MD5Context; #ifdef __cplusplus extern "C" { #endif - void my_MD5Init PROTO_LIST ((my_MD5_CTX *)); - void my_MD5Update PROTO_LIST - ((my_MD5_CTX *, unsigned char *, unsigned int)); - void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *)); +void my_MD5Init (my_MD5Context *context); +void my_MD5Update (my_MD5Context *context, + unsigned char const *buf, unsigned len); +void my_MD5Final (unsigned char digest[16], + my_MD5Context *context); #ifdef __cplusplus } #endif + +#define MY_MD5_HASH(digest,buf,len) \ +do { \ + my_MD5Context ctx; \ + my_MD5Init (&ctx); \ + my_MD5Update (&ctx, buf, len); \ + my_MD5Final (digest, &ctx); \ +} while (0) diff --git a/include/my_sys.h b/include/my_sys.h index 5dc73bf84d9..35c4eb5f2b1 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -250,7 +250,7 @@ extern int NEAR my_umask, /* Default creation mask */ NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ NEAR my_dont_interrupt; /* call remember_intr when set */ extern my_bool NEAR mysys_uses_curses, my_use_symdir; -extern ulong sf_malloc_cur_memory, sf_malloc_max_memory; +extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; extern ulong my_default_record_cache_size; extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, @@ -636,6 +636,7 @@ extern int nt_share_delete(const char *name,myf MyFlags); extern void TERMINATE(FILE *file); #endif extern void init_glob_errs(void); +extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); extern int my_fclose(FILE *fd,myf MyFlags); diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h index 62a41a881e8..5c81e331487 100644 --- a/innobase/include/pars0pars.h +++ b/innobase/include/pars0pars.h @@ -484,7 +484,7 @@ struct for_node_struct{ definition */ que_node_t* loop_start_limit;/* initial value of loop variable */ que_node_t* loop_end_limit; /* end value of loop variable */ - int loop_end_value; /* evaluated value for the end value: + lint loop_end_value; /* evaluated value for the end value: it is calculated only when the loop is entered, and will not change within the loop */ diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c index c62184abd85..562870b6bed 100644 --- a/innobase/pars/pars0pars.c +++ b/innobase/pars/pars0pars.c @@ -1679,8 +1679,8 @@ pars_get_lex_chars( { int len; - len = pars_sym_tab_global->string_len - - pars_sym_tab_global->next_char_pos; + len= (uint) (pars_sym_tab_global->string_len + - pars_sym_tab_global->next_char_pos); if (len == 0) { #ifdef YYDEBUG /* fputs("SQL string ends\n", stderr); */ diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c index 6a463b7d4cf..a0c28e117ac 100644 --- a/innobase/rem/rem0cmp.c +++ b/innobase/rem/rem0cmp.c @@ -587,7 +587,7 @@ cmp_dtuple_rec_with_match( dtuple_byte = cmp_collate(dtuple_byte); } - ret = dtuple_byte - rec_byte; + ret = (uint) (dtuple_byte - rec_byte); if (UNIV_UNLIKELY(ret)) { if (ret < 0) { ret = -1; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 2a5e1cc657b..d18ed04e273 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3552,7 +3552,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, */ char *start= value + param->offset; char *end= value + length; - ulong copy_length; + size_t copy_length; if (start < end) { copy_length= end - start; @@ -3807,11 +3807,11 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, if (field->flags & ZEROFILL_FLAG && length < field->length && field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1) { - bmove_upp((char*) buff + field->length, buff + length, length); + bmove_upp((char*) buff + field->length, buff + length, (uint) length); bfill((char*) buff, field->length - length, '0'); length= field->length; } - fetch_string_with_conversion(param, buff, length); + fetch_string_with_conversion(param, buff, (uint) length); } break; diff --git a/libmysql/manager.c b/libmysql/manager.c index 631bfa26cb2..3260ddcd685 100644 --- a/libmysql/manager.c +++ b/libmysql/manager.c @@ -159,7 +159,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, goto err; } sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd); - msg_len=strlen(msg_buf); + msg_len= (uint) strlen(msg_buf); if (my_net_write(&con->net,msg_buf,msg_len) || net_flush(&con->net)) { con->last_errno=con->net.last_errno; @@ -219,7 +219,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd, int cmd_len) { if (!cmd_len) - cmd_len=strlen(cmd); + cmd_len= (uint) strlen(cmd); if (my_net_write(&con->net,(char*)cmd,cmd_len) || net_flush(&con->net)) { con->last_errno=errno; diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 4f8883f377e..285a31d34c6 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -659,7 +659,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull, uchar *key) { uint first_null, kp; - first_null= ha_find_null(keyseg, key) - keyseg; + first_null= (uint) (ha_find_null(keyseg, key) - keyseg); /* All prefix tuples that don't include keypart_{first_null} are not-null tuples (and all others aren't), increment counters for them. @@ -715,7 +715,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull, seg= keyseg + diffs[0] - 1; /* Find first NULL in last_key */ - first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg; + first_null_seg= (uint) (ha_find_null(seg, last_key + diffs[1]) - keyseg); for (kp= 0; kp < first_null_seg; kp++) notnull[kp]++; @@ -3913,7 +3913,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) key_block++; sort_info->key_block=key_block; sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo; - ft_buf->count=(ft_buf->buf - p)/val_len; + ft_buf->count=(uint) (ft_buf->buf - p)/val_len; /* flushing buffer to second-level tree */ for (error=0; !error && p < ft_buf->buf; p+= val_len) diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 8e2f61a3b4b..d9b7f6453db 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -112,7 +112,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) share_buff.state.rec_per_key_part=rec_per_key_part; share_buff.state.key_root=key_root; share_buff.state.key_del=key_del; - share_buff.key_cache= multi_key_cache_search(name_buff, strlen(name_buff)); + share_buff.key_cache= multi_key_cache_search(name_buff, + (uint) strlen(name_buff)); DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open", if (strstr(name, "/t1")) @@ -314,7 +315,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) (char*) key_del, (sizeof(my_off_t) * share->state.header.max_block_size)); strmov(share->unique_file_name, name_buff); - share->unique_name_length= strlen(name_buff); + share->unique_name_length= (uint) strlen(name_buff); strmov(share->index_file_name, index_name); strmov(share->data_file_name, data_name); diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 63d624a1445..df9a4d18a6c 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -254,7 +254,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) MYF(MY_HOLD_ON_ERROR)); /* Fix the table addresses in the tree heads. */ { - long diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); + my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); share->decode_tables=decode_table; for (i=0 ; i < trees ; i++) share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, @@ -1430,6 +1430,32 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff) bit_buff->current_byte=0; return; } + else + { + uint len= 0; + uint i= 0; + /* + Check if the remaining buffer/record to read is less than the word size. + If so read byte by byte + + Note: if this branch becomes a bottleneck it can be removed, assuming + that the second memory segment allocates 7 extra bytes (see + _mi_read_pack_info()). + */ + len= bit_buff->end - bit_buff->pos; + if (len < (BITS_SAVED / 8)) + { + bit_buff->current_byte= 0; + for (i=0 ; i < len ; i++) + { + bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1])) + << (8 * i)); + } + bit_buff->pos= bit_buff->end; + return; + } + } + #if BITS_SAVED == 64 bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) + (((uint) ((uchar) bit_buff->pos[6])) << 8) + diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 530be5e042f..795c7ee55c3 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -408,7 +408,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, } from+=keyseg->length; page=from+nod_flag; - length=from-vseg; + length= (uint) (from - vseg); } if (page > end) diff --git a/myisam/rt_index.c b/myisam/rt_index.c index df8964edc20..494eccd38e4 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -95,7 +95,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -117,7 +117,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = last - page_buf; + *saved_key = (uint) (last - page_buf); if (after_key < last) { @@ -314,7 +314,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -333,7 +333,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); if (after_key < last) { @@ -420,7 +420,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, key, k_len + info->s->base.rec_reflength); - *(int*)info->int_keypos = key - info->buff; + *(uint*)info->int_keypos = (uint) (key - info->buff); if (after_key >= info->int_maxpos) { info->buff_used = 1; diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index 3239030bb64..752155a8dbd 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -3,29 +3,49 @@ # in test cases and can be reused. # ###################################################### -# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to -# 'grep' call -# This test is disabled on Windows via the next line until the above bug is -# resolved ---source include/not_windows.inc - --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT -# there is no neat way to find the backupid, this is a hack to find it... +# To find the backupid, we must dump this data to a table, and SELECT +# what we want into an outfile. This could be accomplished with grep, but +# grep isn't Windows-portable ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +--disable_query_log +# create a table to help us out +--disable_warnings # leave this on until done with the entire process +# cleanup +DROP TABLE IF EXISTS helper1; +CREATE TABLE helper1(c1 VARCHAR(20)); +# dump raw data to file +let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat; +let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat; +--error 0,1 +--remove_file $ndb_backup_file1 +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1 +# load the table from the raw data file +eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1; +--remove_file $ndb_backup_file1 +# output what we need +eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%' +INTO OUTFILE '$ndb_backup_file2'; +# cleanup +DROP TABLE helper1; +--enable_warnings +--enable_query_log -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +--replace_result $MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$ndb_backup_file2' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +--remove_file $ndb_backup_file2 --replace_column 1 SELECT @the_backup_id:=backup_id FROM test.backup_info; - -let the_backup_id=`select @the_backup_id`; +let $the_backup_id=`SELECT @the_backup_id`; DROP TABLE test.backup_info; diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc index 41348bee129..56d2b0b1dcd 100644 --- a/mysql-test/include/wait_until_count_sessions.inc +++ b/mysql-test/include/wait_until_count_sessions.inc @@ -2,14 +2,23 @@ # # SUMMARY # -# Waits until the passed number ($count_sessions) of concurrent sessions was -# observed via +# Waits until the passed number ($count_sessions) of concurrent sessions or +# a smaller number was observed via # SHOW STATUS LIKE 'Threads_connected' # or the operation times out. -# Note: Starting with 5.1 we could also use -# SELECT COUNT(*) FROM information_schema.processlist -# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this -# runs in all versions 5.0+ +# Note: +# 1. We wait for $current_sessions <= $count_sessions because in the use case +# with count_sessions.inc before and wait_until_count_sessions.inc after +# the core of the test it could happen that the disconnects of sessions +# belonging to the preceeding test are not finished. +# sessions at test begin($count_sessions) = m + n +# sessions of the previous test which will be soon disconnected = n (n >= 0) +# sessions at test end ($current sessions, assuming the test disconnects +# all additional sessions) = m +# 2. Starting with 5.1 we could also use +# SELECT COUNT(*) FROM information_schema.processlist +# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this +# runs in all versions 5.0+ # # # USAGE @@ -19,7 +28,7 @@ # # OR typical example of a test which uses more than one session # Such a test could harm successing tests if there is no server shutdown -# and start between.cw +# and start between. # # If the testing box is slow than the disconnect of sessions belonging to # the current test might happen when the successing test gets executed. @@ -79,7 +88,11 @@ # backup.test, grant3.test # # -# Created: 2009-01-14 mleich +# Created: +# 2009-01-14 mleich +# Modified: +# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive, +# random PB failures # let $wait_counter= 100; @@ -93,7 +106,7 @@ let $wait_timeout= 0; while ($wait_counter) { let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); - let $success= `SELECT $current_sessions = $count_sessions`; + let $success= `SELECT $current_sessions <= $count_sessions`; if ($success) { let $wait_counter= 0; @@ -107,7 +120,7 @@ while ($wait_counter) if (!$success) { --echo # Timeout in wait_until_count_sessions.inc - --echo # Number of sessions expected: $count_sessions found: $current_sessions + --echo # Number of sessions expected: <= $count_sessions found: $current_sessions SHOW PROCESSLIST; } diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc new file mode 100644 index 00000000000..a4362e52d01 --- /dev/null +++ b/mysql-test/include/wait_until_disconnected.inc @@ -0,0 +1,21 @@ +# +# Include this script to wait until the connection to the +# server has been dropped +--disable_result_log +--disable_query_log +let $counter= 500; +let $mysql_errno= 0; +while (!$mysql_errno) +{ + --error 0,1053,2002,2006,2013 + show status; + + dec $counter; + if (!$counter) + { + --die Server failed to dissapear + } + --sleep 0.1 +} +--enable_query_log +--enable_result_log diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result index 90606abbe4e..694c996a58e 100644 --- a/mysql-test/r/consistent_snapshot.result +++ b/mysql-test/r/consistent_snapshot.result @@ -1,15 +1,23 @@ -drop table if exists t1; -create table t1 (a int) engine=innodb; -start transaction with consistent snapshot; -insert into t1 values(1); -select * from t1; +DROP TABLE IF EXISTS t1; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Switch to connection con1 +CREATE TABLE t1 (a INT) ENGINE=innodb; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +# Switch to connection con2 +INSERT INTO t1 VALUES(1); +# Switch to connection con1 +SELECT * FROM t1; a -commit; -delete from t1; -start transaction; -insert into t1 values(1); -select * from t1; +COMMIT; +DELETE FROM t1; +START TRANSACTION; +# Switch to connection con2 +INSERT INTO t1 VALUES(1); +# Switch to connection con1 +SELECT * FROM t1; a 1 -commit; -drop table t1; +COMMIT; +# Switch to connection default + close connections con1 and con2 +DROP TABLE t1; diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 7e9513f06e9..8bcd488cb69 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -611,3 +611,22 @@ check table t1 extended; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); +least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) +a +create table t1 +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` varchar(1) character set latin5 NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate +latin5_turkish_ci then 2 else 3 end; +case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate +latin5_turkish_ci then 2 else 3 end +3 +select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); +concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) +abc diff --git a/mysql-test/r/dirty_close.result b/mysql-test/r/dirty_close.result index c4fc19a35f8..b49b72f1b95 100644 --- a/mysql-test/r/dirty_close.result +++ b/mysql-test/r/dirty_close.result @@ -1,9 +1,9 @@ -drop table if exists t1; -create table t1 (n int); -insert into t1 values (1),(2),(3); -select * from t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; n 1 2 3 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 3aa189f4a9d..b0adc428e4c 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -155,3 +155,7 @@ id select_type table type possible_keys key key_len ref rows Extra Warnings: Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` DROP TABLE t1,t2; +CREATE TABLE t1 (a INT PRIMARY KEY); +EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a); +ERROR HY000: Key 'a' doesn't exist in table 't1' +DROP TABLE t1; diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index f0de3e9b04a..026886cb07d 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -2094,6 +2094,26 @@ SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b; a DROP TABLE t1; DROP TABLE t1; +# +# BUG#21360 - mysqldump error on federated tables +# +#Switch to Connection Slave +CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)); +INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4'); +#Switch to Connection Master +CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +# Dump table t1 using mysqldump tool +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` varchar(20) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE t1; +#Switch to Connection Slave +DROP TABLE t1; End of 5.0 tests SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT; SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result index d5b10868358..d2197beaaab 100644 --- a/mysql-test/r/flush_block_commit.result +++ b/mysql-test/r/flush_block_commit.result @@ -1,39 +1,57 @@ -drop table if exists t1; -create table t1 (a int) engine=innodb; -begin; -insert into t1 values(1); -flush tables with read lock; -select * from t1; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Establish connection con3 (user=root) +# Switch to connection con1 +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT) ENGINE=innodb; +BEGIN; +INSERT INTO t1 VALUES(1); +# Switch to connection con2 +FLUSH TABLES WITH READ LOCK; +SELECT * FROM t1; a -commit; -select * from t1; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 +SELECT * FROM t1; a -unlock tables; -begin; -select * from t1 for update; +UNLOCK TABLES; +# Switch to connection con1 +# Switch to connection con1 +BEGIN; +SELECT * FROM t1 FOR UPDATE; a 1 -begin; -select * from t1 for update; -flush tables with read lock; -commit; +# Switch to connection con2 +BEGIN; +SELECT * FROM t1 FOR UPDATE; +# Switch to connection con3 +FLUSH TABLES WITH READ LOCK; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 a 1 -unlock tables; -commit; -begin; -insert into t1 values(10); -flush tables with read lock; -commit; -unlock tables; -flush tables with read lock; -unlock tables; -begin; -select * from t1; +# Switch to connection con3 +UNLOCK TABLES; +# Switch to connection con2 +COMMIT; +# Switch to connection con1 +BEGIN; +INSERT INTO t1 VALUES(10); +FLUSH TABLES WITH READ LOCK; +COMMIT; +UNLOCK TABLES; +# Switch to connection con2 +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +BEGIN; +SELECT * FROM t1; a 1 10 -show create database test; +SHOW CREATE DATABASE test; Database Create Database test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ -drop table t1; +DROP TABLE t1; +# Switch to connection default and close connections con1, con2, con3 diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result index 599efeb3e2d..76c55e948dd 100644 --- a/mysql-test/r/flush_block_commit_notembedded.result +++ b/mysql-test/r/flush_block_commit_notembedded.result @@ -1,15 +1,23 @@ -create table t1 (a int) engine=innodb; -reset master; -set autocommit=0; -insert t1 values (1); -flush tables with read lock; -show master status; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Switch to connection con1 +CREATE TABLE t1 (a INT) ENGINE=innodb; +RESET MASTER; +SET AUTOCOMMIT=0; +INSERT t1 VALUES (1); +# Switch to connection con2 +FLUSH TABLES WITH READ LOCK; +SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 98 -commit; -show master status; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 +SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 98 -unlock tables; -drop table t1; -set autocommit=1; +UNLOCK TABLES; +# Switch to connection con1 +DROP TABLE t1; +SET AUTOCOMMIT=1; +# Switch to connection default and close connections con1 and con2 diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result index 6703b6bd533..b16a8b114b3 100644 --- a/mysql-test/r/flush_read_lock_kill.result +++ b/mysql-test/r/flush_read_lock_kill.result @@ -1,9 +1,12 @@ -drop table if exists t1; -create table t1 (kill_id int); -insert into t1 values(connection_id()); -flush tables with read lock; -select ((@id := kill_id) - kill_id) from t1; +SET @old_concurrent_insert= @@global.concurrent_insert; +SET @@global.concurrent_insert= 0; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (kill_id INT); +INSERT INTO t1 VALUES(connection_id()); +FLUSH TABLES WITH READ LOCK; +SELECT ((@id := kill_id) - kill_id) FROM t1; ((@id := kill_id) - kill_id) 0 -kill connection @id; -drop table t1; +KILL CONNECTION @id; +DROP TABLE t1; +SET @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index 0430d560a7a..d1b50a0080c 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock UNLOCK TABLES; DROP DATABASE mysqltest_1; ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist -use mysql; +USE mysql; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; FLUSH TABLES; -use mysql; +USE mysql; SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; OPTIMIZE TABLES columns_priv, db, host, user; Table Op Msg_type Msg_text @@ -65,7 +65,7 @@ mysql.user optimize status OK UNLOCK TABLES; Select_priv N -use test; +USE test; use test; CREATE TABLE t1 (c1 int); LOCK TABLE t1 WRITE; @@ -93,7 +93,7 @@ create table t1 (a int); connection: locker lock tables t1 read; connection: writer -create table t2 like t1;; +create table t2 like t1; connection: default kill query ERROR 70100: Query execution was interrupted diff --git a/mysql-test/r/lock_multi_bug38499.result b/mysql-test/r/lock_multi_bug38499.result new file mode 100644 index 00000000000..fd0f2138a8d --- /dev/null +++ b/mysql-test/r/lock_multi_bug38499.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1( a INT, b INT ); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); +# 1. test regular tables +# 1.1. test altering of columns that multiupdate doesn't use +# 1.1.1. normal mode +# 1.1.2. PS mode +# 1.2. test altering of columns that multiupdate uses +# 1.2.1. normal mode +# 1.2.2. PS mode +ALTER TABLE t1 ADD COLUMN a INT; +# 2. test UNIONs +# 2.1. test altering of columns that multiupdate doesn't use +# 2.1.1. normal mode +# 2.1.2. PS mode +# 2.2. test altering of columns that multiupdate uses +# 2.2.1. normal mode +# 2.2.2. PS mode +DROP TABLE t1; diff --git a/mysql-test/r/lock_multi_bug38691.result b/mysql-test/r/lock_multi_bug38691.result new file mode 100644 index 00000000000..74b9603d8e3 --- /dev/null +++ b/mysql-test/r/lock_multi_bug38691.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS t1,t2,t3; +CREATE TABLE t1 ( +a int(11) unsigned default NULL, +b varchar(255) default NULL, +UNIQUE KEY a (a), +KEY b (b) +); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); +CREATE TABLE t2 SELECT * FROM t1; +CREATE TABLE t3 SELECT * FROM t1; +# test altering of columns that multiupdate doesn't use +# normal mode +# PS mode +# test altering of columns that multiupdate uses +# normal mode +# PS mode +DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index 5f39d318234..b4b200549a5 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -27,3 +27,14 @@ CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# BUG#41541 - Valgrind warnings on packed MyISAM table +# +CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT); +INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1'); +FLUSH TABLE t1; +# Compress the table using MYISAMPACK tool +SELECT COUNT(*) FROM t1; +COUNT(*) +1024 +DROP TABLE t1; diff --git a/mysql-test/r/mysql-bug41486.result b/mysql-test/r/mysql-bug41486.result new file mode 100644 index 00000000000..454b5888b49 --- /dev/null +++ b/mysql-test/r/mysql-bug41486.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS t1; +SET @old_max_allowed_packet= @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024; +CREATE TABLE t1(data LONGBLOB); +INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024); +SELECT LENGTH(data) FROM t1; +LENGTH(data) +2097152 +DROP TABLE t1; +SET @@global.max_allowed_packet = @old_max_allowed_packet; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 6e5aa09fe92..23244d2b3c4 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -349,9 +349,9 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; CREATE TABLE t1 (c1 CHAR(10)); -flush logs; +FLUSH LOGS; INSERT INTO t1 VALUES ('0123456789'); -flush logs; +FLUSH LOGS; DROP TABLE t1; We expect this value to be 1 The bug being tested was that 'Query' lines were not preceded by '#' @@ -361,23 +361,23 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%'; BUG#28293_expect_1 1 DROP TABLE patch; -flush logs; -create table t1(a int); -insert into t1 values(connection_id()); -flush logs; -drop table t1; +FLUSH LOGS; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(connection_id()); +FLUSH LOGS; +DROP TABLE t1; 1 -drop table t1; +DROP TABLE t1; shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql -set @@global.server_id= 4294967295; -reset master; -flush logs; -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) -is not null +SET @@global.server_id= 4294967295; +RESET MASTER; +FLUSH LOGS; +SELECT +(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) +IS NOT NULL; +(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) +IS NOT NULL 1 *** Unsigned server_id 4294967295 is found: 1 *** -set @@global.server_id= 1; +SET @@global.server_id= 1; End of 5.0 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 49430a5c62d..1897a7df799 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3559,6 +3559,60 @@ DROP TABLE t1,t2; -- Dump completed on DATE SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; # +# Bug #42635: mysqldump includes views that were excluded using +# the --ignore-table option +# +create database db42635; +use db42635; +create table t1 (id int); +create view db42635.v1 (c) as select * from db42635.t1; +create view db42635.v2 (c) as select * from db42635.t1; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE TABLE `v2` ( + `c` int(11) +) ENGINE=MyISAM */; +/*!50001 DROP TABLE `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t1`.`id` AS `c` from `t1` */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +use test; +drop database db42635; +# # Bug#33550 mysqldump 4.0 compatibility broken # SET NAMES utf8; diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result index c48333f6ea8..05a94b143f3 100644 --- a/mysql-test/r/ndb_restore.result +++ b/mysql-test/r/ndb_restore.result @@ -129,9 +129,11 @@ create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; create table t10 engine=myisam as select * from t10_c; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/ndb_restore_print.result b/mysql-test/r/ndb_restore_print.result index e05f8e43d1a..8b50303c2dc 100644 --- a/mysql-test/r/ndb_restore_print.result +++ b/mysql-test/r/ndb_restore_print.result @@ -227,9 +227,11 @@ hex(h3) NULL hex(i1) NULL hex(i2) NULL hex(i3) NULL -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -261,9 +263,11 @@ create table t4 (pk int key, a int) engine ndb; insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15); insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25); insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -305,9 +309,11 @@ create table t1 insert into t1 values(1, 8388607, 16777215); insert into t1 values(2, -8388608, 0); insert into t1 values(3, -1, 1); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 1bf99a8ea07..4b405ddd71a 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt' drop table t1,t2; drop user test@localhost; # -# Bug #27440 read_only allows create and drop database +# Bug#27440 read_only allows create and drop database # drop database if exists mysqltest_db1; drop database if exists mysqltest_db2; diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index 7a5d09ea6a7..ac23fb2ccd2 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -153,4 +153,23 @@ a b SET @@session.time_zone = default; DROP TABLE t1; SET @@session.time_zone = default; +reset master; +CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); +SET @@session.time_zone='+01:00'; +insert into t1 values('2008-12-23 19:39:39',1); +SET @@session.time_zone='+02:00'; +insert delayed into t1 values ('2008-12-23 19:39:39',2); +flush table t1; +flush logs; +select * from t1; +date a +2008-12-23 20:39:39 1 +2008-12-23 19:39:39 2 +DROP TABLE t1; +select * from t1 order by a; +date a +2008-12-23 20:39:39 1 +2008-12-23 19:39:39 2 +DROP TABLE t1; +SET @@session.time_zone = default; End of 5.0 tests diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result index 09adebad10f..9d555e9878c 100644 --- a/mysql-test/r/shm.result +++ b/mysql-test/r/shm.result @@ -2152,4 +2152,11 @@ Warnings: Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; mysqld is alive +SET @max_allowed_packet= @@global.max_allowed_packet; +SET @net_buffer_length= @@global.net_buffer_length; +SET GLOBAL max_allowed_packet= 1024; +SET GLOBAL net_buffer_length= 1024; +ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes +SET GLOBAL max_allowed_packet= @max_allowed_packet; +SET GLOBAL net_buffer_length= @net_buffer_length; End of 5.0 tests. diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 15f28fb9610..ad73fc650a5 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -507,9 +507,9 @@ ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql drop table mysqltest.t1; drop database mysqltest; set names binary; -delete from mysql.user +delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; -delete from mysql.db +delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; flush privileges; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY; @@ -916,7 +916,7 @@ def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33 Trigger Event Table Statement Timing Created sql_mode Definer t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost ---------------------------------------------------------------- -SELECT +SELECT TRIGGER_CATALOG, TRIGGER_SCHEMA, TRIGGER_NAME, diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result index 8ef52e75238..47741fed250 100644 --- a/mysql-test/r/skip_name_resolve.result +++ b/mysql-test/r/skip_name_resolve.result @@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255'; DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; -select user(); -user() +SELECT USER(); +USER() # -show processlist; +SHOW PROCESSLIST; Id User Host db Command Time State Info root test