Skip to content

Commit 7a595ca

Browse files
committed
Merge branch 'mysql-5.7' of myrepo.no.oracle.com:mysql into mysql-5.7
2 parents d70a55a + 755b35c commit 7a595ca

File tree

545 files changed

+22340
-3424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

545 files changed

+22340
-3424
lines changed

client/CMakeLists.txt

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ INCLUDE_DIRECTORIES(
1818
${CMAKE_SOURCE_DIR}/include
1919
${CMAKE_SOURCE_DIR}/mysys_ssl
2020
${ZLIB_INCLUDE_DIR}
21+
${LZ4_INCLUDE_DIR}
2122
${SSL_INCLUDE_DIRS}
2223
${CMAKE_SOURCE_DIR}/libmysql
2324
${CMAKE_SOURCE_DIR}/libbinlogevents/include
@@ -27,14 +28,76 @@ INCLUDE_DIRECTORIES(
2728
${CMAKE_CURRENT_BINARY_DIR}
2829
)
2930

31+
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
32+
33+
# Prevent Boost from including external precompiled Boost libraries, use
34+
# threading (not implemented for Solaris) and turn off unused functionality.
35+
ADD_DEFINITIONS(
36+
-DBOOST_ALL_NO_LIB
37+
-DBOOST_SYSTEM_NO_DEPRECATED)
38+
3039
## Subdirectory with common client code.
3140
ADD_SUBDIRECTORY(base)
41+
## Subdirectory for mysqlpump code.
42+
ADD_SUBDIRECTORY(dump)
3243

3344
## We will need libeay32.dll and ssleay32.dll when running client executables.
3445
COPY_OPENSSL_DLLS(copy_openssl_client)
3546

3647
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
3748

49+
IF(WIN32)
50+
LIST(APPEND BOOST_THREAD_SOURCES
51+
${BOOST_INCLUDE_DIR}/libs/thread/src/win32/thread.cpp
52+
${BOOST_INCLUDE_DIR}/libs/thread/src/win32/tss_dll.cpp
53+
${BOOST_INCLUDE_DIR}/libs/thread/src/win32/tss_pe.cpp
54+
)
55+
ELSE()
56+
LIST(APPEND BOOST_THREAD_SOURCES
57+
${BOOST_INCLUDE_DIR}/libs/thread/src/pthread/once.cpp
58+
${BOOST_INCLUDE_DIR}/libs/thread/src/pthread/thread.cpp
59+
)
60+
ENDIF()
61+
62+
SET(BOOST_LIB_SOURCES
63+
${CMAKE_SOURCE_DIR}/include/boost_1_57_0/libs/atomic/src/lockpool.cpp
64+
${BOOST_INCLUDE_DIR}/libs/chrono/src/chrono.cpp
65+
${BOOST_INCLUDE_DIR}/libs/chrono/src/process_cpu_clocks.cpp
66+
${BOOST_INCLUDE_DIR}/libs/chrono/src/thread_clock.cpp
67+
${BOOST_INCLUDE_DIR}/libs/system/src/error_code.cpp
68+
${BOOST_INCLUDE_DIR}/libs/thread/src/future.cpp
69+
)
70+
71+
ADD_CONVENIENCE_LIBRARY(boost_lib
72+
${BOOST_LIB_SOURCES}
73+
${BOOST_THREAD_SOURCES}
74+
)
75+
76+
SET_TARGET_PROPERTIES(boost_lib
77+
PROPERTIES COMPILE_FLAGS "-DBOOST_THREAD_BUILD_LIB")
78+
79+
# Do not build library unless it is needed by some other target.
80+
SET_PROPERTY(TARGET boost_lib PROPERTY EXCLUDE_FROM_ALL TRUE)
81+
82+
MY_CHECK_CXX_COMPILER_FLAG("-Wno-logical-op" HAVE_NO_LOGICAL_OP)
83+
IF(HAVE_NO_LOGICAL_OP)
84+
ADD_COMPILE_FLAGS(
85+
${BOOST_INCLUDE_DIR}/libs/thread/src/pthread/thread.cpp
86+
COMPILE_FLAGS "-Wno-logical-op"
87+
)
88+
ENDIF()
89+
90+
ADD_COMPILE_FLAGS(
91+
${BOOST_LIB_SOURCES}
92+
${BOOST_THREAD_SOURCES}
93+
COMPILE_FLAGS -I${BOOST_PATCHES_DIR} -I${BOOST_INCLUDE_DIR}
94+
)
95+
96+
# Need explicit pthread for gcc -fsanitize=address
97+
IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
98+
TARGET_LINK_LIBRARIES(boost_lib pthread)
99+
ENDIF()
100+
38101
ADD_DEFINITIONS(${SSL_DEFINES})
39102
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc ../sql-common/sql_string.cc)
40103
TARGET_LINK_LIBRARIES(mysql mysqlclient)
@@ -45,12 +108,12 @@ ENDIF(UNIX)
45108
IF(NOT WITHOUT_SERVER)
46109
MYSQL_ADD_EXECUTABLE(mysql_upgrade
47110
upgrade/program.cc
48-
upgrade/mysql_query_runner.cc
49-
upgrade/show_variable_query_extractor.cc
50-
../sql-common/sql_string.cc
51111
)
52-
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient client_base mysqlcheck_core)
53-
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs GenSysSchema)
112+
ADD_COMPILE_FLAGS(
113+
upgrade/program.cc COMPILE_FLAGS -I${BOOST_PATCHES_DIR} -I${BOOST_INCLUDE_DIR}
114+
)
115+
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient client_base mysqlcheck_core)
116+
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs GenSysSchema)
54117
ENDIF()
55118

