The RWDBConnection::systemHandle() method returns a pointer to a base class from which a family of implementation-specific classes is derived. To use the database API directly, an application can downcast this pointer to the appropriate type, and use its implementation-specific features. Naturally, this usage reduces an application's portability.
In the case of a MySQL connection, the implementation-specific system handle has the data type RWDBMySqlLibSystemHandle. It contains the MYSQL structure used by the RWDBConnection. The following method may be used to retrieve this component:
MYSQL* RWDBMySqlLibSystemHandle::mysql();
If it is necessary for your application to make calls directly to the MySQL API, proceed as in the following example:
#include <mysql.h> #include <rw/db/myssrc/myssysh.h>
RWDBConnection mySqlConnect = myDbase.connection(); RWDBMySqlLibSystemHandle* handle = (RWDBMySqlLibSystemHandle *) mySqlConnect.systemHandle(); MYSQL* mysql = handle->mysql(); // Use mysql for MySQL C API calls.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.