v / vlib / db / mysql / mysql_compat.h
12 lines · 12 sloc · 748 bytes · a3db24065008f9756c14f11f0df1f573ac4abeba
Raw
1// MYSQL_OPT_SSL_MODE was added in MySQL 5.7. MariaDB's server and connector
2// headers expose their own TLS options instead, so the generated C code would
3// fail to compile when it references the MySQL-only enum value. Because enum
4// values are not preprocessor macros, `#ifndef MYSQL_OPT_SSL_MODE` alone
5// cannot distinguish a MySQL header that has the enum from a MariaDB header
6// that does not. Gate on MariaDB's published macros and supply a sentinel that
7// mysql_options() will reject at runtime if Config.ssl_mode is used there.
8#if !defined(MYSQL_OPT_SSL_MODE) && \
9 (defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID) || \
10 defined(MARIADB_PACKAGE_VERSION_ID) || defined(LIBMARIADB))
11#define MYSQL_OPT_SSL_MODE 9999
12#endif
13