Skip to content

Commit

Permalink
Support MySQL 8.3 (#690)
Browse files Browse the repository at this point in the history
Fix #688
  • Loading branch information
methane authored Feb 3, 2024
1 parent 9e3b00f commit 720b804
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/MySQLdb/_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,13 @@ _mysql_ConnectionObject_Initialize(
mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);

if (ssl) {
mysql_ssl_set(&(self->connection), key, cert, ca, capath, cipher);
mysql_options(&(self->connection), MYSQL_OPT_SSL_KEY, key);
mysql_options(&(self->connection), MYSQL_OPT_SSL_CERT, cert);
mysql_options(&(self->connection), MYSQL_OPT_SSL_CA, ca);
mysql_options(&(self->connection), MYSQL_OPT_SSL_CAPATH, capath);
mysql_options(&(self->connection), MYSQL_OPT_SSL_CIPHER, cipher);
}

if (ssl_mode) {
#ifdef HAVE_ENUM_MYSQL_OPT_SSL_MODE
mysql_options(&(self->connection), MYSQL_OPT_SSL_MODE, &ssl_mode_num);
Expand Down Expand Up @@ -1789,10 +1794,11 @@ _mysql_ConnectionObject_kill(
{
unsigned long pid;
int r;
char query[50];
if (!PyArg_ParseTuple(args, "k:kill", &pid)) return NULL;
check_connection(self);
Py_BEGIN_ALLOW_THREADS
r = mysql_kill(&(self->connection), pid);
r = mysql_query(&(self->connection), snprintf(query, 50, "KILL %d", pid));
Py_END_ALLOW_THREADS
if (r) return _mysql_Exception(self);
Py_RETURN_NONE;
Expand Down Expand Up @@ -2008,7 +2014,7 @@ _mysql_ConnectionObject_shutdown(
int r;
check_connection(self);
Py_BEGIN_ALLOW_THREADS
r = mysql_shutdown(&(self->connection), SHUTDOWN_DEFAULT);
r = mysql_query(&(self->connection), "SHUTDOWN");
Py_END_ALLOW_THREADS
if (r) return _mysql_Exception(self);
Py_RETURN_NONE;
Expand Down

0 comments on commit 720b804

Please sign in to comment.