Documentation Home
MySQL Connector/C++ Release Notes
Related Documentation Download these Release Notes
PDF (US Ltr) - 297.3Kb
PDF (A4) - 298.6Kb


MySQL Connector/C++ Release Notes  /  Changes in MySQL Connector/C++ 8  /  Changes in MySQL Connector/C++ 8.0.6 (2017-09-28, Development Milestone)

Changes in MySQL Connector/C++ 8.0.6 (2017-09-28, Development Milestone)

X DevAPI Notes

  • A session now can acquire a lock for documents or rows returned by find or select statements, to prevent the returned values from being changed from other sessions while the lock is held (provided that appropriate isolation levels are used). Locks can be requested several times for a given find or select statement. Only the final request is acted upon. An acquired lock is held until the end of the current transaction.

    For X DevAPI, CollectionFind and TableSelect implement .lockExclusive() and .lockShared() methods, which request exclusive or shared locks, respectively, on returned documents or rows. These methods can be called after .bind() and before the final .execute().

    For X DevAPI for C, the new mysqlx_set_locking(stmt, lock) function can be called to request exclusive or shared locks on returned documents or rows, or to release locks. The lock parameter can be ROW_LOCK_EXCLUSIVE, ROW_LOCK_SHARED, or ROW_LOCK_NONE. The first two values specify a type of lock to be acquired. ROW_LOCK_NONE removes any row locking request from the statement. (WL #10980)

  • For X DevAPI, a new auth option can be specified in connection strings or URIs to indicate the authentication mechanism. Permitted values are PLAIN and MYSQL41. The option name and value are not case sensitive. The SessionSettings::Options object supports a new AUTH enumeration, with the same permitted values.

    For X DevAPI for C, a new auth setting can be specified in connection strings or URIs to indicate the authentication mechanism. Permitted values are PLAIN and MYSQL41. The option name and value are not case sensitive. A new MYSQLX_OPT_AUTH constant is recognized by the mysqlx_options_set() function, with permitted values MYSQLX_AUTH_PLAIN and MYSQLX_AUTH_MYSQL41.

    If the authentication mechanism is not specified, it defaults to PLAIN for secure (TLS) connections, or MYSQL41 for insecure connections. For Unix socket connections, the default is PLAIN. (WL #10718)

  • Boolean expressions used in queries and statements now support a variant of the IN operator for which the right hand side operand is any expression that evaluates to an array or document.

    X DevAPI example:

    coll.find("'car' IN $.toys").execute();

    X DevAPI for C example:

    res = mysqlx_collection_find(coll, "'car' IN $.toys");

    In this form, the IN operator is equivalent to the JSON_CONTAINS() SQL function. (WL #10979)

  • On Unix and Unix-like systems, Unix domain socket files are now supported as a connection transport for X DevAPI or X DevAPI for C connections. The socket file can be given in a connection string or in the session creation options.

    X DevAPI examples:

    XSession sess("mysqlx://user:password@(/path/to/mysql.sock)/schema");
    
    XSession sess({ SessionSettings::USER, "user",
    SessionSettings::PWD, "password,
    SessionSettings::SOCKET, "/path/to/mysql.sock"
    SessionSettings::DB, "schema" });

    X DevAPI for C examples:

    mysqlx_session_t *sess = mysqlx_get_session_from_url(
      "mysqlx://user:password@(/path/to/mysql.sock)/schema",
      err_buf, &err_code
    );
    
    mysqlx_opt_type_t *sess_opt = mysqlx_session_option_new();
    mysqlx_session_option_set(sess_opt,
      MYSQLX_OPT_SOCKET, "/path/to/mysql.sock",
      MYSQLX_OPT_USER, "user",
      MYSQLX_OPT_PWD, "password",
      MYSQLX_OPT_DB, "schema");
    
    mysqlx_session_t *sess = mysqlx_get_session_from_options(
      sess_opt, err_buf, &err_code
    );

    (WL #9953)

Functionality Added or Changed

  • These drop API changes were made:

    • Session::dropTable(schema, table) and Session::dropCollection(schema, coll) were replaced by Schema::dropTable(table) and Schema::dropCollection(coll), respectively.

    • Schema::dropView() is now a direct-execute method returning void rather than Executable.

    • All dropXXX() methods succeed if the dropped objects do not exist.

    (WL #10787)

  • The following Collection methods were added: addOrReplaceOne(), getOne(), replaceOne(), and removeOne().

    The addOrReplaceOne() and replaceOne() methods work only with MySQL 8.0.3 and higher servers. For older servers, they report an error. (WL #10981)

Bugs Fixed

  • Creating a TLS session with only the ssl-ca option specified could succeed, although it should fail if ssl-mode is not also specified. (Bug #26226502)

  • mysqlx_get_node_session_from_options() could succeed even when a preceding mysqlx_session_option_set() failed. (Bug #26188740)