Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 05fbc50

Browse filesBrowse files
committed
Always MYSQL_VERSION_ID >= 50007
1 parent 19ad211 commit 05fbc50
Copy full SHA for 05fbc50

File tree

Expand file treeCollapse file tree

1 file changed

+4
-26
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-26
lines changed

‎_mysql.c

Copy file name to clipboardExpand all lines: _mysql.c
+4-26Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ static PyObject *_mysql_server_init(
251251
&cmd_args, &groups))
252252
return NULL;
253253

254-
#if MYSQL_VERSION_ID >= 40000
255254
if (cmd_args) {
256255
if (!PySequence_Check(cmd_args)) {
257256
PyErr_SetString(PyExc_TypeError,
@@ -318,7 +317,6 @@ static PyObject *_mysql_server_init(
318317
_mysql_Exception(NULL);
319318
goto finish;
320319
}
321-
#endif
322320
ret = Py_None;
323321
Py_INCREF(Py_None);
324322
_mysql_server_init_done = 1;
@@ -336,9 +334,7 @@ static PyObject *_mysql_server_end(
336334
PyObject *self,
337335
PyObject *args) {
338336
if (_mysql_server_init_done) {
339-
#if MYSQL_VERSION_ID >= 40000
340337
mysql_server_end();
341-
#endif
342338
_mysql_server_init_done = 0;
343339
Py_INCREF(Py_None);
344340
return Py_None;
@@ -1063,9 +1059,6 @@ _mysql_escape_string(
10631059
str = PyBytes_FromStringAndSize((char *) NULL, size*2+1);
10641060
if (!str) return PyErr_NoMemory();
10651061
out = PyBytes_AS_STRING(str);
1066-
#if MYSQL_VERSION_ID < 32321
1067-
len = mysql_escape_string(out, in, size);
1068-
#else
10691062
check_server_init(NULL);
10701063

10711064
if (self && PyModule_Check((PyObject*)self))
@@ -1074,7 +1067,6 @@ _mysql_escape_string(
10741067
len = mysql_real_escape_string(&(self->connection), out, in, size);
10751068
else
10761069
len = mysql_escape_string(out, in, size);
1077-
#endif
10781070
if (_PyBytes_Resize(&str, len) < 0) return NULL;
10791071
return (str);
10801072
}
@@ -1123,15 +1115,12 @@ _mysql_string_literal(
11231115
return PyErr_NoMemory();
11241116
}
11251117
out = PyBytes_AS_STRING(str);
1126-
#if MYSQL_VERSION_ID < 32321
1127-
len = mysql_escape_string(out+1, in, size);
1128-
#else
11291118
check_server_init(NULL);
1130-
if (self && self->open)
1119+
if (self && self->open) {
11311120
len = mysql_real_escape_string(&(self->connection), out+1, in, size);
1132-
else
1121+
} else {
11331122
len = mysql_escape_string(out+1, in, size);
1134-
#endif
1123+
}
11351124
*out = *(out+len+1) = '\'';
11361125
if (_PyBytes_Resize(&str, len+2) < 0) return NULL;
11371126
Py_DECREF(s);
@@ -1593,8 +1582,6 @@ _mysql_ResultObject_fetch_row(
15931582
return NULL;
15941583
}
15951584

1596-
#if MYSQL_VERSION_ID >= 32303
1597-
15981585
static char _mysql_ConnectionObject_change_user__doc__[] =
15991586
"Changes the user and causes the database specified by db to\n\
16001587
become the default (current) database on the connection\n\
@@ -1633,7 +1620,6 @@ _mysql_ConnectionObject_change_user(
16331620
Py_INCREF(Py_None);
16341621
return Py_None;
16351622
}
1636-
#endif
16371623

16381624
static char _mysql_ConnectionObject_character_set_name__doc__[] =
16391625
"Returns the default character set for the current connection.\n\
@@ -1651,7 +1637,6 @@ _mysql_ConnectionObject_character_set_name(
16511637
return PyString_FromString(s);
16521638
}
16531639

1654-
#if MYSQL_VERSION_ID >= 50007
16551640
static char _mysql_ConnectionObject_set_character_set__doc__[] =
16561641
"Sets the default character set for the current connection.\n\
16571642
Non-standard.\n\
@@ -1673,7 +1658,6 @@ _mysql_ConnectionObject_set_character_set(
16731658
Py_INCREF(Py_None);
16741659
return Py_None;
16751660
}
1676-
#endif
16771661

16781662
#if MYSQL_VERSION_ID >= 50010
16791663
static char _mysql_ConnectionObject_get_character_set_info__doc__[] =
@@ -2039,11 +2023,7 @@ _mysql_ConnectionObject_shutdown(
20392023
int r;
20402024
check_connection(self);
20412025
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);
20472027
Py_END_ALLOW_THREADS
20482028
if (r) return _mysql_Exception(self);
20492029
Py_INCREF(Py_None);
@@ -2333,14 +2313,12 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
23332313
METH_NOARGS,
23342314
_mysql_ConnectionObject_character_set_name__doc__
23352315
},
2336-
#if MYSQL_VERSION_ID >= 50007
23372316
{
23382317
"set_character_set",
23392318
(PyCFunction)_mysql_ConnectionObject_set_character_set,
23402319
METH_VARARGS,
23412320
_mysql_ConnectionObject_set_character_set__doc__
23422321
},
2343-
#endif
23442322
#if MYSQL_VERSION_ID >= 50010
23452323
{
23462324
"get_character_set_info",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.