MySQL Forums
Forum List  »  Connector/C++

C++ OO programming usage
Posted by: David Hale
Date: July 19, 2022 02:56PM

I'm just getting started in programming with MySQL 8/Connector C++. Everything is built and linked and working but I have a question about how to make use of this in a true C++ Object Oriented program.

All of the classes require full configuration on instantiation. That means, for example, that I could NOT do this in my own class definition:

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


where I would instantiate an object of myClass and the configure myClass.mySession, myClass.myTable, and so on.

That seems to say that not only can I not make use of object oriented programming but I also can't make use of functions, because every function that I want to use to access the database I will have to locally instantiate Session and Table objects, so I end up duplicating a lot of code.

What am I missing?

Options: ReplyQuote

Written By
C++ OO programming usage
July 19, 2022 02:56PM
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.