56119
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)

client/base/CMakeLists.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -33,4 +33,26 @@ ADD_CONVENIENCE_LIBRARY(client_base
3333

3434
abstract_program.cc
3535
abstract_connection_program.cc
36+
37+
message_data.cc
38+
mysql_query_runner.cc
39+
show_variable_query_extractor.cc
40+
41+
mutex.cc
42+
43+
../get_password.c
44+
45+
../../sql-common/sql_string.cc
3646
)
47+
48+
ADD_COMPILE_FLAGS(
49+
mutex.cc
50+
mysql_query_runner.cc
51+
show_variable_query_extractor.cc
52+
COMPILE_FLAGS -I${BOOST_PATCHES_DIR} -I${BOOST_INCLUDE_DIR}
53+
)
54+
55+
TARGET_LINK_LIBRARIES(client_base mysqlclient boost_lib)
56+
57+
# Do not build library unless it is needed by some other target.
58+
SET_PROPERTY(TARGET client_base PROPERTY EXCLUDE_FROM_ALL TRUE)

client/base/abstract_connection_program.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -30,3 +30,13 @@ MYSQL* Abstract_connection_program::create_connection()
3030
{
3131
return this->m_connection_options.create_connection();
3232
}
33+
34+
CHARSET_INFO* Abstract_connection_program::get_current_charset() const
35+
{
36+
return m_connection_options.get_current_charset();
37+
}
38+
39+
void Abstract_connection_program::set_current_charset(CHARSET_INFO* charset)
40+
{
41+
m_connection_options.set_current_charset(charset);
42+
}

