Remove HAVE_MYSQL_OPT_TIMEOUTS

Drop MySQL<5.1.12 support
This commit is contained in:
INADA Naoki
2018-12-10 19:08:19 +09:00
parent e48e393e68
commit ae6b108b56

View File

@ -92,12 +92,6 @@ typedef struct {
extern PyTypeObject _mysql_ResultObject_Type; 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 * PyObject *
_mysql_Exception(_mysql_ConnectionObject *c) _mysql_Exception(_mysql_ConnectionObject *c)
{ {
@ -382,16 +376,11 @@ _mysql_ConnectionObject_Initialize(
"read_default_file", "read_default_group", "read_default_file", "read_default_group",
"client_flag", "ssl", "client_flag", "ssl",
"local_infile", "local_infile",
#ifdef HAVE_MYSQL_OPT_TIMEOUTS "read_timeout", "write_timeout",
"read_timeout",
"write_timeout",
#endif
NULL } ; NULL } ;
int connect_timeout = 0; int connect_timeout = 0;
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
int read_timeout = 0; int read_timeout = 0;
int write_timeout = 0; int write_timeout = 0;
#endif
int compress = -1, named_pipe = -1, local_infile = -1; int compress = -1, named_pipe = -1, local_infile = -1;
char *init_command=NULL, char *init_command=NULL,
*read_default_file=NULL, *read_default_file=NULL,
@ -401,11 +390,7 @@ _mysql_ConnectionObject_Initialize(
self->open = 0; self->open = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, if (!PyArg_ParseTupleAndKeywords(args, kwargs,
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
"|ssssisOiiisssiOiii:connect", "|ssssisOiiisssiOiii:connect",
#else
"|ssssisOiiisssiOi:connect",
#endif
kwlist, kwlist,
&host, &user, &passwd, &db, &host, &user, &passwd, &db,
&port, &unix_socket, &conv, &port, &unix_socket, &conv,
@ -414,11 +399,9 @@ _mysql_ConnectionObject_Initialize(
&init_command, &read_default_file, &init_command, &read_default_file,
&read_default_group, &read_default_group,
&client_flag, &ssl, &client_flag, &ssl,
&local_infile &local_infile,
#ifdef HAVE_MYSQL_OPT_TIMEOUTS &read_timeout,
, &read_timeout &write_timeout
, &write_timeout
#endif
)) ))
return -1; return -1;
@ -448,7 +431,6 @@ _mysql_ConnectionObject_Initialize(
mysql_options(&(self->connection), MYSQL_OPT_CONNECT_TIMEOUT, mysql_options(&(self->connection), MYSQL_OPT_CONNECT_TIMEOUT,
(char *)&timeout); (char *)&timeout);
} }
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
if (read_timeout) { if (read_timeout) {
unsigned int timeout = read_timeout; unsigned int timeout = read_timeout;
mysql_options(&(self->connection), MYSQL_OPT_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, mysql_options(&(self->connection), MYSQL_OPT_WRITE_TIMEOUT,
(char *)&timeout); (char *)&timeout);
} }
#endif
if (compress != -1) { if (compress != -1) {
mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0); mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0);
client_flag |= CLIENT_COMPRESS; client_flag |= CLIENT_COMPRESS;