Skip to content

Commit 548161a

Browse files
committed
Merge branch 'api-cleanup' into wl9953-unix-sockets
# Conflicts: # cdk/foundation/socket_detail.cc # devapi/session.cc # include/mysql_devapi.h # testing/test.h # xapi/tests/test.h
2 parents c8fce60 + d6bbd9e commit 548161a

Some content is hidden

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

64 files changed

+6909
-5217
lines changed

CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,14 @@ else()
204204
add_definitions(-DCONCPP_BUILD_SHARED)
205205
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
206206

207+
# Hide all symbols that are not explicitly exported.
207208
# Note: setting target property CXX_VISIBILITY did not work for
208209
# object libraries that we use to build the connector.
209210

210-
if(CMAKE_COMPILER_IS_GNUCXX)
211-
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
212-
add_compile_options(-fvisibility-ms-compat)
213-
elseif()
214-
add_compile_options(-fvisibility=hidden)
215-
endif()
211+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
212+
add_compile_options(-fvisibility-ms-compat)
213+
elseif(CMAKE_COMPILER_IS_GNUCXX)
214+
add_compile_options(-fvisibility=hidden)
216215
endif()
217216

218217
endif()
@@ -518,6 +517,8 @@ SET_INTERFACE_OPTIONS(try devapi)
518517
# TODO: Do it also for the shared library
519518
#
520519

520+
if(NOT WIN32)
521+
521522
find_program(LDD ldd)
522523
if(NOT LDD)
523524
find_program(LDD otool)
@@ -533,6 +534,8 @@ if(LDD)
533534
)
534535
endif()
535536

537+
endif()
538+
536539
#
537540
# Linking test
538541
#
@@ -591,11 +594,11 @@ if(NOT CMAKE_INSTALL_PREFIX)
591594
else()
592595
set(install_prefix "C:/Program Files (x86)")
593596
endif()
594-
set(CMAKE_INSTALL_PREFIX "${install_prefix}/MySQL/MySQL Connector C++ 2.0")
597+
set(CMAKE_INSTALL_PREFIX "${install_prefix}/MySQL/MySQL Connector C++ ${CONCPP_PACKAGE_BASE_VERSION}")
595598

596599
else()
597600

598-
set(CMAKE_INSTALL_PREFIX "/usr/local/mysql/connector-c++-2.0")
601+
set(CMAKE_INSTALL_PREFIX "/usr/local/mysql/connector-c++-${CONCPP_PACKAGE_BASE_VERSION}")
599602

600603
endif()
601604

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MySQL Connector/C++ 2.0
1+
MySQL Connector/C++ 8.0
22

33
This is a release of MySQL Connector/C++, Oracle's
44
dual-license C++ API for connecting client applications
@@ -46,6 +46,9 @@ DOCUMENTATION LOCATION
4646
You can find the documentation on the MySQL website at
4747
<http://dev.mysql.com/doc/dev/connector-cpp/>
4848

49+
For the new features/bugfix history, see release notes at
50+
<https://dev.mysql.com/doc/relnotes/connector-cpp/en/news-8-0-5.html>.
51+
Note that the initial releases used major version 2.0.
4952

5053
CONTACT
5154
=======

cdk/cmake/headers.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,29 @@ SET(headers_dir "${headers_dir}/headers")
5959
#MESSAGE("headers.cmake: ${headers_dir}")
6060

6161