client/base/abstract_connection_program.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -31,14 +31,11 @@ namespace Mysql{
3131
namespace Tools{
3232
namespace Base{
3333

34-
using std::string;
35-
using std::vector;
36-
3734
/**
3835
Base class for all programs that use connection to MySQL database server.
3936
*/
4037
class Abstract_connection_program
41-
: public Abstract_program, I_connection_factory
38+
: public Abstract_program, public I_connection_factory
4239
{
4340
public:
4441
/**
@@ -47,6 +44,17 @@ class Abstract_connection_program
4744
*/
4845
virtual MYSQL* create_connection();
4946

47+
/**
48+
Retrieves charset that will be used in new MySQL connections. Can be NULL
49+
if none was set explicitly.
50+
*/
51+
CHARSET_INFO* get_current_charset() const;
52+
53+
/**
54+
Sets charset that will be used in new MySQL connections.
55+
*/
56+
void set_current_charset(CHARSET_INFO* charset);
57+
5058
protected:
5159
Abstract_connection_program();
5260

client/base/abstract_integer_number_option.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -26,8 +26,6 @@ namespace Tools{
2626
namespace Base{
2727
namespace Options{
2828

29-
using std::string;
30-
3129
/**
3230
Abstract option to handle integer number option values.
3331
*/
@@ -68,12 +66,14 @@ template<typename T_type, typename T_value> class Abstract_integer_number_option
6866
@param desription Description of option to be printed in --help.
6967
*/
7068
Abstract_integer_number_option(
71-
T_value* value, ulong var_type, string name, string description);
69+
T_value* value, ulong var_type, std::string name, std::string description);
7270
};
7371

7472
template<typename T_type, typename T_value>
75-
Abstract_integer_number_option<T_type, T_value>::Abstract_integer_number_option(
76-
T_value* value, ulong var_type, string name, string description)
73+
Abstract_integer_number_option<T_type, T_value>::
74+
Abstract_integer_number_option(
75+
T_value* value, ulong var_type, std::string name,
76+
std::string description)
7777
: Abstract_number_option<T_type, T_value>(
7878
value, var_type, name, description, 0)
7979
{

client/base/abstract_number_option.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -26,8 +26,6 @@ namespace Tools{
2626
namespace Base{
2727
namespace Options{
2828

29-
using std::string;
30-
3129
/**
3230
Abstract option to handle numeric option values.
3331
*/
@@ -57,14 +55,14 @@ template<typename T_type, typename T_value> class Abstract_number_option
5755
@param default_value default value to be supplied to internal option
5856
data structure.
5957
*/
60-
Abstract_number_option(T_value* value, ulong var_type, string name,
61-
string description, uint64 default_value);
58+
Abstract_number_option(T_value* value, ulong var_type, std::string name,
59+
std::string description, uint64 default_value);
6260
};
6361

6462

6563
template<typename T_type, typename T_value>Abstract_number_option<T_type, T_value>
6664
::Abstract_number_option(
67-
T_value* value, ulong var_type, string name, string description,
65+
T_value* value, ulong var_type, std::string name, std::string description,
6866
uint64 default_value)
6967
: Abstract_value_option<T_type>(
7068
value, var_type, name, description, default_value)

client/base/abstract_option.h

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -30,10 +30,6 @@ namespace Tools{
3030
namespace Base{
3131
namespace Options{
3232

33-
using std::string;
34-
using std::vector;
35-
using Base::I_callable;
36-
3733
class Abstract_options_provider;
3834

3935
/**
@@ -50,7 +46,7 @@ template<typename T_type> class Abstract_option : public I_option
5046
I_Callable can be replaced with std::Function<void(char*)> once we get
5147
one.
5248
*/
53-
T_type* add_callback(I_callable<void, char*>* callback);
49+
T_type* add_callback(Mysql::I_callable<void, char*>* callback);
5450

5551
/**
5652
Sets optid to given character to make possible usage of short option
@@ -69,8 +65,8 @@ template<typename T_type> class Abstract_option : public I_option
6965
@param default_value default value to be supplied to internal option
7066
data structure.
7167
*/
72-
Abstract_option(void* value, ulong var_type, string name, string description,
73-
uint64 default_value);
68+
Abstract_option(void* value, ulong var_type, std::string name,
69+
std::string description, uint64 default_value);
7470

7571
/**
7672
Returns my_getopt internal option data structure representing this option.
@@ -90,7 +86,7 @@ template<typename T_type> class Abstract_option : public I_option
9086
private:
9187
void call_callbacks(char* argument);
9288

93-
vector<I_callable<void, char*>*> m_callbacks;
89+
std::vector<Mysql::I_callable<void, char*>*> m_callbacks;
9490
I_option_changed_listener* m_option_changed_listener;
9591

9692
friend class Abstract_options_provider;
@@ -101,21 +97,24 @@ template<typename T_type> Abstract_option<T_type>::~Abstract_option()
10197
my_free((void*)this->m_option_structure.name);
10298
my_free((void*)this->m_option_structure.comment);
10399

104-
for (vector<I_callable<void, char*>*>::iterator it= this->m_callbacks.begin();
100+
for (std::vector<Mysql::I_callable<void, char*>*>::iterator
101+
it= this->m_callbacks.begin();
105102
it != this->m_callbacks.end();
106103
it++)
107104
{
108105
delete *it;
109106
}
110107
}
111108

112-
template<typename T_type> T_type* Abstract_option<T_type>::add_callback(I_callable<void, char*>* callback)
109+
template<typename T_type> T_type* Abstract_option<T_type>::add_callback(
110+
Mysql::I_callable<void, char*>* callback)
113111
{
114112
this->m_callbacks.push_back(callback);
115113
return (T_type*)this;
116114
}
117115

118-
template<typename T_type> T_type* Abstract_option<T_type>::set_short_character(char code)
116+
template<typename T_type> T_type* Abstract_option<T_type>::set_short_character(
117+
char code)
119118
{
120119
// Change optid to new one
121120
uint32 old_optid= this->m_option_structure.id;
@@ -124,14 +123,16 @@ template<typename T_type> T_type* Abstract_option<T_type>::set_short_character(c
124123
// Inform that it has changed
125124
if (this->m_option_changed_listener != NULL)
126125
{
127-
this->m_option_changed_listener->notify_option_optid_changed(this, old_optid);
126+
this->m_option_changed_listener->notify_option_optid_changed(
127+
this, old_optid);
128128
}
129129

130130
return (T_type*)this;
131131
}
132132

133133
template<typename T_type> Abstract_option<T_type>::Abstract_option(void* value,
134-
ulong var_type, string name, string description, uint64 default_value)
134+
ulong var_type, std::string name, std::string description,
135+
uint64 default_value)
135136
: m_option_changed_listener(NULL)
136137
{
137138
this->m_option_structure.block_size= 0;
@@ -168,17 +169,21 @@ template<typename T_type> my_option Abstract_option<T_type>::get_my_option()
168169
return this->m_option_structure;
169170
}
170171

171-
template<typename T_type> void Abstract_option<T_type>::set_option_changed_listener(I_option_changed_listener* listener)
172+
template<typename T_type> void
173+
Abstract_option<T_type>::set_option_changed_listener(
174+
I_option_changed_listener* listener)
172175
{
173176
DBUG_ASSERT(this->m_option_changed_listener == NULL);
174177

175178
this->m_option_changed_listener= listener;
176179
}
177180

178-
template<typename T_type> void Abstract_option<T_type>::call_callbacks(char* argument)
181+
template<typename T_type> void Abstract_option<T_type>::call_callbacks(
182+
char* argument)
179183
{
180-
vector<I_callable<void, char*>*>::iterator callback_it;
181-
for (callback_it= this->m_callbacks.begin(); callback_it != this->m_callbacks.end(); callback_it++)
184+
std::vector<Mysql::I_callable<void, char*>*>::iterator callback_it;
185+
for (callback_it= this->m_callbacks.begin();
186+
callback_it != this->m_callbacks.end(); callback_it++)
182187
{
183188
(**callback_it)(argument);
184189
}

0 commit comments

Comments
 (0)