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
Added new macro OPT_SET_EXTENDED_VALUE_BIN
OPT_SET_EXTENDED_VALUE_BIN can be used to set binary values for options: OPT_SET_EXTENDED_VALUE_BIN(options, key, key_len, val, len)
This commit is contained in:
@@ -674,6 +674,18 @@ struct st_default_options mariadb_defaults[] =
|
|||||||
(OPTS)->extension= (struct st_mysql_options_extension *) \
|
(OPTS)->extension= (struct st_mysql_options_extension *) \
|
||||||
calloc(1, sizeof(struct st_mysql_options_extension));
|
calloc(1, sizeof(struct st_mysql_options_extension));
|
||||||
|
|
||||||
|
#define OPT_SET_EXTENDED_VALUE_BIN(OPTS, KEY, KEY_LEN, VAL, LEN) \
|
||||||
|
CHECK_OPT_EXTENSION_SET(OPTS) \
|
||||||
|
free((gptr)(OPTS)->extension->KEY); \
|
||||||
|
if((VAL) && (LEN)) { \
|
||||||
|
if (((OPTS)->extension->KEY= malloc((LEN)))) { \
|
||||||
|
memcpy((OPTS)->extension->KEY, (VAL), (LEN)); \
|
||||||
|
(OPTS)->extension->KEY_LEN= (LEN); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
(OPTS)->extension->KEY= NULL
|
||||||
|
|
||||||
#define OPT_SET_EXTENDED_VALUE_STR(OPTS, KEY, VAL) \
|
#define OPT_SET_EXTENDED_VALUE_STR(OPTS, KEY, VAL) \
|
||||||
CHECK_OPT_EXTENSION_SET(OPTS) \
|
CHECK_OPT_EXTENSION_SET(OPTS) \
|
||||||
free((gptr)(OPTS)->extension->KEY); \
|
free((gptr)(OPTS)->extension->KEY); \
|
||||||
@@ -3252,8 +3264,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
case MARIADB_OPT_PROXY_HEADER:
|
case MARIADB_OPT_PROXY_HEADER:
|
||||||
{
|
{
|
||||||
size_t arg2 = va_arg(ap, size_t);
|
size_t arg2 = va_arg(ap, size_t);
|
||||||
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, proxy_header, (char *)arg1);
|
OPT_SET_EXTENDED_VALUE_BIN(&mysql->options, proxy_header, proxy_header_len, (char *)arg1, arg2);
|
||||||
OPT_SET_EXTENDED_VALUE(&mysql->options, proxy_header_len, arg2);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MARIADB_OPT_TLS_VERSION:
|
case MARIADB_OPT_TLS_VERSION:
|
||||||
|
Reference in New Issue
Block a user