Skip to content

Fix windows build #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions MySQLdb/_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ _mysql_string_literal(
{
PyObject *str, *s;
char *in, *out;
int len, size;
unsigned long len;
Py_ssize_t size;

if (self && PyModule_Check((PyObject*)self))
self = NULL;
Expand Down Expand Up @@ -1986,12 +1987,10 @@ _mysql_ConnectionObject_repr(
{
char buf[300];
if (self->open)
sprintf(buf, "<_mysql.connection open to '%.256s' at %lx>",
self->connection.host,
(long)self);
snprintf(buf, 300, "<_mysql.connection open to '%.256s' at %p>",
self->connection.host, self);
else
sprintf(buf, "<_mysql.connection closed at %lx>",
(long)self);
snprintf(buf, 300, "<_mysql.connection closed at %p>", self);
return PyString_FromString(buf);
}

Expand Down Expand Up @@ -2024,7 +2023,7 @@ _mysql_ResultObject_repr(
_mysql_ResultObject *self)
{
char buf[300];
sprintf(buf, "<_mysql.result object at %lx>", (long)self);
snprintf(buf, 300, "<_mysql.result object at %p>", self);
return PyString_FromString(buf);
}

Expand Down
23 changes: 13 additions & 10 deletions setup_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ def get_config():

extra_objects = []

if enabled(options, 'embedded'):
client = "mysqld"
else:
client = "mysqlclient"
# client = "mysqlclient"
client = "mariadbclient"

vcversion = int(get_build_version())
library_dirs = [ os.path.join(connector, r'lib\vs%d' % vcversion) ]
libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
include_dirs = [ os.path.join(connector, r'include') ]
extra_compile_args = [ '/Zl' ]
if client == "mariadbclient":
library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
libraries = ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client ]
include_dirs = [os.path.join(connector, 'include', 'mariadb')]
else:
library_dirs = [os.path.join(connector, r'lib\vs%d' % vcversion),
os.path.join(connector, "lib")]
libraries = ['kernel32', 'advapi32', 'wsock32', client ]
include_dirs = [os.path.join(connector, r'include')]

extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS' ]
extra_link_args = ['/MANIFEST']

name = "mysqlclient"
if enabled(options, 'embedded'):
name = name + "-embedded"
metadata['name'] = name

define_macros = [
Expand Down