summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-08 19:12:05 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-08 19:37:30 +0100
commitbf38dd800e6e4e820a0cef84e082d9bcee8e8133 (patch)
tree9b766a78f9c3b11d5877d1056504b14112932b3f
parentFix wrong missing variable check (diff)
downloadcore-bf38dd800e6e4e820a0cef84e082d9bcee8e8133.tar.gz
core-bf38dd800e6e4e820a0cef84e082d9bcee8e8133.zip
Simplify some Optional handling
Change-Id: I2ba326faa47531c1d7c71ac05a8dd211cebac199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126513 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--wizards/source/tools/Misc.xba19
1 files changed, 6 insertions, 13 deletions
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