Register zlib compression plugin and fix reported package version

Address review on the 3.4.9 bump:

- Since connector 3.4 the zlib protocol compression (CLIENT_COMPRESS)
  moved behind a client compression plugin. ClickHouse enables it via
  mysql_options(MYSQL_OPT_COMPRESS) (mysqlxx Connection, when
  enable_compression is set), so without a registered COMPRESSION plugin
  compression_plugin(net) stays null and mysql_real_connect fails with
  CR_ERR_LOAD_PLUGIN. Register plugins/compress/c_zlib.c as a static
  builtin plugin (matching upstream plugins/compress/CMakeLists.txt)
  before ma_client_plugin.c is configured.

- Bump CPACK_PACKAGE_VERSION from 3.1.29 to 3.4.9 so the generated
  MARIADB_PACKAGE_VERSION (used by mysql_get_client_info,
  mysql_get_client_version and the _client_version connect attribute)
  reports the correct connector version.
This commit is contained in:
Konstantin Bogdanov
2026-06-23 22:56:56 +02:00
parent da25da054d
commit 5ada634db5
@@ -45,7 +45,7 @@ MATH(EXPR MARIADB_VERSION_ID "${MARIADB_CLIENT_VERSION_MAJOR} * 10000 +
set(CPACK_PACKAGE_VERSION_MAJOR 3)
set(CPACK_PACKAGE_VERSION_MINOR 4)
set(CPACK_PACKAGE_VERSION_PATCH 10)
set(CPACK_PACKAGE_VERSION_PATCH 9)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
MATH(EXPR MARIADB_PACKAGE_VERSION_ID "${CPACK_PACKAGE_VERSION_MAJOR} * 10000 +
${CPACK_PACKAGE_VERSION_MINOR} * 100 +
@@ -191,6 +191,15 @@ REGISTER_PLUGIN(TARGET mysql_native_password
TYPE MARIADB_CLIENT_PLUGIN_AUTH
SOURCES "${CC_SOURCE_DIR}/plugins/auth/my_auth.c")
# zlib protocol compression (CLIENT_COMPRESS). Since connector 3.4 the zlib
# compression moved behind a client compression plugin, so it must be
# registered as a static builtin before ma_client_plugin.c is generated;
# otherwise compression_plugin(net) stays null and mysql_real_connect fails
# with CR_ERR_LOAD_PLUGIN when MYSQL_OPT_COMPRESS is requested.
REGISTER_PLUGIN(TARGET zlib
TYPE MARIADB_CLIENT_PLUGIN_COMPRESSION
SOURCES "${CC_SOURCE_DIR}/plugins/compress/c_zlib.c")
add_definitions(-D HAVE_COMPRESS)
add_definitions(-D LIBMARIADB)
add_definitions(-D THREAD)