You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
C preprocessor defines fix
This commit is contained in:
@@ -109,8 +109,8 @@ struct st_mariadb_extension {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define OPT_EXT_VAL(a,key) \
|
#define OPT_EXT_VAL(a,key) \
|
||||||
((a)->options.extension && (a)->options.extension->key) ?\
|
(((a)->options.extension && (a)->options.extension->key) ?\
|
||||||
(a)->options.extension->key : 0
|
(a)->options.extension->key : 0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -250,7 +250,7 @@ double my_ulonglong2double(unsigned long long A);
|
|||||||
|
|
||||||
|
|
||||||
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
|
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
|
||||||
#define LINT_INIT(var) var=0 /* No uninitialize-warning */
|
#define LINT_INIT(var) do{var=0;}while(0) /* No uninitialize-warning */
|
||||||
#define LINT_INIT_STRUCT(var) memset(&var, 0, sizeof(var)) /* No uninitialize-warning */
|
#define LINT_INIT_STRUCT(var) memset(&var, 0, sizeof(var)) /* No uninitialize-warning */
|
||||||
#else
|
#else
|
||||||
#define LINT_INIT(var)
|
#define LINT_INIT(var)
|
||||||
@@ -272,10 +272,10 @@ typedef unsigned short ushort;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
|
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
|
||||||
#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
|
#define swap(t,a,b) do{register t dummy; dummy = a; a = b; b = dummy;}while(0)
|
||||||
#define test(a) ((a) ? 1 : 0)
|
#define test(a) ((a) ? 1 : 0)
|
||||||
#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
|
#define set_if_bigger(a,b) do{ if ((a) < (b)) (a)=(b); }while(0)
|
||||||
#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
|
#define set_if_smaller(a,b) do{ if ((a) > (b)) (a)=(b); }while(0)
|
||||||
#define test_all_bits(a,b) (((a) & (b)) == (b))
|
#define test_all_bits(a,b) (((a) & (b)) == (b))
|
||||||
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
|
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
|
||||||
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
|
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
|
||||||
@@ -440,11 +440,11 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||||||
*/
|
*/
|
||||||
#define MALLOC_OVERHEAD 8
|
#define MALLOC_OVERHEAD 8
|
||||||
/* get memory in huncs */
|
/* get memory in huncs */
|
||||||
#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD)
|
#define ONCE_ALLOC_INIT ((uint) (4096-MALLOC_OVERHEAD))
|
||||||
/* Typical record cash */
|
/* Typical record cash */
|
||||||
#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD)
|
#define RECORD_CACHE_SIZE ((uint) (64*1024-MALLOC_OVERHEAD))
|
||||||
/* Typical key cash */
|
/* Typical key cash */
|
||||||
#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD)
|
#define KEY_CACHE_SIZE ((uint) (8*1024*1024-MALLOC_OVERHEAD))
|
||||||
|
|
||||||
/* Some things that this system doesn't have */
|
/* Some things that this system doesn't have */
|
||||||
|
|
||||||
@@ -815,7 +815,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
|||||||
*((T)+3)=(uchar) (((A) >> 24)); \
|
*((T)+3)=(uchar) (((A) >> 24)); \
|
||||||
*((T)+4)=(uchar) (((A) >> 32)); \
|
*((T)+4)=(uchar) (((A) >> 32)); \
|
||||||
*((T)+5)=(uchar) (((A) >> 40)); } while(0)
|
*((T)+5)=(uchar) (((A) >> 40)); } while(0)
|
||||||
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
|
#define int8store(T,A) do {*((ulonglong *) (T))= (ulonglong) (A);} while(0)
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
double v;
|
double v;
|
||||||
@@ -1046,11 +1046,11 @@ do { doubleget_union _tmp; \
|
|||||||
#endif /* WORDS_BIGENDIAN */
|
#endif /* WORDS_BIGENDIAN */
|
||||||
|
|
||||||
#ifndef THREAD
|
#ifndef THREAD
|
||||||
#define thread_safe_increment(V,L) (V)++
|
#define thread_safe_increment(V,L) ((V)++)
|
||||||
#define thread_safe_add(V,C,L) (V)+=(C)
|
#define thread_safe_add(V,C,L) ((V)+=(C))
|
||||||
#define thread_safe_sub(V,C,L) (V)-=(C)
|
#define thread_safe_sub(V,C,L) ((V)-=(C))
|
||||||
#define statistic_increment(V,L) (V)++
|
#define statistic_increment(V,L) ((V)++)
|
||||||
#define statistic_add(V,C,L) (V)+=(C)
|
#define statistic_add(V,C,L) ((V)+=(C))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -1069,9 +1069,9 @@ do { doubleget_union _tmp; \
|
|||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef HAVE_DLOPEN
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define dlsym(lib, name) GetProcAddress((HMODULE)lib, name)
|
#define dlsym(lib, name) GetProcAddress((HMODULE)(lib), name)
|
||||||
#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
|
#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
|
||||||
#define dlclose(lib) FreeLibrary((HMODULE)lib)
|
#define dlclose(lib) FreeLibrary((HMODULE)(lib))
|
||||||
#elif defined(HAVE_DLFCN_H)
|
#elif defined(HAVE_DLFCN_H)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -39,7 +39,7 @@ extern int list_walk(LIST *list,list_walk_action action,char * argument);
|
|||||||
|
|
||||||
#define list_rest(a) ((a)->next)
|
#define list_rest(a) ((a)->next)
|
||||||
#define list_push(a,b) (a)=list_cons((b),(a))
|
#define list_push(a,b) (a)=list_cons((b),(a))
|
||||||
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((char *) old,MYF(MY_FAE)); }
|
#define list_pop(A) do {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((char *) old,MYF(MY_FAE)); } while(0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,21 @@ typedef struct my_aio_result {
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define MYSYS_PROGRAM_USES_CURSES() { ma_error_handler_hook = ma_message_curses; mysys_uses_curses=1; }
|
#define MYSYS_PROGRAM_USES_CURSES() \
|
||||||
#define MYSYS_PROGRAM_DONT_USE_CURSES() { ma_error_handler_hook = ma_message_no_curses; mysys_uses_curses=0;}
|
do {\
|
||||||
#define MY_INIT(name); { ma_progname= name; ma_init(); }
|
ma_error_handler_hook = ma_message_curses;\
|
||||||
|
mysys_uses_curses=1;\
|
||||||
|
} while(0)
|
||||||
|
#define MYSYS_PROGRAM_DONT_USE_CURSES() \
|
||||||
|
do {\
|
||||||
|
ma_error_handler_hook = ma_message_no_curses; \
|
||||||
|
mysys_uses_curses=0; \
|
||||||
|
} while(0)
|
||||||
|
#define MY_INIT(name) \
|
||||||
|
do {\
|
||||||
|
ma_progname= name;\
|
||||||
|
ma_init();\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define MAXMAPS (4) /* Number of error message maps */
|
#define MAXMAPS (4) /* Number of error message maps */
|
||||||
#define ERRMOD (1000) /* Max number of errors in a map */
|
#define ERRMOD (1000) /* Max number of errors in a map */
|
||||||
@@ -285,15 +297,15 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||||||
/* defines for mf_iocache */
|
/* defines for mf_iocache */
|
||||||
|
|
||||||
/* Test if buffer is inited */
|
/* Test if buffer is inited */
|
||||||
#define my_b_clear(info) (info)->buffer=0
|
#define my_b_clear(info) do{(info)->buffer= 0;} while (0)
|
||||||
#define my_b_inited(info) (info)->buffer
|
#define my_b_inited(info) ((info)->buffer)
|
||||||
#define my_b_EOF INT_MIN
|
#define my_b_EOF INT_MIN
|
||||||
|
|
||||||
#define my_b_read(info,Buffer,Count) \
|
#define my_b_read(info,Buffer,Count) \
|
||||||
((info)->rc_pos + (Count) <= (info)->rc_end ?\
|
((info)->rc_pos + (Count) <= (info)->rc_end ?\
|
||||||
(memcpy(Buffer,(info)->rc_pos,(size_t) (Count)), \
|
(memcpy((Buffer),(info)->rc_pos,(size_t) (Count)), \
|
||||||
((info)->rc_pos+=(Count)),0) :\
|
((info)->rc_pos+=(Count)),0) :\
|
||||||
(*(info)->read_function)((info),Buffer,Count))
|
(*(info)->read_function)((info),(Buffer),(Count)))
|
||||||
|
|
||||||
#define my_b_get(info) \
|
#define my_b_get(info) \
|
||||||
((info)->rc_pos != (info)->rc_end ?\
|
((info)->rc_pos != (info)->rc_end ?\
|
||||||
@@ -302,18 +314,18 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||||||
|
|
||||||
#define my_b_write(info,Buffer,Count) \
|
#define my_b_write(info,Buffer,Count) \
|
||||||
((info)->rc_pos + (Count) <= (info)->rc_end ?\
|
((info)->rc_pos + (Count) <= (info)->rc_end ?\
|
||||||
(memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \
|
(memcpy((info)->rc_pos,(Buffer),(size_t) (Count)), \
|
||||||
((info)->rc_pos+=(Count)),0) :\
|
((info)->rc_pos+=(Count)),0) :\
|
||||||
_my_b_write(info,Buffer,Count))
|
_my_b_write((info),(Buffer),(Count)))
|
||||||
|
|
||||||
/* my_b_write_byte doesn't have any err-check */
|
/* my_b_write_byte doesn't have any err-check */
|
||||||
#define my_b_write_byte(info,chr) \
|
#define my_b_write_byte(info,chr) \
|
||||||
(((info)->rc_pos < (info)->rc_end) ?\
|
(((info)->rc_pos < (info)->rc_end) ?\
|
||||||
((*(info)->rc_pos++)=(chr)) :\
|
((*(info)->rc_pos++)=(chr)) :\
|
||||||
(_my_b_write(info,0,0) , ((*(info)->rc_pos++)=(chr))))
|
(_my_b_write((info),0,0) , ((*(info)->rc_pos++)=(chr))))
|
||||||
|
|
||||||
#define my_b_fill_cache(info) \
|
#define my_b_fill_cache(info) \
|
||||||
(((info)->rc_end=(info)->rc_pos),(*(info)->read_function)(info,0,0))
|
(((info)->rc_end=(info)->rc_pos),(*(info)->read_function)((info),0,0))
|
||||||
|
|
||||||
#define my_b_tell(info) ((info)->pos_in_file + \
|
#define my_b_tell(info) ((info)->pos_in_file + \
|
||||||
((info)->rc_pos - (info)->rc_request_pos))
|
((info)->rc_pos - (info)->rc_request_pos))
|
||||||
@@ -401,7 +413,7 @@ extern void casedn_str(my_string str);
|
|||||||
extern void case_sort(my_string str,uint length);
|
extern void case_sort(my_string str,uint length);
|
||||||
extern uint ma_dirname_part(my_string to,const char *name);
|
extern uint ma_dirname_part(my_string to,const char *name);
|
||||||
extern uint ma_dirname_length(const char *name);
|
extern uint ma_dirname_length(const char *name);
|
||||||
#define base_name(A) (A+dirname_length(A))
|
#define base_name(A) ((A)+dirname_length(A))
|
||||||
extern int test_if_hard_path(const char *dir_name);
|
extern int test_if_hard_path(const char *dir_name);
|
||||||
extern char *ma_convert_dirname(my_string name);
|
extern char *ma_convert_dirname(my_string name);
|
||||||
extern void to_unix_path(my_string name);
|
extern void to_unix_path(my_string name);
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
#define HOSTNAME_LENGTH 60
|
#define HOSTNAME_LENGTH 60
|
||||||
#define SYSTEM_MB_MAX_CHAR_LENGTH 4
|
#define SYSTEM_MB_MAX_CHAR_LENGTH 4
|
||||||
#define USERNAME_CHAR_LENGTH 128
|
#define USERNAME_CHAR_LENGTH 128
|
||||||
#define USERNAME_LENGTH USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH
|
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH)
|
||||||
#define SERVER_VERSION_LENGTH 60
|
#define SERVER_VERSION_LENGTH 60
|
||||||
#define SQLSTATE_LENGTH 5
|
#define SQLSTATE_LENGTH 5
|
||||||
#define SCRAMBLE_LENGTH 20
|
#define SCRAMBLE_LENGTH 20
|
||||||
@@ -174,7 +174,7 @@ enum enum_server_command
|
|||||||
#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35)
|
#define MARIADB_CLIENT_EXTENDED_METADATA (1ULL << 35)
|
||||||
|
|
||||||
#define IS_MARIADB_EXTENDED_SERVER(mysql)\
|
#define IS_MARIADB_EXTENDED_SERVER(mysql)\
|
||||||
!(mysql->server_capabilities & CLIENT_MYSQL)
|
(!(mysql->server_capabilities & CLIENT_MYSQL))
|
||||||
|
|
||||||
#define MARIADB_CLIENT_SUPPORTED_FLAGS (MARIADB_CLIENT_PROGRESS |\
|
#define MARIADB_CLIENT_SUPPORTED_FLAGS (MARIADB_CLIENT_PROGRESS |\
|
||||||
MARIADB_CLIENT_COM_MULTI |\
|
MARIADB_CLIENT_COM_MULTI |\
|
||||||
@@ -239,7 +239,7 @@ enum enum_server_command
|
|||||||
#define MYSQL_ERRMSG_SIZE 512
|
#define MYSQL_ERRMSG_SIZE 512
|
||||||
#define NET_READ_TIMEOUT 30 /* Timeout on read */
|
#define NET_READ_TIMEOUT 30 /* Timeout on read */
|
||||||
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
|
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
|
||||||
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
|
#define NET_WAIT_TIMEOUT (8*60*60) /* Wait for new query */
|
||||||
|
|
||||||
/* for server integration (mysqlbinlog) */
|
/* for server integration (mysqlbinlog) */
|
||||||
#define LIST_PROCESS_HOST_LEN 64
|
#define LIST_PROCESS_HOST_LEN 64
|
||||||
@@ -316,7 +316,7 @@ enum enum_session_state_type
|
|||||||
|
|
||||||
#define SESSION_TRACK_BEGIN 0
|
#define SESSION_TRACK_BEGIN 0
|
||||||
#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_TYPE
|
#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_TYPE
|
||||||
#define SESSION_TRACK_TYPES SESSION_TRACK_END + 1
|
#define SESSION_TRACK_TYPES (SESSION_TRACK_END + 1)
|
||||||
|
|
||||||
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
|
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
|
||||||
MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
|
MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
|
||||||
|
@@ -242,7 +242,10 @@ int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1,
|
|||||||
enum enum_dyncol_func_result
|
enum enum_dyncol_func_result
|
||||||
mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count);
|
mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count);
|
||||||
|
|
||||||
#define mariadb_dyncol_value_init(V) (V)->type= DYN_COL_NULL
|
#define mariadb_dyncol_value_init(V) \
|
||||||
|
do {\
|
||||||
|
(V)->type= DYN_COL_NULL;\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prepare value for using as decimal
|
Prepare value for using as decimal
|
||||||
|
@@ -35,20 +35,20 @@
|
|||||||
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32))))
|
(MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32))))
|
||||||
|
|
||||||
#define SET_CLIENT_STMT_ERROR(a, b, c, d) \
|
#define SET_CLIENT_STMT_ERROR(a, b, c, d) \
|
||||||
{ \
|
do { \
|
||||||
(a)->last_errno= (b);\
|
(a)->last_errno= (b);\
|
||||||
strncpy((a)->sqlstate, (c), SQLSTATE_LENGTH);\
|
strncpy((a)->sqlstate, (c), SQLSTATE_LENGTH);\
|
||||||
(a)->sqlstate[SQLSTATE_LENGTH]= 0;\
|
(a)->sqlstate[SQLSTATE_LENGTH]= 0;\
|
||||||
strncpy((a)->last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE);\
|
strncpy((a)->last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE);\
|
||||||
(a)->last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\
|
(a)->last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define CLEAR_CLIENT_STMT_ERROR(a) \
|
#define CLEAR_CLIENT_STMT_ERROR(a) \
|
||||||
{ \
|
do { \
|
||||||
(a)->last_errno= 0;\
|
(a)->last_errno= 0;\
|
||||||
strcpy((a)->sqlstate, "00000");\
|
strcpy((a)->sqlstate, "00000");\
|
||||||
(a)->last_error[0]= 0;\
|
(a)->last_error[0]= 0;\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define MYSQL_PS_SKIP_RESULT_W_LEN -1
|
#define MYSQL_PS_SKIP_RESULT_W_LEN -1
|
||||||
#define MYSQL_PS_SKIP_RESULT_STR -2
|
#define MYSQL_PS_SKIP_RESULT_STR -2
|
||||||
|
@@ -130,13 +130,13 @@ extern unsigned int mariadb_deinitialize_ssl;
|
|||||||
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
|
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
|
||||||
|
|
||||||
#define SET_CLIENT_ERROR(a, b, c, d) \
|
#define SET_CLIENT_ERROR(a, b, c, d) \
|
||||||
{ \
|
do { \
|
||||||
(a)->net.last_errno= (b);\
|
(a)->net.last_errno= (b);\
|
||||||
strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\
|
strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\
|
||||||
(a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\
|
(a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\
|
||||||
strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\
|
strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\
|
||||||
(a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\
|
(a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\
|
||||||
}
|
} while(0)
|
||||||
|
|
||||||
/* For mysql_async.c */
|
/* For mysql_async.c */
|
||||||
#define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0)
|
#define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0)
|
||||||
@@ -144,12 +144,12 @@ extern const char *SQLSTATE_UNKNOWN;
|
|||||||
#define unknown_sqlstate SQLSTATE_UNKNOWN
|
#define unknown_sqlstate SQLSTATE_UNKNOWN
|
||||||
|
|
||||||
#define CLEAR_CLIENT_ERROR(a) \
|
#define CLEAR_CLIENT_ERROR(a) \
|
||||||
{ \
|
do { \
|
||||||
(a)->net.last_errno= 0;\
|
(a)->net.last_errno= 0;\
|
||||||
strcpy((a)->net.sqlstate, "00000");\
|
strcpy((a)->net.sqlstate, "00000");\
|
||||||
(a)->net.last_error[0]= '\0';\
|
(a)->net.last_error[0]= '\0';\
|
||||||
(a)->net.extension->extended_errno= 0;\
|
(a)->net.extension->extended_errno= 0;\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define MYSQL_COUNT_ERROR (~(unsigned long long) 0)
|
#define MYSQL_COUNT_ERROR (~(unsigned long long) 0)
|
||||||
|
|
||||||
|
@@ -514,14 +514,14 @@ typedef union { double d; ULong L[2]; } U;
|
|||||||
|
|
||||||
#if defined(HAVE_BIGENDIAN) || defined(WORDS_BIGENDIAN) || \
|
#if defined(HAVE_BIGENDIAN) || defined(WORDS_BIGENDIAN) || \
|
||||||
(defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN))
|
(defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN))
|
||||||
#define word0(x) (x)->L[0]
|
#define word0(x) ((x)->L[0])
|
||||||
#define word1(x) (x)->L[1]
|
#define word1(x) ((x)->L[1])
|
||||||
#else
|
#else
|
||||||
#define word0(x) (x)->L[1]
|
#define word0(x) ((x)->L[1])
|
||||||
#define word1(x) (x)->L[0]
|
#define word1(x) ((x)->L[0])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define dval(x) (x)->d
|
#define dval(x) ((x)->d)
|
||||||
|
|
||||||
/* #define P DBL_MANT_DIG */
|
/* #define P DBL_MANT_DIG */
|
||||||
/* Ten_pmax= floor(P*log(2)/log(5)) */
|
/* Ten_pmax= floor(P*log(2)/log(5)) */
|
||||||
@@ -568,8 +568,8 @@ typedef union { double d; ULong L[2]; } U;
|
|||||||
#define Rounding Flt_Rounds
|
#define Rounding Flt_Rounds
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define rounded_product(a,b) a*= b
|
#define rounded_product(a,b) ((a)*= (b))
|
||||||
#define rounded_quotient(a,b) a/= b
|
#define rounded_quotient(a,b) ((a)/= (b))
|
||||||
|
|
||||||
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
|
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
|
||||||
#define Big1 0xffffffff
|
#define Big1 0xffffffff
|
||||||
@@ -579,8 +579,8 @@ typedef union { double d; ULong L[2]; } U;
|
|||||||
|
|
||||||
#define Kmax 15
|
#define Kmax 15
|
||||||
|
|
||||||
#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
|
#define Bcopy(x,y) memcpy((char *)&(x)->sign, (char *)&(y)->sign, \
|
||||||
2*sizeof(int) + y->wds*sizeof(ULong))
|
2*sizeof(int) + (y)->wds*sizeof(ULong))
|
||||||
|
|
||||||
/* Arbitrary-length integer */
|
/* Arbitrary-length integer */
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@
|
|||||||
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
|
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_DBL_STR 3 + DBL_MANT_DIG - DBL_MIN_EXP
|
#define MAX_DBL_STR (3 + DBL_MANT_DIG - DBL_MIN_EXP)
|
||||||
|
|
||||||
#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)
|
#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)
|
||||||
/* First check for ANSI C99 definition: */
|
/* First check for ANSI C99 definition: */
|
||||||
|
@@ -40,10 +40,10 @@
|
|||||||
Windows does not support MSG_DONTWAIT for send()/recv(). So we need to ensure
|
Windows does not support MSG_DONTWAIT for send()/recv(). So we need to ensure
|
||||||
that the socket is non-blocking at the start of every operation.
|
that the socket is non-blocking at the start of every operation.
|
||||||
*/
|
*/
|
||||||
#define WIN_SET_NONBLOCKING(mysql) { \
|
#define WIN_SET_NONBLOCKING(mysql) do { \
|
||||||
my_bool old_mode; \
|
my_bool old_mode; \
|
||||||
if ((mysql)->net.pvio) ma_pvio_blocking((mysql)->net.pvio, FALSE, &old_mode); \
|
if ((mysql)->net.pvio) ma_pvio_blocking((mysql)->net.pvio, FALSE, &old_mode); \
|
||||||
}
|
} while(0)
|
||||||
#else
|
#else
|
||||||
#define WIN_SET_NONBLOCKING(mysql)
|
#define WIN_SET_NONBLOCKING(mysql)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
#define UPDATE_STMT_ERROR(stmt)\
|
#define UPDATE_STMT_ERROR(stmt)\
|
||||||
SET_CLIENT_STMT_ERROR((stmt), (stmt)->mysql->net.last_errno, (stmt)->mysql->net.sqlstate, (stmt)->mysql->net.last_error)
|
SET_CLIENT_STMT_ERROR((stmt), (stmt)->mysql->net.last_errno, (stmt)->mysql->net.sqlstate, (stmt)->mysql->net.last_error)
|
||||||
|
|
||||||
#define STMT_NUM_OFS(type, a,r) ((type *)(a))[r]
|
#define STMT_NUM_OFS(type, a, r) (((type *)(a))[r])
|
||||||
#define MADB_RESET_ERROR 1
|
#define MADB_RESET_ERROR 1
|
||||||
#define MADB_RESET_LONGDATA 2
|
#define MADB_RESET_LONGDATA 2
|
||||||
#define MADB_RESET_SERVER 4
|
#define MADB_RESET_SERVER 4
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#define SC_IO_BUFFER_SIZE 0x4000
|
#define SC_IO_BUFFER_SIZE 0x4000
|
||||||
#define MAX_SSL_ERR_LEN 100
|
#define MAX_SSL_ERR_LEN 100
|
||||||
|
|
||||||
#define SCHANNEL_PAYLOAD(A) (A).cbMaximumMessage + (A).cbHeader + (A).cbTrailer
|
#define SCHANNEL_PAYLOAD(A) ((A).cbMaximumMessage + (A).cbHeader + (A).cbTrailer)
|
||||||
void ma_schannel_set_win_error(MARIADB_PVIO *pvio, DWORD ErrorNo);
|
void ma_schannel_set_win_error(MARIADB_PVIO *pvio, DWORD ErrorNo);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,5 +34,5 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define SSPI_MAX_TOKEN_SIZE 50000
|
#define SSPI_MAX_TOKEN_SIZE 50000
|
||||||
#define SEC_ERROR(err) (err < 0)
|
#define SEC_ERROR(err) ((err) < 0)
|
||||||
extern void sspi_errmsg(int err, char *buf, size_t size);
|
extern void sspi_errmsg(int err, char *buf, size_t size);
|
||||||
|
@@ -85,16 +85,16 @@ typedef struct st_conn_repl {
|
|||||||
} REPL_DATA;
|
} REPL_DATA;
|
||||||
|
|
||||||
#define SET_SLAVE(mysql, data)\
|
#define SET_SLAVE(mysql, data)\
|
||||||
{\
|
do {\
|
||||||
mysql->net.pvio= data->pvio[MARIADB_SLAVE]; \
|
mysql->net.pvio= data->pvio[MARIADB_SLAVE]; \
|
||||||
data->current_type= MARIADB_SLAVE;\
|
data->current_type= MARIADB_SLAVE;\
|
||||||
}
|
} while(0)
|
||||||
|
|
||||||
#define SET_MASTER(mysql, data)\
|
#define SET_MASTER(mysql, data)\
|
||||||
{\
|
do {\
|
||||||
mysql->net.pvio= data->pvio[MARIADB_MASTER];\
|
mysql->net.pvio= data->pvio[MARIADB_MASTER];\
|
||||||
data->current_type= MARIADB_MASTER;\
|
data->current_type= MARIADB_MASTER;\
|
||||||
}
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
/* parse url
|
/* parse url
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ma_string.h>
|
#include <ma_string.h>
|
||||||
|
|
||||||
#define PVIO_SHM_BUFFER_SIZE 16000 + 4
|
#define PVIO_SHM_BUFFER_SIZE (16000 + 4)
|
||||||
|
|
||||||
my_bool pvio_shm_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
|
my_bool pvio_shm_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout);
|
||||||
int pvio_shm_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
|
int pvio_shm_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type);
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#define IS_SOCKET_EINTR(err) (err == SOCKET_EINTR)
|
#define IS_SOCKET_EINTR(err) ((err) == SOCKET_EINTR)
|
||||||
#else
|
#else
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#define O_NONBLOCK 1
|
#define O_NONBLOCK 1
|
||||||
|
@@ -116,7 +116,7 @@ typedef struct {
|
|||||||
unsigned long pkt_length;
|
unsigned long pkt_length;
|
||||||
} TRACE_INFO;
|
} TRACE_INFO;
|
||||||
|
|
||||||
#define TRACE_STATUS(a) (!a) ? "ok" : "error"
|
#define TRACE_STATUS(a) ((!a) ? "ok" : "error")
|
||||||
|
|
||||||
TRACE_INFO *trace_info= NULL;
|
TRACE_INFO *trace_info= NULL;
|
||||||
|
|
||||||
|
@@ -223,11 +223,11 @@ static int test_change_user(MYSQL *mysql)
|
|||||||
/* Prepare environment */
|
/* Prepare environment */
|
||||||
sprintf(buff, "drop database if exists %s", db);
|
sprintf(buff, "drop database if exists %s", db);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sprintf(buff, "create database %s", db);
|
sprintf(buff, "create database %s", db);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sprintf(buff,
|
sprintf(buff,
|
||||||
"grant select on %s.* to %s@'%%' identified by '%s'",
|
"grant select on %s.* to %s@'%%' identified by '%s'",
|
||||||
@@ -235,14 +235,14 @@ static int test_change_user(MYSQL *mysql)
|
|||||||
user_pw,
|
user_pw,
|
||||||
pw);
|
pw);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sprintf(buff,
|
sprintf(buff,
|
||||||
"grant select on %s.* to %s@'%%'",
|
"grant select on %s.* to %s@'%%'",
|
||||||
db,
|
db,
|
||||||
user_no_pw);
|
user_no_pw);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
|
||||||
/* Try some combinations */
|
/* Try some combinations */
|
||||||
@@ -288,13 +288,13 @@ static int test_change_user(MYSQL *mysql)
|
|||||||
FAIL_UNLESS(rc, "Error expected");
|
FAIL_UNLESS(rc, "Error expected");
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_pw, pw, db);
|
rc= mysql_change_user(mysql, user_pw, pw, db);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_pw, pw, NULL);
|
rc= mysql_change_user(mysql, user_pw, pw, NULL);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_pw, pw, "");
|
rc= mysql_change_user(mysql, user_pw, pw, "");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_no_pw, pw, db);
|
rc= mysql_change_user(mysql, user_no_pw, pw, db);
|
||||||
FAIL_UNLESS(rc, "Error expected");
|
FAIL_UNLESS(rc, "Error expected");
|
||||||
@@ -306,16 +306,16 @@ static int test_change_user(MYSQL *mysql)
|
|||||||
FAIL_UNLESS(rc, "Error expected");
|
FAIL_UNLESS(rc, "Error expected");
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_no_pw, "", NULL);
|
rc= mysql_change_user(mysql, user_no_pw, "", NULL);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_no_pw, "", "");
|
rc= mysql_change_user(mysql, user_no_pw, "", "");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_no_pw, "", db);
|
rc= mysql_change_user(mysql, user_no_pw, "", db);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, user_no_pw, NULL, db);
|
rc= mysql_change_user(mysql, user_no_pw, NULL, db);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_change_user(mysql, "", pw, db);
|
rc= mysql_change_user(mysql, "", pw, db);
|
||||||
FAIL_UNLESS(rc, "Error expected");
|
FAIL_UNLESS(rc, "Error expected");
|
||||||
@@ -345,15 +345,15 @@ static int test_change_user(MYSQL *mysql)
|
|||||||
|
|
||||||
sprintf(buff, "drop database %s", db);
|
sprintf(buff, "drop database %s", db);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sprintf(buff, "drop user %s@'%%'", user_pw);
|
sprintf(buff, "drop user %s@'%%'", user_pw);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sprintf(buff, "drop user %s@'%%'", user_no_pw);
|
sprintf(buff, "drop user %s@'%%'", user_no_pw);
|
||||||
rc= mysql_query(mysql, buff);
|
rc= mysql_query(mysql, buff);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -661,7 +661,7 @@ int test_connection_timeout(MYSQL *unused __attribute__((unused)))
|
|||||||
elapsed= time(NULL) - start;
|
elapsed= time(NULL) - start;
|
||||||
diag("elapsed: %lu", (unsigned long)elapsed);
|
diag("elapsed: %lu", (unsigned long)elapsed);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
FAIL_IF((unsigned int)elapsed > 2 * timeout, "timeout ignored")
|
FAIL_IF((unsigned int)elapsed > 2 * timeout, "timeout ignored");
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ int test_connection_timeout2(MYSQL *unused __attribute__((unused)))
|
|||||||
elapsed= time(NULL) - start;
|
elapsed= time(NULL) - start;
|
||||||
diag("elapsed: %lu", (unsigned long)elapsed);
|
diag("elapsed: %lu", (unsigned long)elapsed);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
FAIL_IF((unsigned int)elapsed > 2 * timeout, "timeout ignored")
|
FAIL_IF((unsigned int)elapsed > 2 * timeout, "timeout ignored");
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,7 +706,7 @@ int test_connection_timeout3(MYSQL *unused __attribute__((unused)))
|
|||||||
}
|
}
|
||||||
elapsed= time(NULL) - start;
|
elapsed= time(NULL) - start;
|
||||||
diag("elapsed: %lu", (unsigned long)elapsed);
|
diag("elapsed: %lu", (unsigned long)elapsed);
|
||||||
FAIL_IF((unsigned int)elapsed > timeout + 1, "timeout ignored")
|
FAIL_IF((unsigned int)elapsed > timeout + 1, "timeout ignored");
|
||||||
|
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
mysql= mysql_init(NULL);
|
mysql= mysql_init(NULL);
|
||||||
|
@@ -1123,7 +1123,7 @@ static int test_bug11909(MYSQL *mysql)
|
|||||||
check_stmt_rc(rc, stmt2);
|
check_stmt_rc(rc, stmt2);
|
||||||
|
|
||||||
rc= mysql_stmt_fetch(stmt2);
|
rc= mysql_stmt_fetch(stmt2);
|
||||||
FAIL_UNLESS(rc == 0, "rc != 0")
|
FAIL_UNLESS(rc == 0, "rc != 0");
|
||||||
|
|
||||||
FAIL_UNLESS(empno == 10, "empno != 10");
|
FAIL_UNLESS(empno == 10, "empno != 10");
|
||||||
FAIL_UNLESS(strcmp(firstname, "CHRISTINE""") == 0, "firstname != 'Christine'");
|
FAIL_UNLESS(strcmp(firstname, "CHRISTINE""") == 0, "firstname != 'Christine'");
|
||||||
|
@@ -64,57 +64,71 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
|
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
|
||||||
|
|
||||||
/* prevent warnings on Win64 by using STMT_LEN instead of strlen */
|
/* prevent warnings on Win64 by using STMT_LEN instead of strlen */
|
||||||
#define STMT_LEN(A) (unsigned long)strlen((A))
|
#define STMT_LEN(A) ((unsigned long)strlen((A)))
|
||||||
|
|
||||||
#define SKIP_TRAVIS()\
|
#define SKIP_TRAVIS()\
|
||||||
if (getenv("TRAVIS"))\
|
do {\
|
||||||
{\
|
if (getenv("TRAVIS"))\
|
||||||
diag("Skip test on Travis CI");\
|
{\
|
||||||
return SKIP;\
|
diag("Skip test on Travis CI");\
|
||||||
}
|
return SKIP;\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
#define SKIP_MYSQL(mysql)\
|
#define SKIP_MYSQL(mysql)\
|
||||||
if (!mariadb_connection(mysql))\
|
do {\
|
||||||
{\
|
if (!mariadb_connection(mysql))\
|
||||||
diag("Skip test for non MariaDB server");\
|
{\
|
||||||
return OK;\
|
diag("Skip test for non MariaDB server");\
|
||||||
}
|
return OK;\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define check_mysql_rc(rc, mysql) \
|
#define check_mysql_rc(rc, mysql) \
|
||||||
if (rc)\
|
do {\
|
||||||
{\
|
if (rc)\
|
||||||
diag("Error (%d): %s (%d) in %s line %d", rc, mysql_error(mysql), \
|
{\
|
||||||
mysql_errno(mysql), __FILE__, __LINE__);\
|
diag("Error (%d): %s (%d) in %s line %d", rc, mysql_error(mysql), \
|
||||||
return(FAIL);\
|
mysql_errno(mysql), __FILE__, __LINE__);\
|
||||||
}
|
return(FAIL);\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define check_stmt_rc(rc, stmt) \
|
#define check_stmt_rc(rc, stmt) \
|
||||||
if (rc)\
|
do {\
|
||||||
{\
|
if (rc)\
|
||||||
diag("Error: %s (%s: %d)", mysql_stmt_error(stmt), __FILE__, __LINE__);\
|
{\
|
||||||
return(FAIL);\
|
diag("Error: %s (%s: %d)", mysql_stmt_error(stmt), __FILE__, __LINE__);\
|
||||||
}
|
return(FAIL);\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define FAIL_IF(expr, reason)\
|
#define FAIL_IF(expr, reason)\
|
||||||
if (expr)\
|
do {\
|
||||||
{\
|
if (expr)\
|
||||||
diag("Error: %s (%s: %d)", (reason) ? reason : "", __FILE__, __LINE__);\
|
{\
|
||||||
return FAIL;\
|
diag("Error: %s (%s: %d)", (reason) ? reason : "", __FILE__, __LINE__);\
|
||||||
}
|
return FAIL;\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define FAIL_UNLESS(expr, reason)\
|
#define FAIL_UNLESS(expr, reason)\
|
||||||
if (!(expr))\
|
do {\
|
||||||
{\
|
if (!(expr))\
|
||||||
diag("Error: %s (%s: %d)", reason, __FILE__, __LINE__);\
|
{\
|
||||||
return FAIL;\
|
diag("Error: %s (%s: %d)", reason, __FILE__, __LINE__);\
|
||||||
}
|
return FAIL;\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define SKIP_CONNECTION_HANDLER \
|
#define SKIP_CONNECTION_HANDLER \
|
||||||
if (hostname && strstr(hostname, "://"))\
|
do {\
|
||||||
|
if (hostname && strstr(hostname, "://"))\
|
||||||
{\
|
{\
|
||||||
diag("Test skipped (connection handler)");\
|
diag("Test skipped (connection handler)");\
|
||||||
return SKIP;\
|
return SKIP;\
|
||||||
}
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
/* connection options */
|
/* connection options */
|
||||||
#define TEST_CONNECTION_DEFAULT 1 /* default connection */
|
#define TEST_CONNECTION_DEFAULT 1 /* default connection */
|
||||||
|
@@ -678,7 +678,7 @@ static int test_prepare_ext(MYSQL *mysql)
|
|||||||
char query[MAX_TEST_QUERY_LENGTH];
|
char query[MAX_TEST_QUERY_LENGTH];
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
sql= (char *)"CREATE TABLE test_prepare_ext"
|
sql= (char *)"CREATE TABLE test_prepare_ext"
|
||||||
"("
|
"("
|
||||||
@@ -716,7 +716,7 @@ static int test_prepare_ext(MYSQL *mysql)
|
|||||||
" c32 set('monday', 'tuesday', 'wednesday'))";
|
" c32 set('monday', 'tuesday', 'wednesday'))";
|
||||||
|
|
||||||
rc= mysql_query(mysql, sql);
|
rc= mysql_query(mysql, sql);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
/* insert by prepare - all integers */
|
/* insert by prepare - all integers */
|
||||||
strcpy(query, "INSERT INTO test_prepare_ext(c1, c2, c3, c4, c5, c6) VALUES(?, ?, ?, ?, ?, ?)");
|
strcpy(query, "INSERT INTO test_prepare_ext(c1, c2, c3, c4, c5, c6) VALUES(?, ?, ?, ?, ?, ?)");
|
||||||
@@ -785,7 +785,7 @@ static int test_prepare_ext(MYSQL *mysql)
|
|||||||
|
|
||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -1203,7 +1203,7 @@ static int test_long_data(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 3, "Paramcount != 3");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 3, "Paramcount != 3");
|
||||||
|
|
||||||
@@ -1296,7 +1296,7 @@ static int test_long_data_str(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
||||||
|
|
||||||
@@ -1395,7 +1395,7 @@ static int test_long_data_str1(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
||||||
|
|
||||||
@@ -1465,7 +1465,7 @@ static int test_long_data_str1(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 0, "Paramcount != 0");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 0, "Paramcount != 0");
|
||||||
|
|
||||||
@@ -1560,7 +1560,7 @@ static int test_long_data_bin(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
||||||
|
|
||||||
@@ -1653,7 +1653,7 @@ static int test_simple_delete(MYSQL *mysql)
|
|||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
check_stmt_rc(rc, stmt)
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
FAIL_IF(mysql_stmt_param_count(stmt) != 2, "Paramcount != 2");
|
||||||
|
|
||||||
|
@@ -1064,10 +1064,10 @@ static int test_bug1946(MYSQL *mysql)
|
|||||||
|
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS prepare_command");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS prepare_command");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "CREATE TABLE prepare_command(ID INT)");
|
rc= mysql_query(mysql, "CREATE TABLE prepare_command(ID INT)");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
@@ -1106,9 +1106,9 @@ static int test_bug20152(MYSQL *mysql)
|
|||||||
tm.second = 42;
|
tm.second = 42;
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
rc= mysql_query(mysql, "CREATE TABLE t1 (f1 DATE)");
|
rc= mysql_query(mysql, "CREATE TABLE t1 (f1 DATE)");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
rc= mysql_stmt_prepare(stmt, SL(query));
|
rc= mysql_stmt_prepare(stmt, SL(query));
|
||||||
@@ -1120,7 +1120,7 @@ static int test_bug20152(MYSQL *mysql)
|
|||||||
rc= mysql_stmt_close(stmt);
|
rc= mysql_stmt_close(stmt);
|
||||||
check_stmt_rc(rc, stmt);
|
check_stmt_rc(rc, stmt);
|
||||||
rc= mysql_query(mysql, "DROP TABLE t1");
|
rc= mysql_query(mysql, "DROP TABLE t1");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
FAIL_UNLESS(tm.hour == 14 && tm.minute == 9 && tm.second == 42, "time != 14:09:42");
|
FAIL_UNLESS(tm.hour == 14 && tm.minute == 9 && tm.second == 42, "time != 14:09:42");
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -1142,10 +1142,10 @@ static int test_bug2247(MYSQL *mysql)
|
|||||||
|
|
||||||
/* create table and insert few rows */
|
/* create table and insert few rows */
|
||||||
rc= mysql_query(mysql, drop);
|
rc= mysql_query(mysql, drop);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, create);
|
rc= mysql_query(mysql, create);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
@@ -1160,7 +1160,7 @@ static int test_bug2247(MYSQL *mysql)
|
|||||||
FAIL_UNLESS(exp_count == 1, "exp_count != 1");
|
FAIL_UNLESS(exp_count == 1, "exp_count != 1");
|
||||||
|
|
||||||
rc= mysql_query(mysql, SELECT);
|
rc= mysql_query(mysql, SELECT);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
/*
|
/*
|
||||||
mysql_store_result overwrites mysql->affected_rows. Check that
|
mysql_store_result overwrites mysql->affected_rows. Check that
|
||||||
mysql_stmt_affected_rows() returns the same value, whereas
|
mysql_stmt_affected_rows() returns the same value, whereas
|
||||||
@@ -1173,7 +1173,7 @@ static int test_bug2247(MYSQL *mysql)
|
|||||||
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
||||||
|
|
||||||
rc= mysql_query(mysql, update);
|
rc= mysql_query(mysql, update);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
FAIL_UNLESS(mysql_affected_rows(mysql) == NUM_ROWS, "affected_rows != NUM_ROWS");
|
FAIL_UNLESS(mysql_affected_rows(mysql) == NUM_ROWS, "affected_rows != NUM_ROWS");
|
||||||
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
||||||
|
|
||||||
@@ -1192,13 +1192,13 @@ static int test_bug2247(MYSQL *mysql)
|
|||||||
FAIL_UNLESS(exp_count == NUM_ROWS, "exp_count != NUM_ROWS");
|
FAIL_UNLESS(exp_count == NUM_ROWS, "exp_count != NUM_ROWS");
|
||||||
|
|
||||||
rc= mysql_query(mysql, insert);
|
rc= mysql_query(mysql, insert);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
FAIL_UNLESS(mysql_affected_rows(mysql) == 1, "affected_rows != 1");
|
FAIL_UNLESS(mysql_affected_rows(mysql) == 1, "affected_rows != 1");
|
||||||
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
FAIL_UNLESS(exp_count == mysql_stmt_affected_rows(stmt), "affected_rows != exp_count");
|
||||||
|
|
||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
rc= mysql_query(mysql, drop);
|
rc= mysql_query(mysql, drop);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1215,10 +1215,10 @@ static int test_bug2248(MYSQL *mysql)
|
|||||||
|
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bug2248");
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bug2248");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "CREATE TABLE test_bug2248 (id int)");
|
rc= mysql_query(mysql, "CREATE TABLE test_bug2248 (id int)");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
FAIL_IF(!stmt, mysql_error(mysql));
|
FAIL_IF(!stmt, mysql_error(mysql));
|
||||||
@@ -1256,7 +1256,7 @@ static int test_bug2248(MYSQL *mysql)
|
|||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "DROP TABLE test_bug2248");
|
rc= mysql_query(mysql, "DROP TABLE test_bug2248");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2658,7 +2658,7 @@ static int test_bug5194(MYSQL *mysql)
|
|||||||
MAX_PARAM_COUNT * CHARS_PER_PARAM + 1);
|
MAX_PARAM_COUNT * CHARS_PER_PARAM + 1);
|
||||||
param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM);
|
param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM);
|
||||||
|
|
||||||
FAIL_IF(my_bind == 0 || query == 0 || param_str == 0, "Not enough memory")
|
FAIL_IF(my_bind == 0 || query == 0 || param_str == 0, "Not enough memory");
|
||||||
|
|
||||||
stmt= mysql_stmt_init(mysql);
|
stmt= mysql_stmt_init(mysql);
|
||||||
|
|
||||||
|
@@ -541,16 +541,16 @@ static int test_bug19671(MYSQL *mysql)
|
|||||||
|
|
||||||
mysql_query(mysql, "set sql_mode=''");
|
mysql_query(mysql, "set sql_mode=''");
|
||||||
rc= mysql_query(mysql, "drop table if exists t1");
|
rc= mysql_query(mysql, "drop table if exists t1");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "drop view if exists v1");
|
rc= mysql_query(mysql, "drop view if exists v1");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "create table t1(f1 int)");
|
rc= mysql_query(mysql, "create table t1(f1 int)");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, "create view v1 as select va.* from t1 va");
|
rc= mysql_query(mysql, "create view v1 as select va.* from t1 va");
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
result= mysql_list_fields(mysql, "v1", NULL);
|
result= mysql_list_fields(mysql, "v1", NULL);
|
||||||
FAIL_IF(!result, "Invalid result set");
|
FAIL_IF(!result, "Invalid result set");
|
||||||
@@ -568,8 +568,8 @@ static int test_bug19671(MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
check_mysql_rc(mysql_query(mysql, "drop view v1"), mysql)
|
check_mysql_rc(mysql_query(mysql, "drop view v1"), mysql);
|
||||||
check_mysql_rc(mysql_query(mysql, "drop table t1"), mysql)
|
check_mysql_rc(mysql_query(mysql, "drop table t1"), mysql);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,17 +604,17 @@ static int test_bug21726(MYSQL *mysql)
|
|||||||
check_mysql_rc(rc, mysql);
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
rc= mysql_query(mysql, update_query);
|
rc= mysql_query(mysql, update_query);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
insert_id= mysql_insert_id(mysql);
|
insert_id= mysql_insert_id(mysql);
|
||||||
FAIL_UNLESS(insert_id == 2, "insert_id != 2");
|
FAIL_UNLESS(insert_id == 2, "insert_id != 2");
|
||||||
|
|
||||||
rc= mysql_query(mysql, update_query);
|
rc= mysql_query(mysql, update_query);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
insert_id= mysql_insert_id(mysql);
|
insert_id= mysql_insert_id(mysql);
|
||||||
FAIL_UNLESS(insert_id == 3, "insert_id != 3");
|
FAIL_UNLESS(insert_id == 3, "insert_id != 3");
|
||||||
|
|
||||||
rc= mysql_query(mysql, select_query);
|
rc= mysql_query(mysql, select_query);
|
||||||
check_mysql_rc(rc, mysql)
|
check_mysql_rc(rc, mysql);
|
||||||
insert_id= mysql_insert_id(mysql);
|
insert_id= mysql_insert_id(mysql);
|
||||||
FAIL_UNLESS(insert_id == 3, "insert_id != 3");
|
FAIL_UNLESS(insert_id == 3, "insert_id != 3");
|
||||||
result= mysql_store_result(mysql);
|
result= mysql_store_result(mysql);
|
||||||
|
Reference in New Issue
Block a user