Commit 28a18fef authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.50' into ubuntu-14.04

Upstream version 5.5.50
parents 3747036d 95c6357a
...@@ -254,8 +254,10 @@ IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE) ...@@ -254,8 +254,10 @@ IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
ENDIF() ENDIF()
MY_CHECK_C_COMPILER_FLAG(-ggdb3 HAVE_GGDB3) MY_CHECK_C_COMPILER_FLAG(-ggdb3 HAVE_GGDB3)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3") IF(HAVE_GGDB3)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3")
ENDIF()
OPTION(ENABLED_LOCAL_INFILE OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN}) "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
......
commit: 0991e19e9d38f7475390276c0557c2390e4d93c9 commit: 12ae840375fe30da1c23647facaa0678858d6d92
date: 2016-04-20 20:25:46 +0200 date: 2016-06-16 22:04:24 +0300
build-date: 2016-04-20 22:44:41 +0200 build-date: 2016-06-16 21:08:07 +0200
short: 0991e19e short: 12ae840
branch: HEAD branch: HEAD
MySQL source 5.5.49 MySQL source 5.5.50
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=49 MYSQL_VERSION_PATCH=50
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=
...@@ -4898,11 +4898,11 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) ...@@ -4898,11 +4898,11 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
{ {
if (!inited) if (!inited)
{ {
int errret;
inited=1;
#ifdef HAVE_SETUPTERM #ifdef HAVE_SETUPTERM
int errret;
have_curses= setupterm((char *)0, 1, &errret) != ERR; have_curses= setupterm((char *)0, 1, &errret) != ERR;
#endif #endif
inited=1;
} }
if (info_type == INFO_ERROR) if (info_type == INFO_ERROR)
{ {
......
...@@ -232,8 +232,6 @@ my_bool ...@@ -232,8 +232,6 @@ my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
int error = 0;
switch(optid) { switch(optid) {
case 'c': case 'c':
opt_count_iterations= 1; opt_count_iterations= 1;
...@@ -281,8 +279,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -281,8 +279,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case '?': case '?':
case 'I': /* Info */ case 'I': /* Info */
error++; usage();
break; exit(0);
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300 #if MYSQL_VERSION_ID > 32300
charsets_dir = argument; charsets_dir = argument;
...@@ -293,11 +291,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -293,11 +291,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt->name); opt->name);
break; break;
} }
if (error)
{
usage();
exit(1);
}
return 0; return 0;
} }
......
...@@ -238,7 +238,7 @@ static void dbDisconnect(char *host); ...@@ -238,7 +238,7 @@ static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when); static void DBerror(MYSQL *mysql, const char *when);
static void safe_exit(int error); static void safe_exit(int error);
static void print_result(); static void print_result();
static uint fixed_name_length(const char *name); static size_t fixed_name_length(const char *name);
static char *fix_table_name(char *dest, char *src); static char *fix_table_name(char *dest, char *src);
int what_to_do = 0; int what_to_do = 0;
...@@ -583,10 +583,10 @@ static int process_selected_tables(char *db, char **table_names, int tables) ...@@ -583,10 +583,10 @@ static int process_selected_tables(char *db, char **table_names, int tables)
} /* process_selected_tables */ } /* process_selected_tables */
static uint fixed_name_length(const char *name) static size_t fixed_name_length(const char *name)
{ {
const char *p; const char *p;
uint extra_length= 2; /* count the first/last backticks */ size_t extra_length= 2; /* count the first/last backticks */
DBUG_ENTER("fixed_name_length"); DBUG_ENTER("fixed_name_length");
for (p= name; *p; p++) for (p= name; *p; p++)
...@@ -594,7 +594,7 @@ static uint fixed_name_length(const char *name) ...@@ -594,7 +594,7 @@ static uint fixed_name_length(const char *name)
if (*p == '`') if (*p == '`')
extra_length++; extra_length++;
} }
DBUG_RETURN((uint) ((p - name) + extra_length)); DBUG_RETURN((size_t) ((p - name) + extra_length));
} }
...@@ -653,7 +653,7 @@ static int process_all_tables_in_db(char *database) ...@@ -653,7 +653,7 @@ static int process_all_tables_in_db(char *database)
*/ */
char *tables, *end; char *tables, *end;
uint tot_length = 0; size_t tot_length = 0;
char *views, *views_end; char *views, *views_end;
uint tot_views_length = 0; uint tot_views_length = 0;
...@@ -756,7 +756,9 @@ static int fix_table_storage_name(const char *name) ...@@ -756,7 +756,9 @@ static int fix_table_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
sprintf(qbuf, "RENAME TABLE `%s` TO `%s`", name, name + 9); my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE `%s` TO `%s`",
name, name + 9);
rc= run_query(qbuf); rc= run_query(qbuf);
if (verbose) if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
...@@ -771,7 +773,8 @@ static int fix_database_storage_name(const char *name) ...@@ -771,7 +773,8 @@ static int fix_database_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
sprintf(qbuf, "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME", name); my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY "
"NAME", name);
rc= run_query(qbuf); rc= run_query(qbuf);
if (verbose) if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
...@@ -791,7 +794,7 @@ static int rebuild_table(char *name) ...@@ -791,7 +794,7 @@ static int rebuild_table(char *name)
ptr= strmov(query, "ALTER TABLE "); ptr= strmov(query, "ALTER TABLE ");
ptr= fix_table_name(ptr, name); ptr= fix_table_name(ptr, name);
ptr= strxmov(ptr, " FORCE", NullS); ptr= strxmov(ptr, " FORCE", NullS);
if (mysql_real_query(sock, query, (uint)(ptr - query))) if (mysql_real_query(sock, query, (ulong)(ptr - query)))
{ {
fprintf(stderr, "Failed to %s\n", query); fprintf(stderr, "Failed to %s\n", query);
fprintf(stderr, "Error: %s\n", mysql_error(sock)); fprintf(stderr, "Error: %s\n", mysql_error(sock));
...@@ -850,7 +853,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) ...@@ -850,7 +853,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
{ {
char *query, *end, options[100], message[100]; char *query, *end, options[100], message[100];
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name; char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
uint query_length= 0; size_t query_length= 0, query_size= sizeof(char)*(length+110);
const char *op = 0; const char *op = 0;
const char *tab_view; const char *tab_view;
DBUG_ENTER("handle_request_for_tables"); DBUG_ENTER("handle_request_for_tables");
...@@ -902,10 +905,12 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) ...@@ -902,10 +905,12 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
DBUG_RETURN(fix_table_storage_name(tables)); DBUG_RETURN(fix_table_storage_name(tables));
} }
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) if (!(query =(char *) my_malloc(query_size, MYF(MY_WME))))
DBUG_RETURN(1); DBUG_RETURN(1);
if (opt_all_in_1) if (opt_all_in_1)
{ {
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);
/* No backticks here as we added them before */ /* No backticks here as we added them before */
query_length= sprintf(query, "%s%s%s %s", op, query_length= sprintf(query, "%s%s%s %s", op,
tab_view, tables, options); tab_view, tables, options);
...@@ -921,7 +926,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) ...@@ -921,7 +926,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
(int) (ptr - org))); (int) (ptr - org)));
table_name= table_name_buff; table_name= table_name_buff;
ptr= strxmov(ptr, " ", options, NullS); ptr= strxmov(ptr, " ", options, NullS);
query_length= (uint) (ptr - query); query_length= (size_t) (ptr - query);
} }
if (mysql_real_query(sock, query, query_length)) if (mysql_real_query(sock, query, query_length))
{ {
...@@ -1040,7 +1045,10 @@ static void print_result() ...@@ -1040,7 +1045,10 @@ static void print_result()
prev_alter[0]= 0; prev_alter[0]= 0;
} }
else else
strcpy(prev_alter, alter_txt); {
strncpy(prev_alter, alter_txt, MAX_ALTER_STR_SIZE-1);
prev_alter[MAX_ALTER_STR_SIZE-1]= 0;
}
} }
} }
} }
...@@ -1193,7 +1201,7 @@ int main(int argc, char **argv) ...@@ -1193,7 +1201,7 @@ int main(int argc, char **argv)
process_databases(argv); process_databases(argv);
if (opt_auto_repair) if (opt_auto_repair)
{ {
uint i; size_t i;
if (!opt_silent && (tables4repair.elements || tables4rebuild.elements)) if (!opt_silent && (tables4repair.elements || tables4rebuild.elements))
puts("\nRepairing tables"); puts("\nRepairing tables");
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
static void add_load_option(DYNAMIC_STRING *str, const char *option, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value); const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len); char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size); static char *alloc_query_str(ulong size);
...@@ -862,7 +862,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -862,7 +862,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_set_charset= 0; opt_set_charset= 0;
opt_compatible_mode_str= argument; opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib, opt_compatible_mode= find_set(&compatible_mode_typelib,
argument, (uint) strlen(argument), argument, strlen(argument),
&err_ptr, &err_len); &err_ptr, &err_len);
if (err_len) if (err_len)
{ {
...@@ -872,7 +872,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -872,7 +872,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
#if !defined(DBUG_OFF) #if !defined(DBUG_OFF)
{ {
uint size_for_sql_mode= 0; size_t size_for_sql_mode= 0;
const char **ptr; const char **ptr;
for (ptr= compatible_mode_names; *ptr; ptr++) for (ptr= compatible_mode_names; *ptr; ptr++)
size_for_sql_mode+= strlen(*ptr); size_for_sql_mode+= strlen(*ptr);
...@@ -1143,8 +1143,8 @@ static int fetch_db_collation(const char *db_name, ...@@ -1143,8 +1143,8 @@ static int fetch_db_collation(const char *db_name,
break; break;
} }
strncpy(db_cl_name, db_cl_row[0], db_cl_size); strncpy(db_cl_name, db_cl_row[0], db_cl_size-1);
db_cl_name[db_cl_size - 1]= 0; /* just in case. */ db_cl_name[db_cl_size - 1]= 0;
} while (FALSE); } while (FALSE);
...@@ -1193,7 +1193,7 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset) ...@@ -1193,7 +1193,7 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset)
} }
static char *my_case_str(const char *str, static char *my_case_str(const char *str,
uint str_len, size_t str_len,
const char *token, const char *token,
uint token_len) uint token_len)
{ {
...@@ -1409,7 +1409,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name) ...@@ -1409,7 +1409,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
*/ */
static char *cover_definer_clause(const char *stmt_str, static char *cover_definer_clause(const char *stmt_str,
uint stmt_length, size_t stmt_length,
const char *definer_version_str, const char *definer_version_str,
uint definer_version_length, uint definer_version_length,
const char *stmt_version_str, const char *stmt_version_str,
...@@ -1591,14 +1591,14 @@ static void dbDisconnect(char *host) ...@@ -1591,14 +1591,14 @@ static void dbDisconnect(char *host)
} /* dbDisconnect */ } /* dbDisconnect */
static void unescape(FILE *file,char *pos,uint length) static void unescape(FILE *file,char *pos, size_t length)
{ {
char *tmp; char *tmp;
DBUG_ENTER("unescape"); DBUG_ENTER("unescape");
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME)))) if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
die(EX_MYSQLERR, "Couldn't allocate memory"); die(EX_MYSQLERR, "Couldn't allocate memory");
mysql_real_escape_string(&mysql_connection, tmp, pos, length); mysql_real_escape_string(&mysql_connection, tmp, pos, (ulong)length);
fputc('\'', file); fputc('\'', file);
fputs(tmp, file); fputs(tmp, file);
fputc('\'', file); fputc('\'', file);
...@@ -1712,7 +1712,7 @@ static char *quote_for_like(const char *name, char *buff) ...@@ -1712,7 +1712,7 @@ static char *quote_for_like(const char *name, char *buff)
Quote '<' '>' '&' '\"' chars and print a string to the xml_file. Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
*/ */
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len, static void print_quoted_xml(FILE *xml_file, const char *str, size_t len,
my_bool is_attribute_name) my_bool is_attribute_name)
{ {
const char *end; const char *end;
...@@ -1973,7 +1973,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name, ...@@ -1973,7 +1973,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
squeezed to a single hyphen. squeezed to a single hyphen.
*/ */
static void print_xml_comment(FILE *xml_file, ulong len, static void print_xml_comment(FILE *xml_file, size_t len,
const char *comment_string) const char *comment_string)
{ {
const char* end; const char* end;
...@@ -2090,7 +2090,7 @@ static uint dump_events_for_db(char *db) ...@@ -2090,7 +2090,7 @@ static uint dump_events_for_db(char *db)
DBUG_ENTER("dump_events_for_db"); DBUG_ENTER("dump_events_for_db");
DBUG_PRINT("enter", ("db: '%s'", 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, (ulong)strlen(db));
/* nice comments */ /* nice comments */
print_comment(sql_file, 0, print_comment(sql_file, 0,
...@@ -2209,6 +2209,7 @@ static uint dump_events_for_db(char *db) ...@@ -2209,6 +2209,7 @@ static uint dump_events_for_db(char *db)
(const char *) (query_str != NULL ? query_str : row[3]), (const char *) (query_str != NULL ? query_str : row[3]),
(const char *) delimiter); (const char *) delimiter);
my_free(query_str);
restore_time_zone(sql_file, delimiter); restore_time_zone(sql_file, delimiter);
restore_sql_mode(sql_file, delimiter); restore_sql_mode(sql_file, delimiter);
...@@ -2302,7 +2303,7 @@ static uint dump_routines_for_db(char *db) ...@@ -2302,7 +2303,7 @@ static uint dump_routines_for_db(char *db)
DBUG_ENTER("dump_routines_for_db"); DBUG_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", 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, (ulong)strlen(db));
/* nice comments */ /* nice comments */
print_comment(sql_file, 0, print_comment(sql_file, 0,
...@@ -2356,9 +2357,9 @@ static uint dump_routines_for_db(char *db) ...@@ -2356,9 +2357,9 @@ static uint dump_routines_for_db(char *db)
if the user has EXECUTE privilege he see routine names, but NOT the if the user has EXECUTE privilege he see routine names, but NOT the
routine body of other routines that are not the creator of! routine body of other routines that are not the creator of!
*/ */
DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d", DBUG_PRINT("info",("length of body for %s row[2] '%s' is %zu",
routine_name, row[2] ? row[2] : "(null)", routine_name, row[2] ? row[2] : "(null)",
row[2] ? (int) strlen(row[2]) : 0)); row[2] ? strlen(row[2]) : 0));
if (row[2] == NULL) if (row[2] == NULL)
{ {
print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n", print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n",
...@@ -3918,7 +3919,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) ...@@ -3918,7 +3919,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
int i; int i;
char name_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, name_buff, db, strlen(db)); mysql_real_escape_string(mysql, name_buff, db, (ulong)strlen(db));
init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN (" init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM" "SELECT DISTINCT TABLESPACE_NAME FROM"
...@@ -3931,7 +3932,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) ...@@ -3931,7 +3932,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
for (i=0 ; i<tables ; i++) for (i=0 ; i<tables ; i++)
{ {
mysql_real_escape_string(mysql, name_buff, mysql_real_escape_string(mysql, name_buff,
table_names[i], strlen(table_names[i])); table_names[i], (ulong)strlen(table_names[i]));
dynstr_append_checked(&where, "'"); dynstr_append_checked(&where, "'");
dynstr_append_checked(&where, name_buff); dynstr_append_checked(&where, name_buff);
...@@ -3962,7 +3963,7 @@ static int dump_tablespaces_for_databases(char** databases) ...@@ -3962,7 +3963,7 @@ static int dump_tablespaces_for_databases(char** databases)
{ {
char db_name_buff[NAME_LEN*2+3]; char db_name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, db_name_buff, mysql_real_escape_string(mysql, db_name_buff,
databases[i], strlen(databases[i])); databases[i], (ulong)strlen(databases[i]));
dynstr_append_checked(&where, "'"); dynstr_append_checked(&where, "'");
dynstr_append_checked(&where, db_name_buff); dynstr_append_checked(&where, db_name_buff);
dynstr_append_checked(&where, "',"); dynstr_append_checked(&where, "',");
...@@ -5003,7 +5004,7 @@ static int start_transaction(MYSQL *mysql_con) ...@@ -5003,7 +5004,7 @@ static int start_transaction(MYSQL *mysql_con)
} }
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len) char **err_pos, uint *err_len)
{ {
const char *end= x + length; const char *end= x + length;
...@@ -5061,7 +5062,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, ...@@ -5061,7 +5062,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
fputc(' ',file); fputc(' ',file);
fputs(prefix, file); fputs(prefix, file);
if (string_value) if (string_value)
unescape(file,row[0],(uint) strlen(row[0])); unescape(file,row[0], strlen(row[0]));
else else
fputs(row[0], file); fputs(row[0], file);
check_io(file); check_io(file);
...@@ -5314,8 +5315,8 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -5314,8 +5315,8 @@ static my_bool get_view_structure(char *table, char* db)
verbose_msg("-- Retrieving view structure for table %s...\n", table); verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET #ifdef NOT_REALLY_USED_YET
sprintf(insert_pat, "SET SQL_QUOTE_SHOW_CREATE=%d", dynstr_append_checked(&insert_pat, "SET SQL_QUOTE_SHOW_CREATE=");
(opt_quoted || opt_keywords)); dynstr_append_checked(&insert_pat, (opt_quoted || opt_keywords)? "1":"0");
#endif #endif
result_table= quote_name(table, table_buff, 1); result_table= quote_name(table, table_buff, 1);
......
...@@ -51,9 +51,9 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table); ...@@ -51,9 +51,9 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table);
static int list_table_status(MYSQL *mysql,const char *db,const char *table); static int list_table_status(MYSQL *mysql,const char *db,const char *table);
static int list_fields(MYSQL *mysql,const char *db,const char *table, static int list_fields(MYSQL *mysql,const char *db,const char *table,
const char *field); const char *field);
static void print_header(const char *header,uint head_length,...); static void print_header(const char *header,size_t head_length,...);
static void print_row(const char *header,uint head_length,...); static void print_row(const char *header,size_t head_length,...);
static void print_trailer(uint length,...); static void print_trailer(size_t length,...);
static void print_res_header(MYSQL_RES *result); static void print_res_header(MYSQL_RES *result);
static void print_res_top(MYSQL_RES *result); static void print_res_top(MYSQL_RES *result);
static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur); static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur);
...@@ -366,7 +366,8 @@ static int ...@@ -366,7 +366,8 @@ static int
list_dbs(MYSQL *mysql,const char *wild) list_dbs(MYSQL *mysql,const char *wild)
{ {
const char *header; const char *header;
uint length, counter = 0; size_t length = 0;
uint counter = 0;
ulong rowcount = 0L; ulong rowcount = 0L;
char tables[NAME_LEN+1], rows[NAME_LEN+1]; char tables[NAME_LEN+1], rows[NAME_LEN+1];
char query[NAME_LEN + 100]; char query[NAME_LEN + 100];
...@@ -404,7 +405,7 @@ list_dbs(MYSQL *mysql,const char *wild) ...@@ -404,7 +405,7 @@ list_dbs(MYSQL *mysql,const char *wild)
printf("Wildcard: %s\n",wild); printf("Wildcard: %s\n",wild);
header="Databases"; header="Databases";
length=(uint) strlen(header); length= strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (length < field->max_length) if (length < field->max_length)
length=field->max_length; length=field->max_length;
...@@ -492,7 +493,8 @@ static int ...@@ -492,7 +493,8 @@ static int
list_tables(MYSQL *mysql,const char *db,const char *table) list_tables(MYSQL *mysql,const char *db,const char *table)
{ {
const char *header; const char *header;
uint head_length, counter = 0; size_t head_length;
uint counter = 0;
char query[NAME_LEN + 100], rows[NAME_LEN], fields[16]; char query[NAME_LEN + 100], rows[NAME_LEN], fields[16];
MYSQL_FIELD *field; MYSQL_FIELD *field;
MYSQL_RES *result; MYSQL_RES *result;
...@@ -529,7 +531,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) ...@@ -529,7 +531,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
putchar('\n'); putchar('\n');
header="Tables"; header="Tables";
head_length=(uint) strlen(header); head_length= strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (head_length < field->max_length) if (head_length < field->max_length)
head_length=field->max_length; head_length=field->max_length;
...@@ -647,7 +649,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) ...@@ -647,7 +649,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
len= sizeof(query); len= sizeof(query);
len-= my_snprintf(query, len, "show table status from `%s`", db); len-= my_snprintf(query, len, "show table status from `%s`", db);
if (wild && wild[0] && len) if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
...@@ -680,7 +682,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -680,7 +682,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
const char *wild) const char *wild)
{ {
char query[NAME_LEN + 100]; char query[NAME_LEN + 100];
int len; size_t len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
ulong UNINIT_VAR(rows); ulong UNINIT_VAR(rows);
...@@ -710,7 +712,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -710,7 +712,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`", len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
table); table);
if (wild && wild[0] && len) if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n",
...@@ -758,10 +760,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -758,10 +760,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
*****************************************************************************/ *****************************************************************************/
static void static void
print_header(const char *header,uint head_length,...) print_header(const char *header,size_t head_length,...)
{ {
va_list args; va_list args;
uint length,i,str_length,pre_space; size_t length,i,str_length,pre_space;
const char *field; const char *field;
va_start(args,head_length); va_start(args,head_length);
...@@ -784,10 +786,10 @@ print_header(const char *header,uint head_length,...) ...@@ -784,10 +786,10 @@ print_header(const char *header,uint head_length,...)
putchar('|'); putchar('|');
for (;;) for (;;)
{ {
str_length=(uint) strlen(field); str_length= strlen(field);
if (str_length > length) if (str_length > length)
str_length=length+1; str_length=length+1;
pre_space=(uint) (((int) length-(int) str_length)/2)+1; pre_space= ((length- str_length)/2)+1;
for (i=0 ; i < pre_space ; i++) for (i=0 ; i < pre_space ; i++)
putchar(' '); putchar(' ');
for (i = 0 ; i < str_length ; i++) for (i = 0 ; i < str_length ; i++)
...@@ -821,11 +823,11 @@ print_header(const char *header,uint head_length,...) ...@@ -821,11 +823,11 @@ print_header(const char *header,uint head_length,...)
static void static void
print_row(const char *header,uint head_length,...) print_row(const char *header,size_t head_length,...)
{ {
va_list args; va_list args;
const char *field; const char *field;
uint i,length,field_length; size_t i,length,field_length;
va_start(args,head_length); va_start(args,head_length);
field=header; length=head_length; field=header; length=head_length;
...@@ -834,7 +836,7 @@ print_row(const char *header,uint head_length,...) ...@@ -834,7 +836,7 @@ print_row(const char *header,uint head_length,...)
putchar('|'); putchar('|');
putchar(' '); putchar(' ');
fputs(field,stdout); fputs(field,stdout);
field_length=(uint) strlen(field); field_length= strlen(field);
for (i=field_length ; i <= length ; i++) for (i=field_length ; i <= length ; i++)
putchar(' '); putchar(' ');
if (!(field=va_arg(args,char *))) if (!(field=va_arg(args,char *)))
...@@ -848,10 +850,10 @@ print_row(const char *header,uint head_length,...) ...@@ -848,10 +850,10 @@ print_row(const char *header,uint head_length,...)
static void static void
print_trailer(uint head_length,...) print_trailer(size_t head_length,...)
{ {
va_list args; va_list args;
uint length,i; size_t length,i;
va_start(args,head_length); va_start(args,head_length);
length=head_length; length=head_length;
...@@ -894,7 +896,7 @@ static void print_res_top(MYSQL_RES *result) ...@@ -894,7 +896,7 @@ static void print_res_top(MYSQL_RES *result)
mysql_field_seek(result,0); mysql_field_seek(result,0);
while((field = mysql_fetch_field(result))) while((field = mysql_fetch_field(result)))
{ {
if ((length=(uint) strlen(field->name)) > field->max_length) if ((length= strlen(field->name)) > field->max_length)
field->max_length=length; field->max_length=length;
else else
length=field->max_length; length=field->max_length;
......
...@@ -5086,12 +5086,13 @@ static int my_kill(int pid, int sig) ...@@ -5086,12 +5086,13 @@ static int my_kill(int pid, int sig)
{ {
#ifdef __WIN__ #ifdef __WIN__
HANDLE proc; HANDLE proc;
if ((proc= OpenProcess(PROCESS_TERMINATE, FALSE, pid)) == NULL) if ((proc= OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid)) == NULL)
return -1; return -1;
if (sig == 0) if (sig == 0)
{ {
DWORD wait_result= WaitForSingleObject(proc, 0);
CloseHandle(proc); CloseHandle(proc);
return 0; return wait_result == WAIT_OBJECT_0?-1:0;
} }
(void)TerminateProcess(proc, 201); (void)TerminateProcess(proc, 201);
CloseHandle(proc); CloseHandle(proc);
......
...@@ -50,10 +50,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -50,10 +50,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
switch(optid) { switch(optid) {
case 'V': case 'V':
printf("%s version %s by Jani Tolonen\n", progname, VER); printf("%s version %s by Jani Tolonen\n", progname, VER);
exit(-1); exit(0);
case 'I': case 'I':
case '?': case '?':
usage(); usage();
exit(0);
} }
return 0; return 0;
} }
...@@ -69,7 +70,10 @@ int main(int argc, char *argv[]) ...@@ -69,7 +70,10 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0) (t= atoi(argv[1])) <= 0)
{
usage(); usage();
exit(-1);
}
for (; t > 0; t--) for (; t > 0; t--)
{ {
if (kill((pid_t) pid, sig)) if (kill((pid_t) pid, sig))
...@@ -100,5 +104,4 @@ void usage(void) ...@@ -100,5 +104,4 @@ void usage(void)
printf("integer arguments.\n\n"); printf("integer arguments.\n\n");
printf("Options:\n"); printf("Options:\n");
my_print_help(my_long_options); my_print_help(my_long_options);
exit(-1);
} }
/* /*
Copyright (C) 2000-2007 MySQL AB Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -69,3 +69,9 @@ INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Developm ...@@ -69,3 +69,9 @@ INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Developm
PATTERN CMakeFiles EXCLUDE PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE PATTERN mysql EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE) REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/. DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development
FILES_MATCHING PATTERN "*.h"
PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -330,7 +330,8 @@ typedef struct st_sort_info ...@@ -330,7 +330,8 @@ typedef struct st_sort_info
my_off_t filelength, dupp, buff_length; my_off_t filelength, dupp, buff_length;
ha_rows max_records; ha_rows max_records;
uint current_key, total_keys; uint current_key, total_keys;
uint got_error, threads_running; volatile uint got_error;
uint threads_running;
myf myf_rw; myf myf_rw;
enum data_file_type new_data_file_type; enum data_file_type new_data_file_type;
} MI_SORT_INFO; } MI_SORT_INFO;
......
...@@ -184,7 +184,7 @@ void vio_end(void); ...@@ -184,7 +184,7 @@ void vio_end(void);
/* shutdown(2) flags */ /* shutdown(2) flags */
#ifndef SHUT_RD #ifndef SHUT_RD
#define SHUT_RD SD_BOTH #define SHUT_RD SD_RECEIVE
#endif #endif
/* /*
......
...@@ -108,8 +108,12 @@ ADD_DEPENDENCIES(sql_embedded GenError GenServerSource) ...@@ -108,8 +108,12 @@ ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
# On Unix, it is libmysqld.a # On Unix, it is libmysqld.a
IF(WIN32) IF(WIN32)
SET(MYSQLSERVER_OUTPUT_NAME mysqlserver) SET(MYSQLSERVER_OUTPUT_NAME mysqlserver)
SET(COMPONENT_MYSQLSERVER "Embedded")
SET(COMPONENT_LIBMYSQLD "Embedded")
ELSE() ELSE()
SET(MYSQLSERVER_OUTPUT_NAME mysqld) SET(MYSQLSERVER_OUTPUT_NAME mysqld)
SET(COMPONENT_MYSQLSERVER "Development")
SET(COMPONENT_LIBMYSQLD "Server")
ENDIF() ENDIF()
...@@ -134,9 +138,9 @@ FOREACH(LIB ${LIBS}) ...@@ -134,9 +138,9 @@ FOREACH(LIB ${LIBS})
ENDFOREACH() ENDFOREACH()
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Development) OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT ${COMPONENT_MYSQLSERVER})
INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development) INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT ${COMPONENT_MYSQLSERVER})
# Visual Studio users need debug static library # Visual Studio users need debug static library
IF(MSVC) IF(MSVC)
...@@ -163,7 +167,7 @@ ENDFOREACH() ...@@ -163,7 +167,7 @@ ENDFOREACH()
IF(NOT DISABLE_SHARED) IF(NOT DISABLE_SHARED)
MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API} MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API}
COMPONENT Server) COMPONENT ${COMPONENT_LIBMYSQLD})
IF(UNIX) IF(UNIX)
# Name the shared library, handle versioning (provides same api as client # Name the shared library, handle versioning (provides same api as client
# library hence the same version) # library hence the same version)
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set # The environment variables SEARCH_FILE and SEARCH_PATTERN must be set
# before sourcing this routine. # before sourcing this routine.
# #
# Optionally, SEARCH_RANGE can be set to the max number of bytes of the file
# to search. If negative, it will search that many bytes at the end of the
# file. The default is to search only the first 50000 bytes of the file.
#
# In case of # In case of
# - SEARCH_FILE and/or SEARCH_PATTERN is not set # - SEARCH_FILE and/or SEARCH_PATTERN is not set
# - SEARCH_FILE cannot be opened # - SEARCH_FILE cannot be opened
...@@ -38,6 +42,7 @@ ...@@ -38,6 +42,7 @@
# --error 0,1 # --error 0,1
# --remove_file $error_log # --remove_file $error_log
# let SEARCH_FILE= $error_log; # let SEARCH_FILE= $error_log;
# let SEARCH_RANGE= -50000;
# # Stop the server # # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; # let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file # --exec echo "wait" > $restart_file
...@@ -57,8 +62,18 @@ perl; ...@@ -57,8 +62,18 @@ perl;
use strict; use strict;
my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set"; my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set";
my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set"; my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set";
my $search_range= $ENV{'SEARCH_RANGE'};
my $file_content;
$search_range= 50000 unless $search_range =~ /-?[0-9]+/;
open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n"); open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n");
read(FILE, my $file_content, 50000, 0); if ($search_range >= 0) {
read(FILE, $file_content, $search_range, 0);
} else {
my $size= -s $search_file;
$search_range = -$size if $size > -$search_range;
seek(FILE, $search_range, 2);
read(FILE, $file_content, -$search_range, 0);
}
close(FILE); close(FILE);
if ( not $file_content =~ m{$search_pattern} ) { if ( not $file_content =~ m{$search_pattern} ) {
die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$file_content<-\n"); die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$file_content<-\n");
......
...@@ -1801,9 +1801,12 @@ sub set_build_thread_ports($) { ...@@ -1801,9 +1801,12 @@ sub set_build_thread_ports($) {
if ( lc($opt_build_thread) eq 'auto' ) { if ( lc($opt_build_thread) eq 'auto' ) {
my $found_free = 0; my $found_free = 0;
$build_thread = 300; # Start attempts from here $build_thread = 300; # Start attempts from here
my $build_thread_upper = $build_thread + ($opt_parallel > 1500
? 3000
: 2 * $opt_parallel) + 300;
while (! $found_free) while (! $found_free)
{ {
$build_thread= mtr_get_unique_id($build_thread, 349); $build_thread= mtr_get_unique_id($build_thread, $build_thread_upper);
if ( !defined $build_thread ) { if ( !defined $build_thread ) {
mtr_error("Could not get a unique build thread id"); mtr_error("Could not get a unique build thread id");
} }
......
...@@ -502,3 +502,9 @@ a ...@@ -502,3 +502,9 @@ a
SELECT * FROM t1 WHERE a IN (0.8,0.9); SELECT * FROM t1 WHERE a IN (0.8,0.9);
a a
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
#
SELECT 100 BETWEEN 1 AND 9223372036854775808;
100 BETWEEN 1 AND 9223372036854775808
1
...@@ -277,9 +277,40 @@ CREATE TABLE t1 ( a VARCHAR(1) ); ...@@ -277,9 +277,40 @@ CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('m'),('n'); INSERT INTO t1 VALUES ('m'),('n');
CREATE VIEW v1 AS SELECT 'w' ; CREATE VIEW v1 AS SELECT 'w' ;
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 ); SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<=' a
m
n
drop view v1; drop view v1;
drop table t1; drop table t1;
SET character_set_connection = default; SET character_set_connection = default;
SET optimizer_switch= default; SET optimizer_switch= default;
#End of 5.3 tests #End of 5.3 tests
#
# Start of 5.5 tests
#
#
# MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
#
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('A'),('a'),('B'),('b');
CREATE VIEW v1 AS SELECT 'a';
SELECT * FROM v1,t1 where t1.a=v1.a;
a a
a A
a a
DROP VIEW v1;
DROP TABLE t1;
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b'),('c');
CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b';
SELECT * FROM v1,t1 WHERE t1.a=v1.a;
a a
a a
b b
DROP VIEW v1;
DROP TABLE t1;
#
# End of 5.5 tests
#
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment