Skip to content

Commit

Permalink
Merge branch '10.1' into 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 30, 2016
2 parents 0bb30f3 + 33492ec commit 932646b
Show file tree
Hide file tree
Showing 993 changed files with 59,251 additions and 15,051 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.cpp text
*.h text
*.test text
*.java text

# These files should be checked out as is
*.result -text -whitespace
Expand All @@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
*.frm binary
*.MYD binary
*.MYI binary
*.class binary

*.c diff=cpp
*.h diff=cpp
*.cc diff=cpp
*.ic diff=cpp
*.cpp diff=cpp
*.java diff=cpp
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.exp
*.dep
*.idb
*.res
*.tlog

# Precompiled Headers
*.gch
Expand Down
1 change: 1 addition & 0 deletions client/client_priv.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
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
Expand Down
35 changes: 21 additions & 14 deletions client/mysql.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
Copyright (c) 2013, 2014, SkySQL Ab
Copyright (c) 2009, 2016, MariaDB
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
Expand Down Expand Up @@ -96,9 +95,16 @@ extern "C" {
#endif
}

#if !defined(HAVE_VIDATTR)
#undef vidattr
#define vidattr(A) {} // Can't get this to work
#ifdef HAVE_VIDATTR
static int have_curses= 0;
static void my_vidattr(chtype attrs)
{
if (have_curses)
vidattr(attrs);
}
#else
#undef HAVE_SETUPTERM
#define my_vidattr(A) {} // Can't get this to work
#endif

#ifdef FN_NO_CASE_SENSE
Expand Down Expand Up @@ -4734,9 +4740,9 @@ com_status(String *buffer __attribute__((unused)),

if (skip_updates)
{
vidattr(A_BOLD);
my_vidattr(A_BOLD);
tee_fprintf(stdout, "\nAll updates ignored to this database\n");
vidattr(A_NORMAL);
my_vidattr(A_NORMAL);
}
#ifdef USE_POPEN
tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
Expand Down Expand Up @@ -4804,9 +4810,9 @@ com_status(String *buffer __attribute__((unused)),
}
if (safe_updates)
{
vidattr(A_BOLD);
my_vidattr(A_BOLD);
tee_fprintf(stdout, "\nNote that you are running in safe_update_mode:\n");
vidattr(A_NORMAL);
my_vidattr(A_NORMAL);
tee_fprintf(stdout, "\
UPDATEs and DELETEs that don't use a key in the WHERE clause are not allowed.\n\
(One can force an UPDATE/DELETE by adding LIMIT # at the end of the command.)\n\
Expand Down Expand Up @@ -4899,10 +4905,11 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
{
if (!inited)
{
inited=1;
#ifdef HAVE_SETUPTERM
(void) setupterm((char *)0, 1, (int *) 0);
int errret;
have_curses= setupterm((char *)0, 1, &errret) != ERR;
#endif
inited=1;
}
if (info_type == INFO_ERROR)
{
Expand All @@ -4914,7 +4921,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
putchar('\a'); /* This should make a bell */
#endif
}
vidattr(A_STANDOUT);
my_vidattr(A_STANDOUT);
if (error)
{
if (sqlstate)
Expand All @@ -4933,9 +4940,9 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
tee_fputs(": ", file);
}
else
vidattr(A_BOLD);
my_vidattr(A_BOLD);
(void) tee_puts(str, file);
vidattr(A_NORMAL);
my_vidattr(A_NORMAL);
}
if (unbuffered)
fflush(file);
Expand Down
2 changes: 1 addition & 1 deletion client/mysql_upgrade.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
Copyright (c) 2010, 2016, MariaDB
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
Expand Down
13 changes: 3 additions & 10 deletions client/mysqladmin.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
Copyright (c) 2010, 2016, MariaDB
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
Expand Down Expand Up @@ -235,8 +235,6 @@ my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
int error = 0;

switch(optid) {
case 'c':
opt_count_iterations= 1;
Expand Down Expand Up @@ -284,8 +282,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case '?':
case 'I': /* Info */
error++;
break;
usage();
exit(0);
case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300
charsets_dir = argument;
Expand All @@ -296,11 +294,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt->name);
break;
}
if (error)
{
usage();
exit(1);
}
return 0;
}

Expand Down
15 changes: 15 additions & 0 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define TABLE TABLE_CLIENT
#include "client_priv.h"
#include <my_time.h>
#include <sslopt-vars.h>
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
#include "sql_priv.h"
#include "log_event.h"
Expand Down Expand Up @@ -1403,6 +1404,7 @@ static struct my_option my_options[] =
{"socket", 'S', "The socket file to use for connection.",
&sock, &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
#include <sslopt-longopts.h>
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time "
Expand Down Expand Up @@ -1621,6 +1623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
#endif
#include <sslopt-case.h>
case 'd':
one_database = 1;
break;
Expand Down Expand Up @@ -1773,6 +1776,18 @@ static Exit_status safe_connect()
return ERROR_STOP;
}

#ifdef HAVE_OPENSSL
if (opt_use_ssl)
{
mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
}
mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
(char*)&opt_ssl_verify_server_cert);
#endif /*HAVE_OPENSSL*/

if (opt_plugindir && *opt_plugindir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugindir);

Expand Down
31 changes: 18 additions & 13 deletions client/mysqlcheck.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
Copyright (c) 2010, 2016, MariaDB
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
Expand Down Expand Up @@ -246,7 +246,7 @@ static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when);
static void safe_exit(int error);
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);
int what_to_do = 0;

Expand Down Expand Up @@ -594,18 +594,18 @@ static int process_selected_tables(char *db, char **table_names, int tables)
} /* process_selected_tables */


static uint fixed_name_length(const char *name)
static size_t fixed_name_length(const char *name)
{
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");

for (p= name; *p; p++)
{
if (*p == '`')
extra_length++;
}
DBUG_RETURN((uint) ((p - name) + extra_length));
DBUG_RETURN((size_t) ((p - name) + extra_length));
}


Expand Down Expand Up @@ -664,7 +664,7 @@ static int process_all_tables_in_db(char *database)
*/

char *tables, *end;
uint tot_length = 0;
size_t tot_length = 0;

char *views, *views_end;
uint tot_views_length = 0;
Expand Down Expand Up @@ -769,7 +769,9 @@ static int fix_table_storage_name(const char *name)

if (strncmp(name, "#mysql50#", 9))
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, 1);
if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
Expand All @@ -784,7 +786,8 @@ static int fix_database_storage_name(const char *name)

if (strncmp(name, "#mysql50#", 9))
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, 1);
if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
Expand All @@ -806,7 +809,7 @@ static int rebuild_table(char *name)
ptr= strxmov(ptr, " FORCE", NullS);
if (verbose >= 3)
puts(query);
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, "Error: %s\n", mysql_error(sock));
Expand Down Expand Up @@ -871,7 +874,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
{
char *query, *end, options[100], message[100];
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 *tab_view;
DBUG_ENTER("handle_request_for_tables");
Expand Down Expand Up @@ -924,10 +927,12 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
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);
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 */
query_length= sprintf(query, "%s%s%s %s", op,
tab_view, tables, options);
Expand All @@ -943,7 +948,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
(int) (ptr - org)));
table_name= table_name_buff;
ptr= strxmov(ptr, " ", options, NullS);
query_length= (uint) (ptr - query);
query_length= (size_t) (ptr - query);
}
if (verbose >= 3)
puts(query);
Expand Down Expand Up @@ -1209,7 +1214,7 @@ int main(int argc, char **argv)
process_databases(argv);
if (opt_auto_repair)
{
uint i;
size_t i;

if (!opt_silent && (tables4repair.elements || tables4rebuild.elements))
puts("\nRepairing tables");
Expand Down
Loading

0 comments on commit 932646b

Please sign in to comment.