diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2014-05-16 14:55:36 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-05-16 16:55:29 +0000 |
commit | 6e60f1a69c87f5c443014f14027cca77a719586a (patch) | |
tree | dfc900614df00e88330ffdf0a7dab71abc724ffe /wizards/source/access2base/Application.xba | |
parent | 4a9a10d169653e42028d32ee8e260692ead8cc36 (diff) |
Access2Base - solve compatibility issues
1) AOO <> LO
"Append" is a reserved word in AOO Basic, not in LO
=> Append method replaced with Add
2) Windows <> Linux
ActiveConnection not ready under Windows for standalone forms when database is (user/password) protected
=> Connection may be postponed to first use of form
Change-Id: I8ba409191ba2a2a4c057480ec3287d7d48262073
Reviewed-on: https://gerrit.libreoffice.org/9372
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'wizards/source/access2base/Application.xba')
-rw-r--r-- | wizards/source/access2base/Application.xba | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/wizards/source/access2base/Application.xba b/wizards/source/access2base/Application.xba index 9de68cd4e110..13504648a37d 100644 --- a/wizards/source/access2base/Application.xba +++ b/wizards/source/access2base/Application.xba @@ -750,7 +750,7 @@ Dim vCurrentDoc() As Variant Dim oBaseContext As Object, sDbNames() As String, oBaseSource As Object Dim sDatabaseURL As String, oHandler As Object Dim vDbContainer As Variant, vDbContainers() As Variant, vDocContainer As Variant -Dim sFormName As String, oConnection As Object +Dim sFormName As String If IsEmpty(_A2B_) Then Call Application._RootInit() ' First use of Access2Base in current AOO/LibO session Set OpenConnection = Nothing @@ -844,29 +844,26 @@ Const cstThisSub = "OpenConnection" For i = 0 To oForms.Count - 1 vDbContainer = New DbContainer ' To make distinct entries !! sFormName = oForms.ElementNames(i) - Set oConnection = oForms.getByName(sFormName).ActiveConnection - If IsNull(oConnection) Then - Set vDbContainer.Database = Nothing ' Form is not data-aware - Else - Set vDbContainer.Database = New Database - Set vDbContainer.Database._This = vDbContainer.Database - With vDbContainer.Database - .FormName = sFormName - vDbContainer.FormName = sFormName - Set .Form = oForms.getByName(sFormName) - Set .Connection = oConnection - Set .MetaData = oConnection.MetaData - ._ReadOnly = oConnection.isReadOnly() - Set .Document = oComponent - .Title = oComponent.Title - .URL = .Form.DataSourceName - ._DbConnect = DBCONNECTFORM - Set vDbContainers(i) = vDbContainer - vDbContainers(i).FormName = sFormName + Set vDbContainer.Database = New Database + Set vDbContainer.Database._This = vDbContainer.Database + With vDbContainer.Database + .FormName = sFormName + vDbContainer.FormName = sFormName + Set .Form = oForms.getByName(sFormName) + Set .Connection = .Form.ActiveConnection ' Might be Nothing in Windows at AOO/LO startup (not met in Linux) + If Not IsNull(.Connection) Then + Set .MetaData = .Connection.MetaData + ._ReadOnly = .Connection.isReadOnly() TraceLog(TRACEANY, .MetaData.getDatabaseProductName() & " " & .MetaData.getDatabaseProductVersion, False) - TraceLog(TRACEANY, UCase(cstThisSub) & " " & .URL & " Form=" & vDbContainer.FormName, False) - End With - End If + End If + Set .Document = oComponent + .Title = oComponent.Title + .URL = .Form.DataSourceName + ._DbConnect = DBCONNECTFORM + Set vDbContainers(i) = vDbContainer + vDbContainers(i).FormName = sFormName + TraceLog(TRACEANY, UCase(cstThisSub) & " " & .URL & " Form=" & vDbContainer.FormName, False) + End With Next i vDocContainer.DbConnect = DBCONNECTFORM End Select |