Skip to content

Commit

Permalink
Add option for setting zlib/zstd compression algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed May 7, 2023
1 parent 4228c85 commit 5f669c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/drivers/mysql/drv_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ static sb_arg_t mysql_drv_args[] =
STRING),
SB_OPT("mysql-compression", "use compression, if available in the "
"client library", "off", BOOL),
SB_OPT("mysql-compression-algorithms", "compression algorithms to use",
"zlib", STRING),
SB_OPT("mysql-debug", "trace all client library calls", "off", BOOL),
SB_OPT("mysql-ignore-errors", "list of errors to ignore, or \"all\"",
"1213,1020,1205", LIST),
Expand All @@ -107,6 +109,7 @@ typedef struct
const char *ssl_ca;
const char *ssl_cipher;
unsigned char use_compression;
const char *compression_alg;
unsigned char debug;
sb_list_t *ignored_errors;
unsigned int dry_run;
Expand Down Expand Up @@ -334,6 +337,8 @@ int mysql_drv_init(void)
#endif

args.use_compression = sb_get_value_flag("mysql-compression");
args.compression_alg = sb_get_value_string("mysql-compression-algorithms");

args.debug = sb_get_value_flag("mysql-debug");
if (args.debug)
sb_globals.verbosity = LOG_DEBUG;
Expand Down Expand Up @@ -410,6 +415,9 @@ static int mysql_drv_real_connect(db_mysql_conn_t *db_mysql_con)
{
DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESS", "NULL");
mysql_options(con, MYSQL_OPT_COMPRESS, NULL);

DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESSION_ALGORITHMS", args.compression_alg);
mysql_options(con, MYSQL_OPT_COMPRESSION_ALGORITHMS, args.compression_alg);
}

DEBUG("mysql_real_connect(%p, \"%s\", \"%s\", \"%s\", \"%s\", %u, \"%s\", %s)",
Expand Down

0 comments on commit 5f669c9

Please sign in to comment.