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

Imported Upstream version 5.5.47

parent a90934f3
commit: 16c4b3c68b06653592a9500050ad977a38f4ebae commit: d67aacb4fbb449ffa8db4e3d70fe8756d62b5222
date: 2015-10-09 16:43:59 +0200 date: 2015-12-09 17:11:55 +0100
build-date: 2015-10-09 18:51:17 +0200 build-date: 2015-12-09 18:22:49 +0100
short: 16c4b3c short: d67aacb
branch: HEAD branch: HEAD
MySQL source 5.5.46 MySQL source 5.5.47
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=46 MYSQL_VERSION_PATCH=47
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=
/* /*
Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2011, 2015, 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
...@@ -407,7 +407,7 @@ static int get_default_values() ...@@ -407,7 +407,7 @@ static int get_default_values()
static void usage(void) static void usage(void)
{ {
PRINT_VERSION; PRINT_VERSION;
puts("Copyright (c) 2011, Oracle and/or its affiliates. " puts("Copyright (c) 2011, 2015, Oracle and/or its affiliates. "
"All rights reserved.\n"); "All rights reserved.\n");
puts("Enable or disable plugins."); puts("Enable or disable plugins.");
printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n", printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n",
...@@ -758,6 +758,11 @@ static int check_options(int argc, char **argv, char *operation) ...@@ -758,6 +758,11 @@ static int check_options(int argc, char **argv, char *operation)
/* read the plugin config file and check for match against argument */ /* read the plugin config file and check for match against argument */
else else
{ {
if (strlen(argv[i]) + 4 + 1 > FN_REFLEN)
{
fprintf(stderr, "ERROR: argument is too long.\n");
return 1;
}
strcpy(plugin_name, argv[i]); strcpy(plugin_name, argv[i]);
strcpy(config_file, argv[i]); strcpy(config_file, argv[i]);
strcat(config_file, ".ini"); strcat(config_file, ".ini");
...@@ -849,6 +854,7 @@ static int process_options(int argc, char *argv[], char *operation) ...@@ -849,6 +854,7 @@ static int process_options(int argc, char *argv[], char *operation)
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2) if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
memset(buff, 0, sizeof(buff));
strncpy(buff, opt_basedir, sizeof(buff) - 1); strncpy(buff, opt_basedir, sizeof(buff) - 1);
#ifdef __WIN__ #ifdef __WIN__
......
/* /*
Copyright (c) 2006, 2013, Oracle and/or its affiliates. Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2015, MariaDB
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
...@@ -53,6 +53,8 @@ static DYNAMIC_STRING conn_args; ...@@ -53,6 +53,8 @@ static DYNAMIC_STRING conn_args;
static char *opt_password= 0; static char *opt_password= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static char *cnf_file_path= 0, defaults_file[FN_REFLEN + 32];
static my_bool tty_password= 0; static my_bool tty_password= 0;
static char opt_tmpdir[FN_REFLEN] = ""; static char opt_tmpdir[FN_REFLEN] = "";
...@@ -109,6 +111,7 @@ static struct my_option my_long_options[]= ...@@ -109,6 +111,7 @@ static struct my_option my_long_options[]=
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0, {"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#define PASSWORD_OPT 12
{"password", 'p', {"password", 'p',
"Password to use when connecting to server. If password is not given," "Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password, " it's solicited on the tty.", &opt_password,&opt_password,
...@@ -146,6 +149,7 @@ static struct my_option my_long_options[]= ...@@ -146,6 +149,7 @@ static struct my_option my_long_options[]=
"do not try to upgrade the data.", "do not try to upgrade the data.",
&opt_systables_only, &opt_systables_only, 0, &opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#define USER_OPT (array_elements(my_long_options) - 6)
{"user", 'u', "User for login if not current user.", &opt_user, {"user", 'u', "User for login if not current user.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.", {"verbose", 'v', "Display more output about the process.",
...@@ -182,6 +186,8 @@ static void free_used_memory(void) ...@@ -182,6 +186,8 @@ static void free_used_memory(void)
dynstr_free(&ds_args); dynstr_free(&ds_args);
dynstr_free(&conn_args); dynstr_free(&conn_args);
if (cnf_file_path)
my_delete(cnf_file_path, MYF(MY_WME));
} }
...@@ -233,31 +239,32 @@ static void verbose(const char *fmt, ...) ...@@ -233,31 +239,32 @@ static void verbose(const char *fmt, ...)
this way we pass the same arguments on to mysql and mysql_check this way we pass the same arguments on to mysql and mysql_check
*/ */
static void add_one_option(DYNAMIC_STRING* ds, static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
const struct my_option *opt, const struct my_option *opt,
const char* argument) const char* arg)
{ {
const char* eq= NullS; dynstr_append(ds, "--");
const char* arg= NullS; dynstr_append(ds, opt->name);
if (opt->arg_type != NO_ARG) if (arg)
{ {
eq= "="; dynstr_append(ds, "=");
switch (opt->var_type & GET_TYPE_MASK) { dynstr_append_os_quoted(ds, arg, NullS);
case GET_STR:
arg= argument;
break;
case GET_BOOL:
arg= (*(my_bool *)opt->value) ? "1" : "0";
break;
default:
die("internal error at %s: %d",__FILE__, __LINE__);
}
} }
dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
dynstr_append(ds, " "); dynstr_append(ds, " ");
} }
static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
{
dynstr_append(ds, opt->name);
if (arg)
{
dynstr_append(ds, "=");
dynstr_append_os_quoted(ds, arg, NullS);
}
dynstr_append(ds, "\n");
}
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt, get_one_option(int optid, const struct my_option *opt,
...@@ -288,16 +295,17 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -288,16 +295,17 @@ get_one_option(int optid, const struct my_option *opt,
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
tty_password= 1;
add_option= FALSE; add_option= FALSE;
if (argument) if (argument)
{ {
/* Add password to ds_args before overwriting the arg with x's */ /* Add password to ds_args before overwriting the arg with x's */
add_one_option(&ds_args, opt, argument); add_one_option_cnf_file(&ds_args, opt, argument);
while (*argument) while (*argument)
*argument++= 'x'; /* Destroy argument */ *argument++= 'x'; /* Destroy argument */
tty_password= 0; tty_password= 0;
} }
else
tty_password= 1;
break; break;
case 't': case 't':
...@@ -344,18 +352,18 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -344,18 +352,18 @@ get_one_option(int optid, const struct my_option *opt,
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */ case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option(&conn_args, opt, argument); add_one_option_cmd_line(&conn_args, opt, argument);
break; break;
} }
if (add_option) if (add_option)
{ {
/* /*
This is an option that is accpted by mysql_upgrade just so This is an option that is accepted by mysql_upgrade just so
it can be passed on to "mysql" and "mysqlcheck" it can be passed on to "mysql" and "mysqlcheck"
Save it in the ds_args string Save it in the ds_args string
*/ */
add_one_option(&ds_args, opt, argument); add_one_option_cnf_file(&ds_args, opt, argument);
} }
return 0; return 0;
} }
...@@ -415,11 +423,8 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...) ...@@ -415,11 +423,8 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
while ((arg= va_arg(args, char *))) while ((arg= va_arg(args, char *)))
{ {
/* Options should be os quoted */ /* Options should already be os quoted */
if (strncmp(arg, "--", 2) == 0) dynstr_append(&ds_cmdline, arg);
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg);
dynstr_append(&ds_cmdline, " "); dynstr_append(&ds_cmdline, " ");
} }
...@@ -561,8 +566,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, ...@@ -561,8 +566,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path, ret= run_tool(mysql_path,
ds_res, ds_res,
"--no-defaults", defaults_file,
ds_args.str,
"--database=mysql", "--database=mysql",
"--batch", /* Turns off pager etc. */ "--batch", /* Turns off pager etc. */
force ? "--force": "--skip-force", force ? "--force": "--skip-force",
...@@ -751,8 +755,7 @@ static int run_mysqlcheck_upgrade(void) ...@@ -751,8 +755,7 @@ static int run_mysqlcheck_upgrade(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
retch= run_tool(mysqlcheck_path, retch= run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--check-upgrade", "--check-upgrade",
"--all-databases", "--all-databases",
"--auto-repair", "--auto-repair",
...@@ -805,8 +808,7 @@ static int run_mysqlcheck_views(void) ...@@ -805,8 +808,7 @@ static int run_mysqlcheck_views(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--all-databases", "--repair", "--all-databases", "--repair",
upgrade_views, upgrade_views,
"--skip-process-tables", "--skip-process-tables",
...@@ -830,8 +832,7 @@ static int run_mysqlcheck_fixnames(void) ...@@ -830,8 +832,7 @@ static int run_mysqlcheck_fixnames(void)
print_conn_args("mysqlcheck"); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", defaults_file,
ds_args.str,
"--all-databases", "--all-databases",
"--fix-db-names", "--fix-db-names",
"--fix-table-names", "--fix-table-names",
...@@ -1031,12 +1032,21 @@ int main(int argc, char **argv) ...@@ -1031,12 +1032,21 @@ int main(int argc, char **argv)
{ {
opt_password= get_tty_password(NullS); opt_password= get_tty_password(NullS);
/* add password to defaults file */ /* add password to defaults file */
dynstr_append_os_quoted(&ds_args, "--password=", opt_password, NullS); add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
dynstr_append(&ds_args, " "); DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
} }
/* add user to defaults file */ /* add user to defaults file */
dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS); add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
dynstr_append(&ds_args, " "); DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
cnf_file_path= strmov(defaults_file, "--defaults-file=");
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0));
}
/* Find mysql */ /* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
......
/* /*
Copyright (c) 2001, 2011, Oracle and/or its affiliates. Copyright (c) 2001, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2011, Monty Program Ab. Copyright (c) 2010, 2015, MariaDB
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
......
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2015, Monty Program Ab.
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
...@@ -1116,16 +1116,14 @@ static int fetch_db_collation(const char *db_name, ...@@ -1116,16 +1116,14 @@ static int fetch_db_collation(const char *db_name,
int db_cl_size) int db_cl_size)
{ {
my_bool err_status= FALSE; my_bool err_status= FALSE;
char query[QUERY_LENGTH];
MYSQL_RES *db_cl_res; MYSQL_RES *db_cl_res;
MYSQL_ROW db_cl_row; MYSQL_ROW db_cl_row;
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(db_name, quoted_database_buf, 1);
my_snprintf(query, sizeof (query), "use %s", qdatabase); if (mysql_select_db(mysql, db_name))
{
if (mysql_query_with_error_report(mysql, NULL, query)) DB_error(mysql, "when selecting the database");
return 1; return 1; /* If --force */
}
if (mysql_query_with_error_report(mysql, &db_cl_res, if (mysql_query_with_error_report(mysql, &db_cl_res,
"select @@collation_database")) "select @@collation_database"))
...@@ -2319,7 +2317,7 @@ static uint dump_routines_for_db(char *db) ...@@ -2319,7 +2317,7 @@ static uint dump_routines_for_db(char *db)
/* Get database collation. */ /* Get database collation. */
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) if (fetch_db_collation(db, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(1); DBUG_RETURN(1);
if (switch_character_set_results(mysql, "binary")) if (switch_character_set_results(mysql, "binary"))
...@@ -2388,7 +2386,7 @@ static uint dump_routines_for_db(char *db) ...@@ -2388,7 +2386,7 @@ static uint dump_routines_for_db(char *db)
if (mysql_num_fields(routine_res) >= 6) if (mysql_num_fields(routine_res) >= 6)
{ {
if (switch_db_collation(sql_file, db_name_buff, ";", if (switch_db_collation(sql_file, db, ";",
db_cl_name, row[5], &db_cl_altered)) db_cl_name, row[5], &db_cl_altered))
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -2435,7 +2433,7 @@ static uint dump_routines_for_db(char *db) ...@@ -2435,7 +2433,7 @@ static uint dump_routines_for_db(char *db)
if (db_cl_altered) if (db_cl_altered)
{ {
if (restore_db_collation(sql_file, db_name_buff, ";", db_cl_name)) if (restore_db_collation(sql_file, db, ";", db_cl_name))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
......
/* /*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab Copyright (c) 2010, 2015, MariaDB
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
...@@ -369,7 +369,7 @@ list_dbs(MYSQL *mysql,const char *wild) ...@@ -369,7 +369,7 @@ list_dbs(MYSQL *mysql,const char *wild)
uint length, counter = 0; uint length, 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[255]; char query[NAME_LEN + 100];
MYSQL_FIELD *field; MYSQL_FIELD *field;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row= NULL, rrow; MYSQL_ROW row= NULL, rrow;
...@@ -436,7 +436,8 @@ list_dbs(MYSQL *mysql,const char *wild) ...@@ -436,7 +436,8 @@ list_dbs(MYSQL *mysql,const char *wild)
MYSQL_ROW trow; MYSQL_ROW trow;
while ((trow = mysql_fetch_row(tresult))) while ((trow = mysql_fetch_row(tresult)))
{ {
sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]); my_snprintf(query, sizeof(query),
"SELECT COUNT(*) FROM `%s`", trow[0]);
if (!(mysql_query(mysql,query))) if (!(mysql_query(mysql,query)))
{ {
MYSQL_RES *rresult; MYSQL_RES *rresult;
...@@ -492,7 +493,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) ...@@ -492,7 +493,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
{ {
const char *header; const char *header;
uint head_length, counter = 0; uint head_length, counter = 0;
char query[255], 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;
MYSQL_ROW row, rrow; MYSQL_ROW row, rrow;
...@@ -577,7 +578,8 @@ list_tables(MYSQL *mysql,const char *db,const char *table) ...@@ -577,7 +578,8 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
if (opt_verbose > 1) if (opt_verbose > 1)
{ {
/* Print the count of rows for each table */ /* Print the count of rows for each table */
sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]); my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM `%s`",
row[0]);
if (!(mysql_query(mysql,query))) if (!(mysql_query(mysql,query)))
{ {
if ((rresult = mysql_store_result(mysql))) if ((rresult = mysql_store_result(mysql)))
...@@ -637,13 +639,15 @@ list_tables(MYSQL *mysql,const char *db,const char *table) ...@@ -637,13 +639,15 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
static int static int
list_table_status(MYSQL *mysql,const char *db,const char *wild) list_table_status(MYSQL *mysql,const char *db,const char *wild)
{ {
char query[1024],*end; char query[NAME_LEN + 100];
int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
end=strxmov(query,"show table status from `",db,"`",NullS); len= sizeof(query);
if (wild && wild[0]) len-= my_snprintf(query, len, "show table status from `%s`", db);
strxmov(end," like '",wild,"'",NullS); if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " 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",
...@@ -675,7 +679,8 @@ static int ...@@ -675,7 +679,8 @@ static int
list_fields(MYSQL *mysql,const char *db,const char *table, list_fields(MYSQL *mysql,const char *db,const char *table,
const char *wild) const char *wild)
{ {
char query[1024],*end; char query[NAME_LEN + 100];
int len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
ulong UNINIT_VAR(rows); ulong UNINIT_VAR(rows);
...@@ -689,7 +694,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -689,7 +694,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
if (opt_count) if (opt_count)
{ {
sprintf(query,"select count(*) from `%s`", table); my_snprintf(query, sizeof(query), "select count(*) from `%s`", table);
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 record count for db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
...@@ -701,9 +706,11 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -701,9 +706,11 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_free_result(result); mysql_free_result(result);
} }
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`"); len= sizeof(query);
if (wild && wild[0]) len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
strxmov(end," like '",wild,"'",NullS); table);
if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " 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",
...@@ -724,7 +731,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -724,7 +731,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
print_res_top(result); print_res_top(result);
if (opt_show_keys) if (opt_show_keys)
{ {
end=strmov(strmov(strmov(query,"show keys from `"),table),"`"); my_snprintf(query, sizeof(query), "show keys from `%s`", table);
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 keys in db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",
......
...@@ -31,7 +31,7 @@ SET(CPACK_RPM_PACKAGE_NAME "MariaDB") ...@@ -31,7 +31,7 @@ SET(CPACK_RPM_PACKAGE_NAME "MariaDB")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}") SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
SET(CPACK_RPM_PACKAGE_LICENSE "GPL") SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# flush-logs'd only once. # flush-logs'd only once.
# Else the binary logs would automatically increase by n times every day. # Else the binary logs would automatically increase by n times every day.
# - The error log is obsolete, messages go to syslog now. # - The error log is obsolete, messages go to syslog now.
/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log { /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log {
daily daily
rotate 7 rotate 7
missingok missingok
......
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2015, 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
...@@ -118,7 +118,7 @@ print_arrays_for(char *set) ...@@ -118,7 +118,7 @@ print_arrays_for(char *set)
{ {
FILE *f; FILE *f;
sprintf(buf, "%s.conf", set); snprintf(buf, sizeof(buf), "%s.conf", set);
if ((f = fopen(buf, "r")) == NULL) { if ((f = fopen(buf, "r")) == NULL) {
fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set); fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set);
......
...@@ -38,6 +38,9 @@ max_heap_table_size= 1M ...@@ -38,6 +38,9 @@ max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M loose-aria-pagecache-buffer-size=8M
loose-feedback-user-info= mysql-test loose-feedback-user-info= mysql-test
loose-feedback-debug-startup-interval=20
loose-feedback-debug-first-interval=60
loose-feedback-debug-interval=60
loose-innodb_data_file_path= ibdata1:10M:autoextend loose-innodb_data_file_path= ibdata1:10M:autoextend
loose-innodb_buffer_pool_size= 8M loose-innodb_buffer_pool_size= 8M
......
...@@ -2477,3 +2477,9 @@ t1 CREATE TABLE `t1` ( ...@@ -2477,3 +2477,9 @@ t1 CREATE TABLE `t1` (
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
set @@session.collation_server=filename;
create table t1(a enum('',''));
Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1;
set @@session.collation_server=default;
...@@ -11,3 +11,6 @@ create table com1 (a int); ...@@ -11,3 +11,6 @@ create table com1 (a int);
drop table com1; drop table com1;
create table `clock$` (a int); create table `clock$` (a int);
drop table `clock$`; drop table `clock$`;
select convert(convert(',' using filename) using binary);
convert(convert(',' using filename) using binary)
@002c
...@@ -5777,5 +5777,32 @@ SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); ...@@ -5777,5 +5777,32 @@ SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
#
SET NAMES utf8;
CREATE TABLE t1 (id2 int, ts timestamp);
INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
CREATE TABLE t2 AS SELECT
COALESCE(ts, 0) AS c0,
GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c0` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c2` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c3` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c4` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
c0 c1 c2 c3 c4
2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34
2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24
DROP TABLE t2, t1;
#
# End of 5.5 tests # End of 5.5 tests
# #
...@@ -114,7 +114,7 @@ create table t_event3 (a int, b float); ...@@ -114,7 +114,7 @@ create table t_event3 (a int, b float);
drop event if exists event3; drop event if exists event3;
Warnings: Warnings:
Note 1305 Event event3 does not exist Note 1305 Event event3 does not exist
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand()); create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
select count(*) from t_event3; select count(*) from t_event3;
count(*) count(*)
0 0
......
...@@ -551,7 +551,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) ...@@ -551,7 +551,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a TEXT); CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)); CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd'); INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
......
...@@ -102,7 +102,7 @@ ERROR: Missing --plugin_dir option. ...@@ -102,7 +102,7 @@ ERROR: Missing --plugin_dir option.
# Show the help. # Show the help.
# #
mysql_plugin Ver V.V.VV Distrib XX.XX.XX mysql_plugin Ver V.V.VV Distrib XX.XX.XX
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
Enable or disable plugins. Enable or disable plugins.
......
...@@ -36,7 +36,7 @@ Phase 4/4: Running 'mysql_fix_privilege_tables' ...@@ -36,7 +36,7 @@ Phase 4/4: Running 'mysql_fix_privilege_tables'
OK OK
Run it again - should say already completed Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before Force should run it regardless of whether it has been run before
Phase 1/4: Fixing views Phase 1/4: Fixing views
Phase 2/4: Fixing table and database names Phase 2/4: Fixing table and database names
Phase 3/4: Checking and upgrading tables Phase 3/4: Checking and upgrading tables
...@@ -298,6 +298,13 @@ test ...@@ -298,6 +298,13 @@ test
Phase 4/4: Running 'mysql_fix_privilege_tables' Phase 4/4: Running 'mysql_fix_privilege_tables'
OK OK
# #
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
#
Run mysql_upgrade with unauthorized access
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
#
# MDEV-4332 Increase username length from 16 characters # MDEV-4332 Increase username length from 16 characters
# MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
# #
......
...@@ -5312,3 +5312,29 @@ Usage: mysqldump [OPTIONS] database [tables] ...@@ -5312,3 +5312,29 @@ Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS] OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help For more options, use mysqldump --help
#
# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
#
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DROP DATABASE `a\"'``b`;
...@@ -4052,3 +4052,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; ...@@ -4052,3 +4052,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
drop table t1; drop table t1;
# End of 5.3 tests # End of 5.3 tests
#
# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
#
CREATE TABLE t1 ( id INT(10), value INT(10) );
CREATE TABLE t2 ( id INT(10) );
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
execute stmt;
insert into t1 values (1,10),(2,10),(3,10);
insert into t2 values (1),(2);
execute stmt;
select * from t1;
id value
1 1
2 1
3 NULL
deallocate prepare stmt;
SET SESSION sql_mode = @save_sql_mode;
DROP TABLE t1,t2;
# End of 10.0 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