@@ -251,7 +251,6 @@ static PyObject *_mysql_server_init(
251
251
& cmd_args , & groups ))
252
252
return NULL ;
253
253
254
- #if MYSQL_VERSION_ID >= 40000
255
254
if (cmd_args ) {
256
255
if (!PySequence_Check (cmd_args )) {
257
256
PyErr_SetString (PyExc_TypeError ,
@@ -318,7 +317,6 @@ static PyObject *_mysql_server_init(
318
317
_mysql_Exception (NULL );
319
318
goto finish ;
320
319
}
321
- #endif
322
320
ret = Py_None ;
323
321
Py_INCREF (Py_None );
324
322
_mysql_server_init_done = 1 ;
@@ -336,9 +334,7 @@ static PyObject *_mysql_server_end(
336
334
PyObject * self ,
337
335
PyObject * args ) {
338
336
if (_mysql_server_init_done ) {
339
- #if MYSQL_VERSION_ID >= 40000
340
337
mysql_server_end ();
341
- #endif
342
338
_mysql_server_init_done = 0 ;
343
339
Py_INCREF (Py_None );
344
340
return Py_None ;
@@ -1063,9 +1059,6 @@ _mysql_escape_string(
1063
1059
str = PyBytes_FromStringAndSize ((char * ) NULL , size * 2 + 1 );
1064
1060
if (!str ) return PyErr_NoMemory ();
1065
1061
out = PyBytes_AS_STRING (str );
1066
- #if MYSQL_VERSION_ID < 32321
1067
- len = mysql_escape_string (out , in , size );
1068
- #else
1069
1062
check_server_init (NULL );
1070
1063
1071
1064
if (self && PyModule_Check ((PyObject * )self ))
@@ -1074,7 +1067,6 @@ _mysql_escape_string(
1074
1067
len = mysql_real_escape_string (& (self -> connection ), out , in , size );
1075
1068
else
1076
1069
len = mysql_escape_string (out , in , size );
1077
- #endif
1078
1070
if (_PyBytes_Resize (& str , len ) < 0 ) return NULL ;
1079
1071
return (str );
1080
1072
}
@@ -1123,15 +1115,12 @@ _mysql_string_literal(
1123
1115
return PyErr_NoMemory ();
1124
1116
}
1125
1117
out = PyBytes_AS_STRING (str );
1126
- #if MYSQL_VERSION_ID < 32321
1127
- len = mysql_escape_string (out + 1 , in , size );
1128
- #else
1129
1118
check_server_init (NULL );
1130
- if (self && self -> open )
1119
+ if (self && self -> open ) {
1131
1120
len = mysql_real_escape_string (& (self -> connection ), out + 1 , in , size );
1132
- else
1121
+ } else {
1133
1122
len = mysql_escape_string (out + 1 , in , size );
1134
- #endif
1123
+ }
1135
1124
* out = * (out + len + 1 ) = '\'' ;
1136
1125
if (_PyBytes_Resize (& str , len + 2 ) < 0 ) return NULL ;
1137
1126
Py_DECREF (s );
@@ -1593,8 +1582,6 @@ _mysql_ResultObject_fetch_row(
1593
1582
return NULL ;
1594
1583
}
1595
1584
1596
- #if MYSQL_VERSION_ID >= 32303
1597
-
1598
1585
static char _mysql_ConnectionObject_change_user__doc__ [] =
1599
1586
"Changes the user and causes the database specified by db to\n\
1600
1587
become the default (current) database on the connection\n\
@@ -1633,7 +1620,6 @@ _mysql_ConnectionObject_change_user(
1633
1620
Py_INCREF (Py_None );
1634
1621
return Py_None ;
1635
1622
}
1636
- #endif
1637
1623
1638
1624
static char _mysql_ConnectionObject_character_set_name__doc__ [] =
1639
1625
"Returns the default character set for the current connection.\n\
@@ -1651,7 +1637,6 @@ _mysql_ConnectionObject_character_set_name(
1651
1637
return PyString_FromString (s );
1652
1638
}
1653
1639
1654
- #if MYSQL_VERSION_ID >= 50007
1655
1640
static char _mysql_ConnectionObject_set_character_set__doc__ [] =
1656
1641
"Sets the default character set for the current connection.\n\
1657
1642
Non-standard.\n\
@@ -1673,7 +1658,6 @@ _mysql_ConnectionObject_set_character_set(
1673
1658
Py_INCREF (Py_None );
1674
1659
return Py_None ;
1675
1660
}
1676
- #endif
1677
1661
1678
1662
#if MYSQL_VERSION_ID >= 50010
1679
1663
static char _mysql_ConnectionObject_get_character_set_info__doc__ [] =
@@ -2039,11 +2023,7 @@ _mysql_ConnectionObject_shutdown(
2039
2023
int r ;
2040
2024
check_connection (self );
2041
2025
Py_BEGIN_ALLOW_THREADS
2042
- r = mysql_shutdown (& (self -> connection )
2043
- #if MYSQL_VERSION_ID >= 40103
2044
- , SHUTDOWN_DEFAULT
2045
- #endif
2046
- );
2026
+ r = mysql_shutdown (& (self -> connection ), SHUTDOWN_DEFAULT );
2047
2027
Py_END_ALLOW_THREADS
2048
2028
if (r ) return _mysql_Exception (self );
2049
2029
Py_INCREF (Py_None );
@@ -2333,14 +2313,12 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
2333
2313
METH_NOARGS ,
2334
2314
_mysql_ConnectionObject_character_set_name__doc__
2335
2315
},
2336
- #if MYSQL_VERSION_ID >= 50007
2337
2316
{
2338
2317
"set_character_set" ,
2339
2318
(PyCFunction )_mysql_ConnectionObject_set_character_set ,
2340
2319
METH_VARARGS ,
2341
2320
_mysql_ConnectionObject_set_character_set__doc__
2342
2321
},
2343
- #endif
2344
2322
#if MYSQL_VERSION_ID >= 50010
2345
2323
{
2346
2324
"get_character_set_info" ,
0 commit comments