62+
#
63+
# Check if given list of headers includes all headers that can be found in
64+
# the current directory.
65+
#
66+
67+
function(check_headers)
68+
69+
file(GLOB all_headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
70+
71+
foreach(header IN LISTS ARGV)
72+
#message("- checking header: ${header}\n")
73+
list(REMOVE_ITEM all_headers ${header})
74+
endforeach()
75+
76+
list(LENGTH all_headers remains)
77+
78+
if(remains GREATER 0)
79+
message(WARNING "Extra headers found in ${CMAKE_CURRENT_SOURCE_DIR}: ${all_headers}")
80+
endif()
81+
82+
endfunction()
83+
84+
6285
#
6386
# Set-up header declarations with given folder as a base location for all
6487
# public headers.

cdk/include/mysql/cdk/api/document.h

Lines changed: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class Doc_base : public Expr_base< Doc_processor<PRC> >
170170
with Doc_path_processor to describe one element of the path.
171171
*/
172172

173-
class Doc_path_processor
173+
class Doc_path_element_processor
174174
{
175175
public:
176176

@@ -198,7 +198,20 @@ class Doc_path_processor
198198
virtual void any_path() =0;
199199
};
200200

201-
typedef Expr_list< Expr_base<Doc_path_processor> > Doc_path;
201+
202+
class Doc_path_processor
203+
: public List_processor< Doc_path_element_processor >
204+
{
205+
public:
206+
207+
typedef Element_prc::string string;
208+
typedef Element_prc::index_t index_t;
209+
210+
// The "$" path which denotes the whole document.
211+
virtual void whole_document() = 0;
212+
};
213+
214+
typedef Expr_base<Doc_path_processor> Doc_path;
202215

203216

204217
}} // cdk::api
@@ -209,7 +222,7 @@ namespace cdk {
209222
class Doc_path_storage
210223
: public api::Doc_path
211224
, public api::Doc_path::Processor
212-
, api::Doc_path_processor
225+
, api::Doc_path_element_processor
213226
{
214227
public:
215228

@@ -221,6 +234,9 @@ class Doc_path_storage
221234
DOUBLE_ASTERISK
222235
};
223236

237+
using api::Doc_path_element_processor::string;
238+
using api::Doc_path_element_processor::index_t;
239+
224240
protected:
225241

226242
struct Path_el
@@ -243,7 +259,12 @@ class Doc_path_storage
243259

244260
bool is_empty() const
245261
{
246-
return 0 == length();
262+
return m_whole_document ? false : 0 == length();
263+
}
264+
265+
bool is_whole_document() const
266+
{
267+
return m_whole_document;
247268
}
248269

249270
const Path_el& get_el(size_t pos) const
@@ -260,11 +281,17 @@ class Doc_path_storage
260281

261282
void process(Processor &prc) const
262283
{
284+
if (m_whole_document)
285+
{
286+
prc.whole_document();
287+
return;
288+
}
289+
263290
prc.list_begin();
264291

265292
for (size_t pos = 0; pos < m_path.size(); ++pos)
266293
{
267-
api::Doc_path_processor *eprc = prc.list_el();
294+
api::Doc_path_element_processor *eprc = prc.list_el();
268295
if (eprc)
269296
{
270297
const Path_el &el = m_path[pos];
@@ -285,10 +312,12 @@ class Doc_path_storage
285312

286313
// List_processor
287314

288-
Path_el *m_el;
315+
bool m_whole_document = false;
316+
Path_el *m_el = NULL;
289317

290318
Element_prc* list_el()
291319
{
320+
assert(!m_whole_document);
292321
m_path.push_back(Path_el());
293322
m_el = &m_path.back();
294323
return this;
@@ -298,6 +327,11 @@ class Doc_path_storage
298327

299328
// Doc_path_processor
300329

330+
void whole_document()
331+
{
332+
m_whole_document = true;
333+
}
334+
301335
void member(const string &name)
302336
{
303337
assert(m_el);
@@ -398,10 +432,10 @@ struct Safe_prc< cdk::api::Doc_processor<PRC> >
398432

399433

400434
template<>
401-
struct Safe_prc<api::Doc_path_processor>
402-
: Safe_prc_base<api::Doc_path_processor>
435+
struct Safe_prc<api::Doc_path_element_processor>
436+
: Safe_prc_base<api::Doc_path_element_processor>
403437
{
404-
typedef Safe_prc_base<api::Doc_path_processor> Base;
438+
typedef Safe_prc_base<api::Doc_path_element_processor> Base;
405439
using Base::Processor;
406440
typedef Processor::string string;
407441
typedef Processor::index_t index_t;
@@ -430,6 +464,42 @@ struct Safe_prc<api::Doc_path_processor>
430464
{ return m_prc ? m_prc->any_path() : (void)NULL; }
431465
};
432466

467+
template<>
468+
struct Safe_prc<api::Doc_path_processor>
469+
: Safe_prc_base<api::Doc_path_processor>
470+
{
471+
472+
typedef Safe_prc_base<api::Doc_path_processor> Base;
473+
using Base::Processor;
474+
typedef Processor::string string;
475+
typedef Processor::index_t index_t;
476+
477+
Safe_prc(Processor *prc) : Base(prc)
478+
{}
479+
480+
Safe_prc(Processor &prc) : Base(&prc)
481+
{}
482+
483+
void list_begin()
484+
{
485+
if (m_prc)
486+
m_prc->list_begin();
487+
}
488+
489+
void list_end()
490+
{
491+
if (m_prc)
492+
m_prc->list_end();
493+
}
494+
495+
api::Doc_path_processor::Element_prc* list_el()
496+
{ return m_prc ? m_prc->list_el() : NULL; }
497+
498+
void whole_document()
499+
{ return m_prc ? m_prc->whole_document() : (void)NULL; }
500+
501+
};
502+
433503
}
434504

435505
#endif

cdk/include/mysql/cdk/protocol/mysqlx.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ enum ServerMessages_Type {
146146
CrudUpdate, CRUD_UPDATE) \
147147
MSG_CLIENT(X, Mysqlx::Crud::Delete, \
148148
CrudDelete, CRUD_DELETE) \
149-
MSG_CLIENT(X, Mysqlx::Crud::Delete, \
149+
MSG_CLIENT(X, Mysqlx::Expect::Open, \
150150
ExpectOpen, EXPECT_OPEN) \
151-
MSG_CLIENT(X, Mysqlx::Crud::Delete, \
151+
MSG_CLIENT(X, Mysqlx::Expect::Close, \
152152
ExpectClose, EXPECT_CLOSE) \
153153
MSG_CLIENT(X, Mysqlx::Crud::CreateView, CreateView, CRUD_CREATE_VIEW) \
154154
MSG_CLIENT(X, Mysqlx::Crud::ModifyView, ModifyView, CRUD_MODIFY_VIEW) \
@@ -416,6 +416,23 @@ typedef cdk::api::Columns Columns;
416416

417417
typedef cdk::api::View_options View_options;
418418

419+
420+
struct Expectation_processor
421+
{
422+
virtual void set(uint32_t key) = 0;
423+
virtual void set(uint32_t key, bytes) = 0;
424+
virtual void unset(uint32_t key) = 0;
425+
};
426+
427+
#undef NO_ERROR
428+
429+
struct Expectations:
430+
cdk::api::Expr_list< cdk::api::Expr_base<Expectation_processor> >
431+
{
432+
/* Only these two options are defined in mysqlx_expect.proto */
433+
enum { NO_ERROR = 1, FIELD_EXISTS = 2 };
434+
};
435+
419436
} // api namespace
420437

421438

@@ -597,6 +614,8 @@ class Protocol
597614
const api::Args_map *args = NULL);
598615
Op& snd_DropView(const api::Db_obj &obj, bool if_exists);
599616

617+
Op& snd_Expect_Open(api::Expectations &exp, bool reset = false);
618+
Op& snd_Expect_Close();
600619

601620
Op& rcv_AuthenticateReply(Auth_processor &);
602621
Op& rcv_Reply(Reply_processor &);

cdk/include/mysql/cdk/protocol/mysqlx/expr.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,14 @@ class Doc_path
235235
MEMBER_ASTERISK = 2,
236236
ARRAY_INDEX = 3,
237237
ARRAY_INDEX_ASTERISK = 4,
238-
DOUBLE_ASTERISK = 5
238+
DOUBLE_ASTERISK = 5,
239239
};
240240

241241
virtual ~Doc_path() {}
242242

243+
// The "$" path which denotes the whole document.
244+
virtual bool is_whole_document() const = 0;
245+
243246
virtual unsigned length() const =0;
244247
virtual Type get_type(unsigned pos) const =0;
245248
virtual const string* get_name(unsigned pos) const =0;

cdk/mysqlx/converters.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ struct Doc_path_storage
170170

171171
// Proto_path interface
172172

173+
bool is_whole_document() const
174+
{
175+
return cdk::Doc_path_storage::is_whole_document();
176+
}
177+
173178
unsigned length() const
174179
{
175180
size_t len = cdk::Doc_path_storage::length();

0 commit comments

Comments
 (0)