MySQL Forums
Forum List  »  Connector/C++

Re: C++ OO programming usage
Posted by: Luis Silva
Date: July 25, 2022 05:06AM

Hi David,

DevAPI connector c++ is implemented using the RAII so you have to pass the needed arguments to build session and get the table object.

An example of usage, is having a mysqlx::Client (which pools connections and this way can speed up your application) wich have the server configuration and you pass it (or using a global object) to the class and, this way, you initialize the Session and the table.

Here is a simple example:

mysqlx::Client client("root@localhost:33060");

class myClass {
mysqlx::Session mySession;
mysqlx::Table myTable;

: mySession(client.getSession()),
mySession.getSchema("test").getTable("my_table")) {}


void main()
myClass my;

Options: ReplyQuote

Written By
July 19, 2022 02:56PM
Re: C++ OO programming usage
July 25, 2022 05:06AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.