fdo#70496 revert to using libmysqlclient

Change-Id: I5b98b5e7840e4f1c6005aee0c1f43ef814ecf77b
This commit is contained in:
Lionel Elie Mamane 2013-10-19 22:57:40 +02:00
parent 96953171bf
commit 02a11749da
7 changed files with 76 additions and 6 deletions

View File

@ -357,6 +357,9 @@ export MARIADBC_MICRO=@MARIADBC_MICRO@
export MARIADBC_MINOR=@MARIADBC_MINOR@ export MARIADBC_MINOR=@MARIADBC_MINOR@
export MARIADB_CFLAGS=$(gb_SPACE)@MARIADB_CFLAGS@ export MARIADB_CFLAGS=$(gb_SPACE)@MARIADB_CFLAGS@
export MARIADB_LIBS=$(gb_SPACE)@MARIADB_LIBS@ export MARIADB_LIBS=$(gb_SPACE)@MARIADB_LIBS@
export LIBMARIADB=@LIBMARIADB@
export LIBMARIADB_PATH=@LIBMARIADB_PATH@
export BUNDLE_MARIADB=@BUNDLE_MARIADB@
export MD5SUM=@MD5SUM@ export MD5SUM=@MD5SUM@
export MDDS_CPPFLAGS=$(gb_SPACE)@MDDS_CPPFLAGS@ export MDDS_CPPFLAGS=$(gb_SPACE)@MDDS_CPPFLAGS@
export MERGELIBS=@MERGELIBS@ export MERGELIBS=@MERGELIBS@

View File

