mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-07-27 13:01:19 +00:00
CONPY-189: Windows build fix for Visual Studio 2022
- Build parameters are now written to config_win.h instead of passing them as command line parameters - Fixed several compiler warnings
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <config_win.h>
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
typedef SSIZE_T ssize_t;
|
||||
|
@ -392,10 +392,10 @@ static PyObject *Mrdb_GetTimeDelta(MYSQL_TIME *tm)
|
||||
{
|
||||
int days, hour, minute, second, second_part;
|
||||
|
||||
hour= (tm->neg) ? -tm->hour : tm->hour;
|
||||
minute= (tm->neg) ? -tm->minute : tm->minute;
|
||||
second= (tm->neg) ? -tm->second : tm->second;
|
||||
second_part= (tm->neg) ? -tm->second_part : tm->second_part;
|
||||
hour= (tm->neg) ? -1 * tm->hour : tm->hour;
|
||||
minute= (tm->neg) ? -1 * tm->minute : tm->minute;
|
||||
second= (tm->neg) ? -1 * tm->second : tm->second;
|
||||
second_part= (tm->neg) ? -1 * tm->second_part : tm->second_part;
|
||||
|
||||
days= hour / 24;
|
||||
hour= hour % 24;
|
||||
@ -1432,7 +1432,7 @@ int clock_gettime(int dummy, struct timespec *ct)
|
||||
}
|
||||
|
||||
ct->tv_sec = count.QuadPart / g_counts_per_sec.QuadPart;
|
||||
ct->tv_nsec = ((count.QuadPart % g_counts_per_sec.QuadPart) * 1E09) / g_counts_per_sec.QuadPart;
|
||||
ct->tv_nsec = (long)(((count.QuadPart % g_counts_per_sec.QuadPart) * 1E09) / g_counts_per_sec.QuadPart);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ MrdbConnection_Initialize(MrdbConnection *self,
|
||||
}
|
||||
|
||||
self->thread_id= mysql_thread_id(self->mysql);
|
||||
mariadb_get_infov(self->mysql, MARIADB_CONNECTION_HOST, &self->host);
|
||||
mariadb_get_infov(self->mysql, MARIADB_CONNECTION_HOST, (void *)&self->host);
|
||||
|
||||
has_error= 0;
|
||||
end:
|
||||
@ -465,7 +465,7 @@ MrdbConnection_executecommand(MrdbConnection *self,
|
||||
return NULL;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
rc= mysql_send_query(self->mysql, cmd, strlen(cmd));
|
||||
rc= mysql_send_query(self->mysql, cmd, (long)strlen(cmd));
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
if (rc)
|
||||
|
@ -1102,7 +1102,7 @@ MrdbCursor_execute_text(MrdbCursor *self, PyObject *args)
|
||||
db= self->connection->mysql;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
rc= mysql_send_query(db, statement, statement_len);
|
||||
rc= mysql_send_query(db, statement, (long)statement_len);
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
if (rc)
|
||||
|
@ -61,5 +61,9 @@ def get_config(options):
|
||||
else:
|
||||
print("dynamic")
|
||||
cfg.extra_link_args= ["/NODEFAULTLIB:LIBCMT"]
|
||||
cfg.extra_compile_args=["\"-DDEFAULT_PLUGINS_SUBDIR=\\\"\"" + options["install_dir"].replace(""'\\', '/') + "/lib/plugin\"\\\"\"", "/MD"]
|
||||
cfg.extra_compile_args=["/MD"]
|
||||
|
||||
f= open("./include/config_win.h", "w")
|
||||
f.write("#define DEFAULT_PLUGINS_SUBDIR \"%s\\\\lib\\\\plugin\"" % options["install_dir"].replace(""'\\', '\\\\'))
|
||||
f.close()
|
||||
return cfg
|
||||
|
Reference in New Issue
Block a user