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 {
public:
mysqlx::Session mySession;
mysqlx::Table myTable;

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


};

void main()
{
myClass my;
}

Options: ReplyQuote


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


Sorry, only registered users may post in this forum.

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.