I'm using the MySQL Connector/C++ to communicate with a MySQL server from a C++ program. For some reason (see below for the background), I need at some point the native C API connection structure. How do I get it from the Connector/C++ classes?
Background:
I want to load a huge amount of data (up to 2-3 billion tuples) from the client's main memory into the server. Therefore, I want to try the LOAD DATA INFILE statement. To avoid to write the whole data to a text file first, I want to define my own local infile handler, which reads the data directly from the main memory.
However, the Connector/C++ comes with no method to set user-defined local infile handlers, but the native C API does. The corresponding C function mysql_set_local_infile_handler() needs a native connection handler (the structure MYSQL) as input parameter. So how do I get this handler from the Connector/C++? Or is there any better way to set the local infile handler in a Connector/C++ environment?
You want sql::mysql::NativeAPI::MySQL_NativeConnectionWrapper::mysql
, but it is a private member that is not returned by any method. Therefore, to access the structure, you will have to fork the Connector/C++ source and compile your own connector.
If that's the path you take, you might prefer to provide access to mysql_set_local_infile_handler()
from within Connector/C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With