1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Fixed CONC-9: removed winsock2 from mysql.h

Fixed CONC-24: reconnect failed
  mysql_reconnect didn't set reconnect flag for new connection
This commit is contained in:
Georg Richter
2013-05-09 14:11:33 +02:00
parent be7b69c4ab
commit f6d4749279
3 changed files with 6 additions and 9 deletions

View File

@@ -21,24 +21,17 @@
#ifndef _mysql_h
#define _mysql_h
#ifndef MYSQL_SERVER
#ifdef __cplusplus
extern "C" {
#endif
#endif
#ifndef _global_h /* If not standard header */
#include <sys/types.h>
#ifdef __LCC__
#include <winsock2.h> /* For windows */
#endif
typedef char my_bool;
#if !defined(_WIN32)
#define STDCALL
#else
#include <WinSock2.h>
#define STDCALL __stdcall
#endif
typedef char * gptr;
@@ -47,8 +40,10 @@ typedef char * gptr;
#ifndef my_socket_defined
#define my_socket_defined
#ifdef _WIN32
#define my_socket SOCKET
#if defined(_WIN64)
#define my_socket unsigned long long
#elif defined(_WIN32)
#define my_socket unsigned int
#else
typedef int my_socket;
#endif

View File

@@ -1879,6 +1879,7 @@ static my_bool mysql_reconnect(MYSQL *mysql)
}
mysql_init(&tmp_mysql);
tmp_mysql.options=mysql->options;
tmp_mysql.reconnect= mysql->reconnect;
bzero((char*) &mysql->options,sizeof(mysql->options));
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,

View File

@@ -527,6 +527,7 @@ static int test_reconnect(MYSQL *mysql)
check_mysql_rc(rc, mysql1);
diag("Thread_id after kill: %d", mysql_thread_id(mysql1));
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
mysql_close(mysql1);
return OK;
}