From ae6b108b56fa5f66f5dcd95cd20ffd1a80fa96c1 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Mon, 10 Dec 2018 19:08:19 +0900 Subject: [PATCH] Remove HAVE_MYSQL_OPT_TIMEOUTS Drop MySQL<5.1.12 support --- MySQLdb/_mysql.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index a90d7ab..2d23698 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -92,12 +92,6 @@ typedef struct { extern PyTypeObject _mysql_ResultObject_Type; -/* According to https://dev.mysql.com/doc/refman/5.1/en/mysql-options.html - The MYSQL_OPT_READ_TIMEOUT appear in the version 5.1.12 */ -#if MYSQL_VERSION_ID > 50112 -#define HAVE_MYSQL_OPT_TIMEOUTS 1 -#endif - PyObject * _mysql_Exception(_mysql_ConnectionObject *c) { @@ -382,16 +376,11 @@ _mysql_ConnectionObject_Initialize( "read_default_file", "read_default_group", "client_flag", "ssl", "local_infile", -#ifdef HAVE_MYSQL_OPT_TIMEOUTS - "read_timeout", - "write_timeout", -#endif + "read_timeout", "write_timeout", NULL } ; int connect_timeout = 0; -#ifdef HAVE_MYSQL_OPT_TIMEOUTS int read_timeout = 0; int write_timeout = 0; -#endif int compress = -1, named_pipe = -1, local_infile = -1; char *init_command=NULL, *read_default_file=NULL, @@ -401,11 +390,7 @@ _mysql_ConnectionObject_Initialize( self->open = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, -#ifdef HAVE_MYSQL_OPT_TIMEOUTS "|ssssisOiiisssiOiii:connect", -#else - "|ssssisOiiisssiOi:connect", -#endif kwlist, &host, &user, &passwd, &db, &port, &unix_socket, &conv, @@ -414,11 +399,9 @@ _mysql_ConnectionObject_Initialize( &init_command, &read_default_file, &read_default_group, &client_flag, &ssl, - &local_infile -#ifdef HAVE_MYSQL_OPT_TIMEOUTS - , &read_timeout - , &write_timeout -#endif + &local_infile, + &read_timeout, + &write_timeout )) return -1; @@ -448,7 +431,6 @@ _mysql_ConnectionObject_Initialize( mysql_options(&(self->connection), MYSQL_OPT_CONNECT_TIMEOUT, (char *)&timeout); } -#ifdef HAVE_MYSQL_OPT_TIMEOUTS if (read_timeout) { unsigned int timeout = read_timeout; mysql_options(&(self->connection), MYSQL_OPT_READ_TIMEOUT, @@ -459,7 +441,6 @@ _mysql_ConnectionObject_Initialize( mysql_options(&(self->connection), MYSQL_OPT_WRITE_TIMEOUT, (char *)&timeout); } -#endif if (compress != -1) { mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0); client_flag |= CLIENT_COMPRESS;