Files
libreoffice/basic/qa/vba_tests/ole_dfltObjDflMethod.vb
Mike Kaganski 5ecd7ebbdf Partially fix VBATest::testMiscOLEStuff for Win64
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>
2016-12-14 19:03:56 +00:00

25 lines
716 B
VB.net

Option VBASupport 1
Option Explicit
Rem Test accessing an object that has default object member
Rem which in turn has a default member that is a method
Function doUnitTest(TestData As String, Driver as String) As String
doUnitTest = "Begin"
Dim modifiedTimout As Long
Dim cnn1 As New ADODB.Connection
Dim rst1 As New ADODB.Recordset
Dim conStr As String
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & TestData & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes"";"
rst1.Open "SELECT * FROM [Sheet1$];", cnn1, adOpenStatic, adLockReadOnly
Dim val
val = rst1("FirstName")
If val = "Paddy" Then
doUnitTest = "OK"
Else
doUnitTest = "Failed, expected 'Paddy' got " & val
End If
End Function