On Windows x64 there are two ODBCs - one for each bitness. A 64-bit build gets 64-bit ODBC, and there is no provider named "Microsoft Excel Driver (*.xls)", no normally the test is simply skipped. But if MS Excel is installed, then it installs provider "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)", that was detected by previous code, but not used inside the VBAs. So, VBAs tried to use "Microsoft Excel Driver (*.xls)" unavailable to them. This patch allows using Excel's provider as well, thus allowing developer to test against 64-bit-specific regressions. However, the last test uses Microsoft.Jet.OLEDB.4.0 provider, that is unavailable on Win64. There are substitutions - Microsoft.ACE.OLEDB.12.0 and Microsoft.ACE.OLEDB.15.0, but there is no easy way to test if they are installed. Thus, that test is disabled on Win64 for now. Also, possible buffer overflow fixed, when byte count was passed to SQLGetInstalledDriversW instead of char count. Change-Id: Ib5c55251f0e92b3078a46aee173b5061439445ae Reviewed-on: https://gerrit.libreoffice.org/32019 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
31 lines
1.3 KiB
VB.net
31 lines
1.3 KiB
VB.net
Option VBASupport 1
|
|
Function doUnitTest(TestData as String, Driver as String) as String
|
|
Rem Ensure object assignment is by reference
|
|
Rem when object member is used ( as lhs )
|
|
Dim origTimeout As Long
|
|
Dim modifiedTimout As Long
|
|
Set cn = New ADODB.Connection
|
|
origTimeout = cn.CommandTimeout
|
|
modifiedTimeout = origTimeout * 2
|
|
cn.CommandTimeout = modifiedTimeout
|
|
Dim conStr As String
|
|
conStr = "Provider=MSDASQL;Driver={" & Driver & "};DBQ="
|
|
conStr = conStr & TestData & "; ReadOnly=False;"
|
|
cn.Open conStr
|
|
Set objCmd = New ADODB.Command
|
|
objCmd.ActiveConnection = cn
|
|
If objCmd.ActiveConnection.CommandTimeout <> modifiedTimeout Then
|
|
Rem if we copied the object by reference then we should have the
|
|
Rem modified timeout ( because we should be just pointing as cn )
|
|
doUnitTest = "FAIL expected modified timeout " & modifiedTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout
|
|
Exit Function
|
|
End If
|
|
cn.CommandTimeout = origTimeout ' restore timeout
|
|
Rem Double check objCmd.ActiveConnection is pointing to objCmd.ActiveConnection
|
|
If objCmd.ActiveConnection.CommandTimeout <> origTimeout Then
|
|
doUnitTest = "FAIL expected orignal timeout " & origTimeout & " but got " & objCmd.ActiveConnection.CommandTimeout
|
|
Exit Function
|
|
End If
|
|
doUnitTest = "OK" ' no error
|
|
End Function
|