Skip to content

Commit 54c6943

Browse files
tiianmethane
authored andcommitted
Add Connection._get_native_connection
Private API for XTA [1] project. [1]: http://www.tiian.org/lixa/XTA.html
1 parent 68b9662 commit 54c6943

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

_mysql.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,28 @@ _mysql_ConnectionObject_get_character_set_info(
16861686
}
16871687
#endif
16881688

1689+
static char _mysql_ConnectionObject_get_native_connection__doc__[] =
1690+
"Return the internal MYSQL* wrapped in a PyCapsule object.\n\
1691+
NOTE: this is a private API introduced ONLY for XTA integration,\n\
1692+
don't use it for different use cases.\n\
1693+
This method is supported only for XTA integration and support must\n\
1694+
be asked to LIXA project: http://www.tiian.org/lixa/\n\
1695+
Please DO NOT ask support to PyMySQL/mysqlclient-python project.\n\
1696+
";
1697+
1698+
static PyObject *
1699+
_mysql_ConnectionObject_get_native_connection(
1700+
_mysql_ConnectionObject *self,
1701+
PyObject *noargs)
1702+
{
1703+
PyObject *result;
1704+
check_connection(self);
1705+
result = PyCapsule_New(&(self->connection),
1706+
"_mysql.connection.native_connection", NULL);
1707+
return result;
1708+
}
1709+
1710+
16891711
static char _mysql_get_client_info__doc__[] =
16901712
"get_client_info() -- Returns a string that represents\n\
16911713
the client library version.";
@@ -2271,6 +2293,12 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
22712293
_mysql_ConnectionObject_get_character_set_info__doc__
22722294
},
22732295
#endif
2296+
{
2297+
"_get_native_connection",
2298+
(PyCFunction)_mysql_ConnectionObject_get_native_connection,
2299+
METH_NOARGS,
2300+
_mysql_ConnectionObject_get_native_connection__doc__
2301+
},
22742302
{
22752303
"close",
22762304
(PyCFunction)_mysql_ConnectionObject_close,

0 commit comments

Comments
 (0)