Commit 1ff476b4 authored by Lawrin Novitsky's avatar Lawrin Novitsky

MDEV-29490 Renaming internally used client API to avoid name conflicts

with C/C.
The patch introduces mariadb_capi_rename.h which is included into
mysql.h. The hew header contains macro definitions for the names being
renamed. In versions 10.6+(i.e. where sql service exists) the renaming
condition in the mariadb_capi_rename.h should be added with
&& !defined(MYSQL_DYNAMIC_PLUGIN)
and look like
The patch also contains removal of mysql.h from the api check.

Disabling false_duper-6543 test for embedded.

ha_federated.so uses C API. C API functions are being renamed in the server,
but not renamed in embedded, since embedded server library should have proper
C API, as expected by programs using it.
Thus the same ha_federated.so cannot work both for server and embedded
server library.

As all federated tests are already disabled for embedded,
federated isn't supposed to work for embedded anyway, and thus the test
is being disabled.
parent 32158be7
...@@ -38,7 +38,6 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK) ...@@ -38,7 +38,6 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK)
SET(API_PREPROCESSOR_HEADER SET(API_PREPROCESSOR_HEADER
${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h
${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h
${CMAKE_SOURCE_DIR}/include/mysql.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h
......
/* Copyright (c) 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* Renaming C API symbols inside server
* client.c defines a number of functions from the C API, that are used in replication, in number of storage engine plugins, mariadb-backup.
* That can cause a problem if a plugin loads libmariadb/libmysql or a library, that has dependency on them. The known case is ODBC driver.
* Thus the header re-names those functions for internal use.
*/
#ifndef MARIADB_CAPI_RENAME_INCLUDED
#define MARIADB_CAPI_RENAME_INCLUDED
#if !defined(EMBEDDED_LIBRARY)
#define MARIADB_ADD_PREFIX(_SYMBOL) server_##_SYMBOL
#define mysql_real_connect MARIADB_ADD_PREFIX(mysql_real_connect)
#define mysql_init MARIADB_ADD_PREFIX(mysql_init)
#define mysql_close MARIADB_ADD_PREFIX(mysql_close)
#define mysql_options MARIADB_ADD_PREFIX(mysql_options)
#define mysql_load_plugin MARIADB_ADD_PREFIX(mysql_load_plugin)
#define mysql_load_plugin_v MARIADB_ADD_PREFIX(mysql_load_plugin_v)
#define mysql_client_find_plugin MARIADB_ADD_PREFIX(mysql_client_find_plugin)
#define mysql_real_query MARIADB_ADD_PREFIX(mysql_real_query)
#define mysql_send_query MARIADB_ADD_PREFIX(mysql_send_query)
#define mysql_free_result MARIADB_ADD_PREFIX(mysql_free_result)
#define mysql_get_socket MARIADB_ADD_PREFIX(mysql_get_socket)
#define mysql_set_character_set MARIADB_ADD_PREFIX(mysql_set_character_set)
#define mysql_get_server_version MARIADB_ADD_PREFIX(mysql_get_server_version)
#define mysql_error MARIADB_ADD_PREFIX(mysql_error)
#define mysql_errno MARIADB_ADD_PREFIX(mysql_errno)
#define mysql_num_fields MARIADB_ADD_PREFIX(mysql_num_fields)
#define mysql_num_rows MARIADB_ADD_PREFIX(mysql_num_rows)
#define mysql_options4 MARIADB_ADD_PREFIX(mysql_options4)
#define mysql_fetch_lengths MARIADB_ADD_PREFIX(mysql_fetch_lengths)
#define mysql_fetch_row MARIADB_ADD_PREFIX(mysql_fetch_row)
#define mysql_affected_rows MARIADB_ADD_PREFIX(mysql_affected_rows)
#define mysql_store_result MARIADB_ADD_PREFIX(mysql_store_result)
#define mysql_select_db MARIADB_ADD_PREFIX(mysql_select_db)
#define mysql_get_ssl_cipher MARIADB_ADD_PREFIX(mysql_get_ssl_cipher)
#define mysql_ssl_set MARIADB_ADD_PREFIX(mysql_ssl_set)
#define mysql_client_register_plugin MARIADB_ADD_PREFIX(mysql_client_register_plugin)
#endif // !EMBEDDED_LIBRARY && !MYSQL_DYNAMIC_PLUGIN
#endif // !MARIADB_CAPI_RENAME_INCLUDED
...@@ -73,6 +73,7 @@ typedef int my_socket; ...@@ -73,6 +73,7 @@ typedef int my_socket;
#endif /* my_socket_defined */ #endif /* my_socket_defined */
#endif /* MY_GLOBAL_INCLUDED */ #endif /* MY_GLOBAL_INCLUDED */
#include "mariadb_capi_rename.h"
#include "mysql_version.h" #include "mysql_version.h"
#include "mysql_com.h" #include "mysql_com.h"
#include "mysql_time.h" #include "mysql_time.h"
......
This diff is collapsed.
source include/not_embedded.inc;
# #
# MDEV-6543 Crash if enable 'federatedx' when 'federated' plugin already enabled, and vice-versa # MDEV-6543 Crash if enable 'federatedx' when 'federated' plugin already enabled, and vice-versa
# #
......
SET(FEDERATEDX_PLUGIN_STATIC "federatedx") SET(FEDERATEDX_PLUGIN_STATIC "federatedx")
SET(FEDERATEDX_PLUGIN_DYNAMIC "ha_federatedx") SET(FEDERATEDX_PLUGIN_DYNAMIC "ha_federatedx")
SET(FEDERATEDX_SOURCES ha_federatedx.cc federatedx_txn.cc federatedx_io.cc federatedx_io_null.cc federatedx_io_mysql.cc) SET(FEDERATEDX_SOURCES ha_federatedx.cc federatedx_txn.cc federatedx_io.cc federatedx_io_null.cc federatedx_io_mysql.cc)
MYSQL_ADD_PLUGIN(federatedx ${FEDERATEDX_SOURCES} STORAGE_ENGINE) MYSQL_ADD_PLUGIN(federatedx ${FEDERATEDX_SOURCES} STORAGE_ENGINE
RECOMPILE_FOR_EMBEDDED)
...@@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <my_global.h> #include <my_global.h>
#include "sql_priv.h" #include "sql_priv.h"
#include <mysqld_error.h> #include <mysqld_error.h>
#include <mysql.h>
#include "ha_federatedx.h" #include "ha_federatedx.h"
......
...@@ -314,6 +314,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -314,6 +314,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MYSQL_SERVER 1 #define MYSQL_SERVER 1
#include <my_global.h> #include <my_global.h>
#include <mysql/plugin.h> #include <mysql/plugin.h>
#include <mysql.h>
#include "ha_federatedx.h" #include "ha_federatedx.h"
#include "sql_servers.h" #include "sql_servers.h"
#include "sql_analyse.h" // append_escaped() #include "sql_analyse.h" // append_escaped()
......
...@@ -19,4 +19,4 @@ IF(MSVC) ...@@ -19,4 +19,4 @@ IF(MSVC)
ENDIF(MSVC) ENDIF(MSVC)
SET(SPHINX_SOURCES ha_sphinx.cc snippets_udf.cc) SET(SPHINX_SOURCES ha_sphinx.cc snippets_udf.cc)
MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE) MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE RECOMPILE_FOR_EMBEDDED)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment