From 641b71081285479c59a94f1ebd6d9fe28360029a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 1 May 2023 21:33:25 +0200 Subject: [PATCH] cext: Support compression Fixes: Bug #110879: Compression doesn't work with C extension API https://bugs.mysql.com/bug.php?id=110879 --- src/mysql_capi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mysql_capi.c b/src/mysql_capi.c index e7596815..1394fd95 100644 --- a/src/mysql_capi.c +++ b/src/mysql_capi.c @@ -1202,6 +1202,10 @@ MySQL_connect(MySQL *self, PyObject *args, PyObject *kwds) mysql_options(&self->session, MYSQL_OPT_LOCAL_INFILE, &denied); } + if (compress != NULL && (PyBool_Check(compress) && compress == Py_True)) { + client_flags = client_flags ^ CLIENT_COMPRESS; + } + if (client_flags & CLIENT_LOCAL_FILES && (local_infile != 1)) { client_flags = client_flags & ~CLIENT_LOCAL_FILES; }