Skip to content

Commit

Permalink
(try to) fix dbaccess firebird-related tests
Browse files Browse the repository at this point in the history
after 1c5c9b8

Move headless check into test and add missing component file for firebird...
Also check for ENABLE_FIREBIRD_SDBC...

Change-Id: I27ea9fb08ebcce701a54686a8986e5071a8bcf96
Reviewed-on: https://gerrit.libreoffice.org/53940
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
  • Loading branch information
reneengelhard authored and mikekaganski committed May 11, 2018
1 parent e57462c commit 752a1e2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions config_host/config_firebird.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Settings for Firebird
#ifndef CONFIG_FIREBIRD_H
#define CONFIG_FIREBIRD_H

#define ENABLE_FIREBIRD_SDBC 0

#define HAVE_FIREBIRD_30 0

#endif
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8769,6 +8769,7 @@ int fb_api_is_30(void) { return 0; }

BUILD_TYPE="$BUILD_TYPE FIREBIRD"
ENABLE_FIREBIRD_SDBC="TRUE"
AC_DEFINE(ENABLE_FIREBIRD_SDBC)
fi
fi
AC_SUBST(ENABLE_FIREBIRD_SDBC)
Expand Down
1 change: 1 addition & 0 deletions dbaccess/CppunitTest_dbaccess_RowSetClones.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_RowSetClones,\
comphelper/util/comphelp \
configmgr/source/configmgr \
connectivity/source/drivers/hsqldb/hsqldb \
$(if $(ENABLE_FIREBIRD_SDBC),connectivity/source/drivers/firebird/firebird_sdbc) \
connectivity/source/drivers/jdbc/jdbc \
connectivity/source/manager/sdbc2 \
dbaccess/util/dba \
Expand Down
1 change: 1 addition & 0 deletions dbaccess/CppunitTest_dbaccess_hsqldb_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_hsqldb_test,\
configmgr/source/configmgr \
connectivity/source/cpool/dbpool2 \
connectivity/source/drivers/hsqldb/hsqldb \
$(if $(ENABLE_FIREBIRD_SDBC),connectivity/source/drivers/firebird/firebird_sdbc) \
connectivity/source/drivers/jdbc/jdbc \
connectivity/source/manager/sdbc2 \
dbaccess/util/dba \
Expand Down
21 changes: 12 additions & 9 deletions dbaccess/source/core/dataaccess/datasource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
#include <iterator>
#include <set>

#include <config_firebird.h>

using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdb;
Expand Down Expand Up @@ -581,25 +583,24 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString

Reference< XDriverManager > xManager;

OUString sMigrEnvVal;
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
&sMigrEnvVal.pData);
#if ENABLE_FIREBIRD_SDBC
bool bNeedMigration = false;
if(m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb")
{
OUString sSalUseVclplugin;
osl_getEnvironment(OUString("SAL_USE_VCLPLUGIN").pData,
&sSalUseVclplugin.pData);
if(!sMigrEnvVal.isEmpty() || sSalUseVclplugin == "svp")
OUString sMigrEnvVal;
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
&sMigrEnvVal.pData);
if(!sMigrEnvVal.isEmpty())
bNeedMigration = true;
else
{
MigrationWarnDialog aWarnDlg{nullptr};
bNeedMigration = aWarnDlg.run() == RET_OK;
}
if (bNeedMigration)
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
}
if(bNeedMigration)
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
#endif

try {
xManager.set( ConnectionPool::create( m_pImpl->m_aContext ), UNO_QUERY_THROW );
Expand Down Expand Up @@ -712,6 +713,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) );
}

#if ENABLE_FIREBIRD_SDBC
if( bNeedMigration )
{
Reference< css::document::XDocumentSubStorageSupplier> xDocSup(
Expand All @@ -720,6 +722,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE) );
importer.importHsqlDatabase();
}
#endif

return xReturn;
}
Expand Down

0 comments on commit 752a1e2

Please sign in to comment.