From 5f669c98eb062e1e27c98aa98cfb022c2c483391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Sun, 7 May 2023 16:29:46 +0200 Subject: [PATCH] Add option for setting zlib/zstd compression algorithms --- src/drivers/mysql/drv_mysql.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/drivers/mysql/drv_mysql.c b/src/drivers/mysql/drv_mysql.c index 58600b8e..5e9afba2 100644 --- a/src/drivers/mysql/drv_mysql.c +++ b/src/drivers/mysql/drv_mysql.c @@ -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), @@ -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; @@ -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; @@ -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)",