tdf#99696 fix build error for 64bit Windows in unit tests using ADODB
This patch fixes the problem that the build for x64 fails in basic module on 64bit Windows installed 32bit Excel Application. New code checks the existance of ODBC driver for excel insted of the existance of Excel application(at this time the bitness of ODBC driver for excel would match that of building LibreOffice). What we need is probably not Excel Application but ODBC drivers for proper bitness. Change-Id: I62285eb2351f2022754fc34cb2d54db1bd9e8142 Reviewed-on: https://gerrit.libreoffice.org/25301 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
committed by
Michael Stahl
parent
46a987fe08
commit
d2a44e6270
@@ -42,6 +42,9 @@ $(eval $(call gb_CppunitTest_use_libraries,basic_macros, \
|
||||
ifeq ($(OS),WNT)
|
||||
$(eval $(call gb_CppunitTest_use_system_win32_libs,basic_macros, \
|
||||
oleaut32 \
|
||||
$(if $(filter 140,$(VCVER)),legacy_stdio_definitions) \
|
||||
odbc32 \
|
||||
odbccp32 \
|
||||
))
|
||||
endif
|
||||
|
||||
|
@@ -10,6 +10,13 @@
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <unotools/syslocaleoptions.hxx>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <string.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <odbcinst.h>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
namespace
|
||||
@@ -96,13 +103,26 @@ void VBATest::testMiscOLEStuff()
|
||||
bool bOk = false;
|
||||
if( xOLEFactory.is() )
|
||||
{
|
||||
uno::Reference< uno::XInterface > xExcel = xOLEFactory->createInstance( "Excel.Application" );
|
||||
uno::Reference< uno::XInterface > xADODB = xOLEFactory->createInstance( "ADODB.Connection" );
|
||||
bOk = xExcel.is() && xADODB.is();
|
||||
bOk = xADODB.is();
|
||||
}
|
||||
if ( !bOk )
|
||||
return; // can't do anything, skip test
|
||||
|
||||
sal_Unicode sBuf[1024*4];
|
||||
SQLGetInstalledDriversW( sBuf, sizeof( sBuf ), nullptr );
|
||||
|
||||
const sal_Unicode *pODBCDriverName = sBuf;
|
||||
bool bFound = false;
|
||||
for (; wcslen( pODBCDriverName ) != 0; pODBCDriverName += wcslen( pODBCDriverName ) + 1 ) {
|
||||
if ( wcsstr( pODBCDriverName, L"Microsoft Excel Driver" ) != nullptr ) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !bFound )
|
||||
return; // can't find ODBC driver needed test, so skip test
|
||||
|
||||
const char* macroSource[] = {
|
||||
"ole_ObjAssignNoDflt.vb",
|
||||
"ole_ObjAssignToNothing.vb",
|
||||
|
Reference in New Issue
Block a user