wizards/source/tools/Misc.xba |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit bf38dd800e6e4e820a0cef84e082d9bcee8e8133
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Dec 8 19:12:05 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Dec 8 19:37:30 2021 +0100

    Simplify some Optional handling
    
    Change-Id: I2ba326faa47531c1d7c71ac05a8dd211cebac199
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126513
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
index 2f06e92a5938..9aa6d2e2f380 100644
--- a/wizards/source/tools/Misc.xba
+++ b/wizards/source/tools/Misc.xba
@@ -58,7 +58,7 @@ End Function
 
 
 &apos; Connects to a registered Database
-Function ConnecttoDatabase(DSName as String, UserID as String, Password as 
String, Optional Propertylist(), Optional DriverProperties() as New 
com.sun.star.beans.PropertyValue)
+Function ConnectToDatabase(DSName as String, UserID as String, Password as 
String, Optional Propertylist(), Optional DriverProperties() as New 
com.sun.star.beans.PropertyValue)
 Dim oDBContext as Object
 Dim oDBSource as Object
 &apos; On Local Error Goto NOCONNECTION
@@ -68,11 +68,7 @@ Dim oDBSource as Object
                ConnectToDatabase = oDBSource.GetConnection(UserID, Password)
        Else
                If Not IsMissing(Propertylist()) Then
-                       If Not IsMissing(DriverProperties()) Then
-                               RegisterNewDataSource(DSName, PropertyList(), 
DriverProperties())
-                       Else
-                               RegisterNewDataSource(DSName, PropertyList())
-                       End If
+                       RegisterNewDataSource(DSName, PropertyList(), 
DriverProperties())
                        oDBSource = oDBContext.GetByName(DSName)
                        ConnectToDatabase = oDBSource.GetConnection(UserID, 
Password)
                Else
@@ -114,14 +110,11 @@ Dim aNodePath(0) as new com.sun.star.beans.PropertyValue
        oConfigProvider = 
createUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot;)
        aNodePath(0).Name = &quot;nodepath&quot;
        aNodePath(0).Value = sKeyName
-       If IsMissing(bForUpdate) Then
-               GetRegistryKeyContent() = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;,
 aNodePath())
+       If IsMissing(bForUpdate) Then bForUpdate = False
+       If bForUpdate Then
+               GetRegistryKeyContent() = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;,
 aNodePath())
        Else
-               If bForUpdate Then
-                       GetRegistryKeyContent() = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;,
 aNodePath())
-               Else
-                       GetRegistryKeyContent() = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;,
 aNodePath())
-               End If
+               GetRegistryKeyContent() = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;,
 aNodePath())
        End If
 End Function
 

Reply via email to