Skip to content

Commit de18a03

Browse files
authored
Merge pull request #506 from dveeden/mysql__compression_alg__mariadb
Allow building the MySQL driver with MariaDB libraries.
2 parents 2ca9e3f + 0f27db3 commit de18a03

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,28 @@ jobs:
2424
- name: Test
2525
run: make test
2626

27+
build_mariadb:
28+
runs-on: ubuntu-22.04
29+
name: Build with MariaDB
30+
steps:
31+
- name: Setup MariaDB Repo
32+
run: |
33+
sudo apt-get install software-properties-common
34+
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
35+
sudo add-apt-repository 'deb [arch=amd64] https://ftp.nluug.nl/db/mariadb/repo/11.0/ubuntu jammy main'
36+
- name: Setup MariaDB Libs
37+
run: sudo apt install libmariadb-dev libmariadb-dev-compat
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
- name: Autogen
41+
run: ./autogen.sh
42+
- name: Configure
43+
run: ./configure --with-mysql --with-pgsql
44+
- name: Build
45+
run: make
46+
- name: MariaDB version
47+
run: mariadb_config --version
48+
- name: Sysbench version
49+
run: ./src/sysbench --version
50+
- name: Test
51+
run: make test

src/drivers/mysql/drv_mysql.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ typedef struct
109109
const char *ssl_ca;
110110
const char *ssl_cipher;
111111
unsigned char use_compression;
112+
#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS
112113
const char *compression_alg;
114+
#endif
113115
unsigned char debug;
114116
sb_list_t *ignored_errors;
115117
unsigned int dry_run;
@@ -337,7 +339,9 @@ int mysql_drv_init(void)
337339
#endif
338340

339341
args.use_compression = sb_get_value_flag("mysql-compression");
342+
#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS
340343
args.compression_alg = sb_get_value_string("mysql-compression-algorithms");
344+
#endif
341345

342346
args.debug = sb_get_value_flag("mysql-debug");
343347
if (args.debug)
@@ -416,8 +420,10 @@ static int mysql_drv_real_connect(db_mysql_conn_t *db_mysql_con)
416420
DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESS", "NULL");
417421
mysql_options(con, MYSQL_OPT_COMPRESS, NULL);
418422

423+
#ifdef MYSQL_OPT_COMPRESSION_ALGORITHMS
419424
DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESSION_ALGORITHMS", args.compression_alg);
420425
mysql_options(con, MYSQL_OPT_COMPRESSION_ALGORITHMS, args.compression_alg);
426+
#endif
421427
}
422428

423429
DEBUG("mysql_real_connect(%p, \"%s\", \"%s\", \"%s\", \"%s\", %u, \"%s\", %s)",

tests/t/help_drv_mysql.t

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ Skip test if the MySQL driver is not available.
88
$ sysbench --help | grep -- '--db-driver'
99
--db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql]
1010

11-
$ sysbench --help | sed -n '/mysql options:/,/^$/p'
11+
$ sysbench --help | sed -n '/mysql options:/,/^$/p' | grep -v 'mysql-ssl[=\[]'
1212
mysql options:
1313
--mysql-host=[LIST,...] MySQL server host [localhost]
1414
--mysql-port=[LIST,...] MySQL server port [3306]
1515
--mysql-socket=[LIST,...] MySQL socket
1616
--mysql-user=STRING MySQL user [sbtest]
1717
--mysql-password=STRING MySQL password []
1818
--mysql-db=STRING MySQL database name [sbtest]
19-
--mysql-ssl=STRING SSL mode. This accepts the same values as the --ssl-mode option in the MySQL client utilities. Disabled by default [disabled]
2019
--mysql-ssl-key=STRING path name of the client private key file
2120
--mysql-ssl-ca=STRING path name of the CA file
2221
--mysql-ssl-cert=STRING path name of the client public key certificate file

0 commit comments

Comments
 (0)