In addition to the new APIs introduced in MySQL Connector/C++ 8.0 (X DevAPI and X DevAPI for C), Connector/C++ now also supports the legacy API based on JDBC4. Applications written against the JDBC4-based API of Connector/C++ 1.1 can be also compiled with Connector/C++ 8.0, which is backward compatible with the earlier version. Such code does not require the X Plugin and can communicate with older versions of the MySQL Server using the legacy protocol. This contrasts with X DevAPI and X DevAPI for C applications, which expect MySQL Server 8.0.
The legacy API is implemented as a separate library with the
base name mysqlcppconn (as opposed to
mysqlcppconn8) implementing the new APIs. To
build the legacy library, you must configure Connector/C++ using the
-DWITH_JDBC=ON
CMake option. For information about using the
legacy API, refer to the documentation at
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-getting-started-examples.html.
-
View and table DDL methods have been removed. It is preferable that SQL statements be used for such operations.
Removed X DevAPI methods:
Schema.createView() Schema.alterView() Schema.dropView() Schema.dropTable()Removed X DevAPI data types:
Algorithm CheckOption SQLSecurityRemoved X DevAPI for C functions:
mysqlx_view_create mysqlx_view_create_new mysqlx_view_modify mysqlx_view_modify_new mysqlx_view_replace mysqlx_view_replace_new mysqlx_view_drop mysqlx_table_drop mysqlx_set_view_algorithm mysqlx_set_view_security mysqlx_set_view_definer mysqlx_set_view_check_option mysqlx_set_view_columnsRemoved X DevAPI for C enumerations:
mysqlx_view_algorithm_t mysqlx_view_security_t mysqlx_view_check_option_tRemoved X DevAPI for C macros:
VIEW_ALGORITHM() VIEW_SECURITY() VIEW_DEFINER() VIEW_CHECK_OPTION() VIEW_COLUMNS() VIEW_OPTION_XXX(WL #11375)
-
Connector/C++ now supports the
caching_sha2_passwordauthentication plugin introduced in MySQL 8.0 (see Caching SHA-2 Pluggable Authentication), with these limitations:For X DevAPI or X DevAPI for C applications, only encrypted (SSL) connections can be used to connect to
cached_sha2_passwordaccounts. For non-SSL connections, it is not possible to usecached_sha2_passwordaccounts.-
For applications that use the legacy JDBC API (that is, not X DevAPI or X DevAPI for C), it is possible to make connections to
cached_sha2_passwordaccounts in the following scenario:The connection is unencrypted (
OPT_SSL_MODEis set toSSL_MODE_DISABLED).The server public key is given using the "rsaKey" option and no RSA key exchange is used (
OPT_GET_SERVER_PUBLIC_KEYis set to false).
If RSA key exchange is enabled, the connection works.
(WL #11415)
-
It is now possible to use the
Collectioninterface to create and drop indexes on document collections.X DevAPI example:
coll.createIndex("idx", R"({ "fields": [ { "field": "$.zip", "type": "TEXT(10)" }, { "field": "$.count", "type": "INT UNSIGNED" } ] })" ); coll.createIndex("loc", R"({ "type": "SPATIAL", "fields": [ { "field": "$.coords", "type": "GEOJSON", "srid": 31287 } ] })" ); coll.dropIndex("idx");X DevAPI for C example:
ret = mysqlx_collection_create_index(coll, "idx", R"({ "fields": [ { "field": "$.zip", "type": "TEXT(10)" }, { "field": "$.count", "type": "INT UNSIGNED" } ] })" ) ret = mysqlx_collecton_create_index(coll, "loc", R"({ "type": "SPATIAL", "fields": [ { "field": "$.coords", "type": "GEOJSON", "srid": 31287 } ] })" ); mysqlx_collection_drop_index(coll, "idx");(WL #11231)
-
It is now possible to use the
Sessioninterface to create savepoints inside transactions and roll back a transaction to a given savepoint. This interface supports the operations provided by theSAVEPOINT,ROLLBACK TO SAVEPOINT, andRELEASE SAVEPOINTstatements. For more information about these statements, see SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements.X DevAPI example:
sess.startTransaction(); string point1 = sess.setSavepoint(); sess.setSavepoint("point2"); sess.rollbackTo(point1); // this also removes savepoint "point2" string point3 = sess.setSavepoint(); sess.releaseSavepoint(point3); // explicitly remove savepoint sess.commitTransaction();X DevAPI for C example:
mysqlx_trasaction_begin(sess); const char *point1 = mysqlx_savepoint_set(sess,NULL); mysqlx_savepoint_set(sess,"point2"); mysqlx_rollback_to(sess,point1); const char *point3 = mysqlx_savepoint_set(sess,NULL); mysqlx_sevepoint_release(sess,point3); mysqlx_transaction_commit(sess);For more information, see Working with Savepoints. (WL #11229)
Connector/C++ now implements TLS connections using the OpenSSL library. It is possible to build Connector/C++ with OpenSSL or the bundled yaSSL implementation of TLS. This is controlled by the
WITH_SSLCMake option, which takes these values:bundled(build using bundled yaSSL code);system(build using system OpenSSL library, with the location as detected by CMake);path_name(build using OpenSSL library installed at the named location). For more information, see “How to build code that uses Connector/C++” in the Connector/C++ X DevAPI Reference, available at https://dev.mysql.com/doc/index-connectors.html. (WL #11376)