Skip to content

MySQL: allow access to the underlying connection handle #187

@simon-graham

Description

@simon-graham

It is useful to have direct access to the underlying connection handle for a Poco::Data::Session object, as this allows us to call the native database API directly - either for performance reasons, or to make use of functionality that is not exposed through Poco::Data.

Enabling this for Poco::Data::MySQL requires a simple one line change to the MySQL SessionImpl constructor in the 1.5.x code:

Index: Data/MySQL/src/SessionImpl.cpp
===================================================================
--- Data/MySQL/src/SessionImpl.cpp  (revision 2536)
+++ Data/MySQL/src/SessionImpl.cpp  (working copy)
@@ -78,6 +78,7 @@

    open();
    setConnectionTimeout(CONNECTION_TIMEOUT_DEFAULT);
+   setProperty("handle", static_cast<MYSQL*>(_handle));
 }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions