Fix windows build (#322)

This commit is contained in:
Inada Naoki
2019-01-18 20:52:10 +09:00
committed by GitHub
parent 0d1b6b6dc9
commit 3870135037
2 changed files with 19 additions and 17 deletions

View File

@ -917,7 +917,8 @@ _mysql_string_literal(
{ {
PyObject *str, *s; PyObject *str, *s;
char *in, *out; char *in, *out;
int len, size; unsigned long len;
Py_ssize_t size;
if (self && PyModule_Check((PyObject*)self)) if (self && PyModule_Check((PyObject*)self))
self = NULL; self = NULL;
@ -1986,12 +1987,10 @@ _mysql_ConnectionObject_repr(
{ {
char buf[300]; char buf[300];
if (self->open) if (self->open)
sprintf(buf, "<_mysql.connection open to '%.256s' at %lx>", snprintf(buf, 300, "<_mysql.connection open to '%.256s' at %p>",
self->connection.host, self->connection.host, self);
(long)self);
else else
sprintf(buf, "<_mysql.connection closed at %lx>", snprintf(buf, 300, "<_mysql.connection closed at %p>", self);
(long)self);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
@ -2024,7 +2023,7 @@ _mysql_ResultObject_repr(
_mysql_ResultObject *self) _mysql_ResultObject *self)
{ {
char buf[300]; 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); return PyString_FromString(buf);
} }

View File

@ -11,21 +11,24 @@ def get_config():
extra_objects = [] extra_objects = []
if enabled(options, 'embedded'): # client = "mysqlclient"
client = "mysqld" client = "mariadbclient"
else:
client = "mysqlclient"
vcversion = int(get_build_version()) vcversion = int(get_build_version())
library_dirs = [ os.path.join(connector, r'lib\vs%d' % vcversion) ] if client == "mariadbclient":
libraries = [ 'kernel32', 'advapi32', 'wsock32', client ] library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
include_dirs = [ os.path.join(connector, r'include') ] libraries = ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client ]
extra_compile_args = [ '/Zl' ] 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'] extra_link_args = ['/MANIFEST']
name = "mysqlclient" name = "mysqlclient"
if enabled(options, 'embedded'):
name = name + "-embedded"
metadata['name'] = name metadata['name'] = name
define_macros = [ define_macros = [