Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae6b108

Browse files
committed
Remove HAVE_MYSQL_OPT_TIMEOUTS
Drop MySQL<5.1.12 support
1 parent e48e393 commit ae6b108

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

MySQLdb/_mysql.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ typedef struct {
9292
extern PyTypeObject _mysql_ResultObject_Type;
9393

9494

95-
/* According to https://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
96-
The MYSQL_OPT_READ_TIMEOUT appear in the version 5.1.12 */
97-
#if MYSQL_VERSION_ID > 50112
98-
#define HAVE_MYSQL_OPT_TIMEOUTS 1
99-
#endif
100-
10195
PyObject *
10296
_mysql_Exception(_mysql_ConnectionObject *c)
10397
{
@@ -382,16 +376,11 @@ _mysql_ConnectionObject_Initialize(
382376
"read_default_file", "read_default_group",
383377
"client_flag", "ssl",
384378
"local_infile",
385-
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
386-
"read_timeout",
387-
"write_timeout",
388-
#endif
379+
"read_timeout", "write_timeout",
389380
NULL } ;
390381
int connect_timeout = 0;
391-
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
392382
int read_timeout = 0;
393383
int write_timeout = 0;
394-
#endif
395384
int compress = -1, named_pipe = -1, local_infile = -1;
396385
char *init_command=NULL,
397386
*read_default_file=NULL,
@@ -401,11 +390,7 @@ _mysql_ConnectionObject_Initialize(
401390
self->open = 0;
402391

403392
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
404-
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
405393
"|ssssisOiiisssiOiii:connect",
406-
#else
407-
"|ssssisOiiisssiOi:connect",
408-
#endif
409394
kwlist,
410395
&host, &user, &passwd, &db,
411396
&port, &unix_socket, &conv,
@@ -414,11 +399,9 @@ _mysql_ConnectionObject_Initialize(
414399
&init_command, &read_default_file,
415400
&read_default_group,
416401
&client_flag, &ssl,
417-
&local_infile
418-
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
419-
, &read_timeout
420-
, &write_timeout
421-
#endif
402+
&local_infile,
403+
&read_timeout,
404+
&write_timeout
422405
))
423406
return -1;
424407

@@ -448,7 +431,6 @@ _mysql_ConnectionObject_Initialize(
448431
mysql_options(&(self->connection), MYSQL_OPT_CONNECT_TIMEOUT,
449432
(char *)&timeout);
450433
}
451-
#ifdef HAVE_MYSQL_OPT_TIMEOUTS
452434
if (read_timeout) {
453435
unsigned int timeout = read_timeout;
454436
mysql_options(&(self->connection), MYSQL_OPT_READ_TIMEOUT,
@@ -459,7 +441,6 @@ _mysql_ConnectionObject_Initialize(
459441
mysql_options(&(self->connection), MYSQL_OPT_WRITE_TIMEOUT,
460442
(char *)&timeout);
461443
}
462-
#endif
463444
if (compress != -1) {
464445
mysql_options(&(self->connection), MYSQL_OPT_COMPRESS, 0);
465446
client_flag |= CLIENT_COMPRESS;

0 commit comments

Comments
 (0)