Skip to content

Commit

Permalink
Added new connection method dump_debug_info()
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed May 21, 2022
1 parent ef57069 commit 4f88242
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/docs/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ PyDoc_STRVAR(
"MariaDB or compatible database server"
);

PyDoc_STRVAR(
connection_dump_debug_info__doc__,
"dump_debug_info()\n"
"--\n"
"\n"
"This function is designed to be executed by an user with the SUPER privilege\n"
"and is used to dump server status information into the log for the MariaDB\n"
"Server relating to the connection."
);

PyDoc_STRVAR(
connection_close__doc__,
"close()\n"
Expand Down
26 changes: 26 additions & 0 deletions mariadb/mariadb_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ MrdbConnection_escape_string(MrdbConnection *self, PyObject *args);
static PyObject *
MrdbConnection_getinfo(MrdbConnection *self, PyObject *args);

static PyObject *
MrdbConnection_dump_debug_info(MrdbConnection *self);

static PyObject *
MrdbConnection_warnings(MrdbConnection *self);

Expand Down Expand Up @@ -134,6 +137,11 @@ MrdbConnection_Methods[] =
METH_VARARGS,
connection_escape_string__doc__
},
{ "dump_debug_info",
(PyCFunction)MrdbConnection_dump_debug_info,
METH_NOARGS,
connection_dump_debug_info__doc__
},
/* Internal methods */
{ "_execute_command",
(PyCFunction)MrdbConnection_executecommand,
Expand Down Expand Up @@ -714,6 +722,24 @@ static PyObject *MrdbConnection_escape_string(MrdbConnection *self,
}
/* }}} */

static PyObject *
MrdbConnection_dump_debug_info(MrdbConnection *self)
{
int rc;
MARIADB_CHECK_CONNECTION(self, NULL);

Py_BEGIN_ALLOW_THREADS;
rc= mysql_dump_debug_info(self->mysql);
Py_END_ALLOW_THREADS;

if (rc)
{
mariadb_throw_exception(self->mysql, NULL, 0, NULL);
return NULL;
}
Py_RETURN_NONE;
}

static PyObject *MrdbConnection_readresponse(MrdbConnection *self)
{
int rc;
Expand Down

0 comments on commit 4f88242

Please sign in to comment.