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 3870135

Browse filesBrowse files
authored
Fix windows build (PyMySQL#322)
1 parent 0d1b6b6 commit 3870135
Copy full SHA for 3870135

File tree

Expand file treeCollapse file tree

2 files changed

+19
-17
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-17
lines changed

‎MySQLdb/_mysql.c

Copy file name to clipboardExpand all lines: MySQLdb/_mysql.c
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,8 @@ _mysql_string_literal(
917917
{
918918
PyObject *str, *s;
919919
char *in, *out;
920-
int len, size;
920+
unsigned long len;
921+
Py_ssize_t size;
921922

922923
if (self && PyModule_Check((PyObject*)self))
923924
self = NULL;
@@ -1986,12 +1987,10 @@ _mysql_ConnectionObject_repr(
19861987
{
19871988
char buf[300];
19881989
if (self->open)
1989-
sprintf(buf, "<_mysql.connection open to '%.256s' at %lx>",
1990-
self->connection.host,
1991-
(long)self);
1990+
snprintf(buf, 300, "<_mysql.connection open to '%.256s' at %p>",
1991+
self->connection.host, self);
19921992
else
1993-
sprintf(buf, "<_mysql.connection closed at %lx>",
1994-
(long)self);
1993+
snprintf(buf, 300, "<_mysql.connection closed at %p>", self);
19951994
return PyString_FromString(buf);
19961995
}
19971996

@@ -2024,7 +2023,7 @@ _mysql_ResultObject_repr(
20242023
_mysql_ResultObject *self)
20252024
{
20262025
char buf[300];
2027-
sprintf(buf, "<_mysql.result object at %lx>", (long)self);
2026+
snprintf(buf, 300, "<_mysql.result object at %p>", self);
20282027
return PyString_FromString(buf);
20292028
}
20302029

‎setup_windows.py

Copy file name to clipboardExpand all lines: setup_windows.py
+13-10Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,24 @@ def get_config():
1111

1212
extra_objects = []
1313

14-
if enabled(options, 'embedded'):
15-
client = "mysqld"
16-
else:
17-
client = "mysqlclient"
14+
# client = "mysqlclient"
15+
client = "mariadbclient"
1816

1917
vcversion = int(get_build_version())
20-
library_dirs = [ os.path.join(connector, r'lib\vs%d' % vcversion) ]
21-
libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
22-
include_dirs = [ os.path.join(connector, r'include') ]
23-
extra_compile_args = [ '/Zl' ]
18+
if client == "mariadbclient":
19+
library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
20+
libraries = ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client ]
21+
include_dirs = [os.path.join(connector, 'include', 'mariadb')]
22+
else:
23+
library_dirs = [os.path.join(connector, r'lib\vs%d' % vcversion),
24+
os.path.join(connector, "lib")]
25+
libraries = ['kernel32', 'advapi32', 'wsock32', client ]
26+
include_dirs = [os.path.join(connector, r'include')]
27+
28+
extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS' ]
2429
extra_link_args = ['/MANIFEST']
2530

2631
name = "mysqlclient"
27-
if enabled(options, 'embedded'):
28-
name = name + "-embedded"
2932
metadata['name'] = name
3033

3134
define_macros = [

0 commit comments

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