diff --git a/Makefile b/Makefile index bf43f95..1cd47fe 100644 --- a/Makefile +++ b/Makefile @@ -194,6 +194,7 @@ mxq_mysql.h += $(mxq_util.h) ### mxq_util.h --------------------------------------------------------- mxq_util.h += mxq_util.h +mxq_util.h += $(mx_log.h) mxq_util.h += $(mxq.h) ### mxq_group.h -------------------------------------------------------- @@ -229,6 +230,8 @@ clean: CLEAN += mx_log.o ### mx_util.o ---------------------------------------------------------- +mx_util.o: $(mx_log.h) + clean: CLEAN += mx_util.o ### mx_flock.o ------------------------------------------------------- @@ -448,6 +451,7 @@ test_mx_util.o: $(mx_util.h) clean: CLEAN += test_mx_util.o test_mx_util: mx_util.o +test_mx_util: mx_log.o clean: CLEAN += test_mx_util test: test_mx_util diff --git a/mx_mysql.h b/mx_mysql.h index d005895..02e8348 100644 --- a/mx_mysql.h +++ b/mx_mysql.h @@ -4,8 +4,6 @@ #include #include -//#include "mxq_util.h" - #include "mx_util.h" #ifdef MX_NDEBUG_MYSQL @@ -31,7 +29,6 @@ } \ } while (0) - struct mx_mysql { MYSQL *mysql; @@ -86,42 +83,6 @@ struct mx_mysql_stmt { struct mx_mysql_bind param; }; -/* -#include -static inline void mx_mysql_bind_string2(struct mx_mysql_bind *b, int index) -{ - assert(index < b->count); - b->bind[index].buffer_type = MYSQL_TYPE_STRING; - b->bind[index].buffer = 0; - b->bind[index].buffer_length = 0; - b->bind[index].length = &(b->length[index]); -} - -static inline void mx_mysql_bind_string3(struct mx_mysql_bind *b, int index, char *value) -{ - assert(index < b->count); - b->bind[index].buffer_type = MYSQL_TYPE_STRING; - b->bind[index].buffer = value; - b->bind[index].buffer_length = strlen(value); - b->bind[index].length = &(b->bind[index].buffer_length); -} - -#define MXQ_MYSQL_BIND_VARSTR(b, c, v) \ - do { \ - (b)[(c)].buffer_type = MYSQL_TYPE_STRING; \ - (b)[(c)].buffer = 0; \ - (b)[(c)].buffer_length = 0; \ - (b)[(c)].length = (v); \ - } while (0) - -#define MXQ_MYSQL_BIND_STRING(b, c, v) \ - do { \ - (b)[(c)].buffer_type = MYSQL_TYPE_STRING; \ - (b)[(c)].buffer = (v); \ - (b)[(c)].buffer_length = strlen((v)); \ - (b)[(c)].length = &((b)[(c)].buffer_length); \ - } while (0) -*/ #ifndef MX_MYSQL_FAIL_WAIT_DEFAULT # ifdef MX_CALLOC_FAIL_WAIT_DEFAULT # define MX_MYSQL_FAIL_WAIT_DEFAULT MX_CALLOC_FAIL_WAIT_DEFAULT @@ -168,7 +129,6 @@ int mx_mysql_statement_close(struct mx_mysql_stmt **stmt); #define mx_mysql_statement_param_bind(s, i, t, p) mx_mysql_bind_##t(&((s)->param), (i), (p)) -//int mx_mysql_bind_validate(struct mx_mysql_bind *b); int mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, char **value); int mx_mysql_bind_int8(struct mx_mysql_bind *b, unsigned int index, int8_t *value); @@ -181,6 +141,4 @@ int mx_mysql_bind_uint16(struct mx_mysql_bind *b, unsigned int index, uint16_t * int mx_mysql_bind_uint32(struct mx_mysql_bind *b, unsigned int index, uint32_t *value); int mx_mysql_bind_uint64(struct mx_mysql_bind *b, unsigned int index, uint64_t *value); - - #endif diff --git a/mx_util.c b/mx_util.c index 5befe06..da61176 100644 --- a/mx_util.c +++ b/mx_util.c @@ -13,6 +13,7 @@ //#include #include +#include "mx_log.h" #include "mx_util.h" static inline int _mx_strbeginswith(char *str, const char *start, char **endptr, short ignore_case)