@ -1520,6 +1520,11 @@ AC_ARG_WITH(system-mariadb,
extension.]),, extension.]),,
[with_system_mariadb="$with_system_libs"]) [with_system_mariadb="$with_system_libs"])
AC_ARG_ENABLE(bundle-mariadb,
AS_HELP_STRING([--enable-bundle-mariadb],
[When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
)
AC_ARG_WITH(system-mysql-cppconn, AC_ARG_WITH(system-mysql-cppconn,
AS_HELP_STRING([--with-system-mysql-cppconn], AS_HELP_STRING([--with-system-mysql-cppconn],
[Use MySQL C++ Connector libraries already on system.]),, [Use MySQL C++ Connector libraries already on system.]),,
@ -8185,11 +8190,12 @@ if test "$ENABLE_MARIADBC" = "TRUE"; then
if test "$with_system_mariadb" = "yes"; then if test "$with_system_mariadb" = "yes"; then
AC_MSG_RESULT([external]) AC_MSG_RESULT([external])
SYSTEM_MARIADB=YES SYSTEM_MARIADB=YES
AC_PATH_PROG(MARIADBCONFIG, [mariadb_config]) #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
if test -z "$MARIADBCONFIG"; then if test -z "$MARIADBCONFIG"; then
AC_PATH_PROG(MARIADBCONFIG, [mysql_config]) AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
if test -z "$MARIADBCONFIG"; then if test -z "$MARIADBCONFIG"; then
AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.]) #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL package.])
AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
fi fi
fi fi
AC_MSG_CHECKING([MariaDB version]) AC_MSG_CHECKING([MariaDB version])
@ -8202,10 +8208,36 @@ if test "$ENABLE_MARIADBC" = "TRUE"; then
fi fi
AC_MSG_CHECKING([for MariaDB Client library]) AC_MSG_CHECKING([for MariaDB Client library])
MARIADB_CFLAGS=`$MARIADBCONFIG --cflags` MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
MARIADB_LIBS=`$MARIADBCONFIG --libs` MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
AC_MSG_RESULT([includes $MARIADB_CFLAGS, libraries $MARIADB_LIBS]) AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
if test "$enable_bundle_mariadb" = "yes"; then
AC_MSG_RESULT([yes])
BUNDLE_MARIADB=YES
LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\+-l/\n/g' | grep -E '(mysqlclient|mariadb)')
if test "$_os" = "Darwin"; then
LIBMARIADB=${LIBMARIADB}.dylib
elif test "$_os" = "WINNT"; then
LIBMARIADB=${LIBMARIADB}.dll
else
LIBMARIADB=${LIBMARIADB}.so
fi
LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
AC_MSG_RESULT([found.])
PathFormat "$LIBMARIADB_PATH"
LIBMARIADB_PATH="$formatted_path"
else
AC_MSG_ERROR([not found.])
fi
else
AC_MSG_RESULT([no])
BUNDLE_MARIADB=NO
fi
else else
AC_MSG_RESULT([internal]) AC_MSG_RESULT([internal])
AC_MSG_ERROR([libmariadb is known to be broken as of 2013-10; use libmysqlclient])
SYSTEM_MARIADB=NO SYSTEM_MARIADB=NO
MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include" MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib" MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
@ -8215,6 +8247,9 @@ if test "$ENABLE_MARIADBC" = "TRUE"; then
AC_SUBST(SYSTEM_MARIADB) AC_SUBST(SYSTEM_MARIADB)
AC_SUBST(MARIADB_CFLAGS) AC_SUBST(MARIADB_CFLAGS)
AC_SUBST(MARIADB_LIBS) AC_SUBST(MARIADB_LIBS)
AC_SUBST(LIBMARIADB)
AC_SUBST(LIBMARIADB_PATH)
AC_SUBST(BUNDLE_MARIADB)
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
dnl =================================================================== dnl ===================================================================

View File

@ -12,7 +12,6 @@ $(eval $(call gb_Library_Library,mysqlcppconn))
$(eval $(call gb_Library_use_unpacked,mysqlcppconn,mysqlcppconn)) $(eval $(call gb_Library_use_unpacked,mysqlcppconn,mysqlcppconn))
$(eval $(call gb_Library_use_externals,mysqlcppconn, \ $(eval $(call gb_Library_use_externals,mysqlcppconn, \
mysql \
boost_headers \ boost_headers \
mariadb \ mariadb \
)) ))

View File

@ -26,4 +26,10 @@ ifeq ($(SYSTEM_MYSQL_CPPCONN),NO)
$(eval $(call gb_Extension_add_library,mysql-connector-ooo,mysqlcppconn)) $(eval $(call gb_Extension_add_library,mysql-connector-ooo,mysqlcppconn))
endif endif
ifeq ($(BUNDLE_MARIADB),YES)
$(eval $(call gb_Extension_add_files,mysql-connector-ooo,,\
$(LIBMARIADB_PATH)/$(LIBMARIADB) \
))
endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:

View File

@ -42,6 +42,8 @@ $(eval $(call gb_Library_add_defs,mysqlc,\
-DMARIADBC_VERSION_MICRO=$(MARIADBC_MICRO) \ -DMARIADBC_VERSION_MICRO=$(MARIADBC_MICRO) \
$(if $(filter NO,$(SYSTEM_MYSQL_CPPCONN)),\ $(if $(filter NO,$(SYSTEM_MYSQL_CPPCONN)),\
-DCPPCONN_LIB=\"$(call gb_Library_get_runtime_filename,mysqlcppconn)\") \ -DCPPCONN_LIB=\"$(call gb_Library_get_runtime_filename,mysqlcppconn)\") \
$(if $(filter YES,$(BUNDLE_MARIADB)),\
-DBUNDLE_MARIADB=\"$(LIBMARIADB)\") \
)) ))
$(eval $(call gb_Library_add_exception_objects,mysqlc,\ $(eval $(call gb_Library_add_exception_objects,mysqlc,\

View File

@ -143,9 +143,30 @@ void MysqlCDriver::impl_initCppConn_lck_throw()
#ifdef SYSTEM_MYSQL_CPPCONN #ifdef SYSTEM_MYSQL_CPPCONN
cppDriver = get_driver_instance(); cppDriver = get_driver_instance();
#else #else
#ifdef BUNDLE_MARIADB
if ( !m_bAttemptedLoadCConn )
{
const OUString sModuleName(BUNDLE_MARIADB);
m_hCConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
m_bAttemptedLoadCConn = true;
}
// attempted to load - was it successful?
if ( !m_hCConnModule )
{
OSL_FAIL( "MysqlCDriver::impl_initCppConn_lck_throw: could not load the " BUNDLE_MARIADB " library!");
throw SQLException(
OUString( "Unable to load the " BUNDLE_MARIADB " library." ),
*this,
OUString( "08001" ), // "unable to connect"
0,
Any()
);
}
#endif
if ( !m_bAttemptedLoadCppConn ) if ( !m_bAttemptedLoadCppConn )
{ {
const OUString sModuleName(CPPCONN_LIB ); const OUString sModuleName(CPPCONN_LIB);
m_hCppConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 ); m_hCppConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
m_bAttemptedLoadCppConn = true; m_bAttemptedLoadCppConn = true;
} }

View File

@ -63,6 +63,10 @@ namespace connectivity
// of all the Connection objects // of all the Connection objects
// for this Driver // for this Driver
#ifndef SYSTEM_MYSQL_CPPCONN #ifndef SYSTEM_MYSQL_CPPCONN
#ifdef BUNDLE_MARIADB
oslModule m_hCConnModule;
bool m_bAttemptedLoadCConn;
#endif
oslModule m_hCppConnModule; oslModule m_hCppConnModule;
bool m_bAttemptedLoadCppConn; bool m_bAttemptedLoadCppConn;
#endif #endif