[Libreoffice-commits] core.git: connectivity/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 3 12:12:50 UTC 2021
connectivity/source/drivers/ado/ADriver.cxx | 54 +++----
connectivity/source/drivers/dbase/DDriver.cxx | 9 -
connectivity/source/drivers/file/FDriver.cxx | 17 --
connectivity/source/drivers/flat/EDriver.cxx | 8 -
connectivity/source/drivers/hsqldb/HDriver.cxx | 47 +++---
connectivity/source/drivers/jdbc/JDriver.cxx | 7
connectivity/source/drivers/mysql_jdbc/YDriver.cxx | 15 --
connectivity/source/drivers/mysqlc/mysqlc_driver.cxx | 9 -
connectivity/source/drivers/odbc/ODriver.cxx | 139 +++++++++----------
9 files changed, 141 insertions(+), 164 deletions(-)
New commits:
commit f790fb5172bddba854448799081116aff96f2a42
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu Jun 3 09:15:01 2021 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Thu Jun 3 14:12:06 2021 +0200
Simplify some initializations in connectivity (2)
Change-Id: Iacbd1ccc58ebe6ef0a434e7334bc393d3457f889
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116638
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Jenkins
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index fcda87a9c0ab..e2d8cc2aa730 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -121,34 +121,32 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
impl_checkURL_throw(url);
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreDriverPrivileges"
- ,"Ignore the privileges from the database driver."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EscapeDateTime"
- ,"Escape date time format."
- ,false
- ,"true"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "TypeInfoSettings"
- ,"Defines how the type info of the database metadata should be manipulated."
- ,false
- ,OUString( )
- ,Sequence< OUString > ())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ Sequence< OUString > aBooleanValues{ "false", "true" };
+
+ return
+ {
+ {
+ "IgnoreDriverPrivileges",
+ "Ignore the privileges from the database driver.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "EscapeDateTime",
+ "Escape date time format.",
+ false,
+ "true",
+ aBooleanValues
+ },
+ {
+ "TypeInfoSettings",
+ "Defines how the type info of the database metadata should be manipulated.",
+ false,
+ {},
+ {}
+ }
+ };
}
return Sequence< DriverPropertyInfo >();
}
diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx
index 8e571a04e98e..8eae0013c940 100644
--- a/connectivity/source/drivers/dbase/DDriver.cxx
+++ b/connectivity/source/drivers/dbase/DDriver.cxx
@@ -80,11 +80,10 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
{
if ( acceptsURL(url) )
{
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { "0", "1" };
- DriverPropertyInfo aDriverInfo[] = {
+ return
+ {
{
"CharSet"
,"CharSet of the database."
@@ -107,8 +106,6 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
,aBoolean
}
};
-
- return Sequence< DriverPropertyInfo >(aDriverInfo, std::size(aDriverInfo));
}
SharedResources aResources;
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index 5c251a402b5b..c5afbd75f7e3 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -98,25 +98,23 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const OUSt
if ( acceptsURL(url) )
{
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { "0", "1" };
- std::vector< DriverPropertyInfo > aDriverInfo
+ return
{
{
"CharSet"
,"CharSet of the database."
,false
- ,OUString()
- ,Sequence< OUString >()
+ ,{}
+ ,{}
},
{
"Extension"
,"Extension of the file format."
,false
,".*"
- ,Sequence< OUString >()
+ ,{}
},
{
"ShowDeleted"
@@ -143,11 +141,10 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const OUSt
"URL"
,"The URL of the database document which is used to create an absolute path."
,false
- ,OUString()
- ,Sequence< OUString >()
+ ,{}
+ ,{}
}
};
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
} // if ( acceptsURL(url) )
{
::connectivity::SharedResources aResources;
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
index 6ab16eabee0e..29492895510e 100644
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ b/connectivity/source/drivers/flat/EDriver.cxx
@@ -82,9 +82,7 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
{
if ( acceptsURL(url) )
{
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { "0", "1" };
std::vector< DriverPropertyInfo > aDriverInfo
{
@@ -92,8 +90,8 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString
"FieldDelimiter"
,"Field separator."
,false
- ,OUString()
- ,Sequence< OUString >()
+ ,{}
+ ,{}
},
{
"HeaderLine"
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 8ac7db04a367..e4d4e399ba2a 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -393,29 +393,30 @@ namespace connectivity
{
if ( !acceptsURL(url) )
return Sequence< DriverPropertyInfo >();
- std::vector< DriverPropertyInfo > aDriverInfo;
- aDriverInfo.push_back(DriverPropertyInfo(
- "Storage"
- ,"Defines the storage where the database will be stored."
- ,true
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "URL"
- ,"Defines the url of the data source."
- ,true
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "AutoRetrievingStatement"
- ,"Defines the statement which will be executed to retrieve auto increment values."
- ,false
- ,"CALL IDENTITY()"
- ,Sequence< OUString >())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ return
+ {
+ {
+ "Storage",
+ "Defines the storage where the database will be stored.",
+ true,
+ {},
+ {}
+ },
+ {
+ "URL",
+ "Defines the url of the data source.",
+ true,
+ {},
+ {}
+ },
+ {
+ "AutoRetrievingStatement",
+ "Defines the statement which will be executed to retrieve auto increment values.",
+ false,
+ "CALL IDENTITY()",
+ {}
+ }
+ };
}
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
index beaa7a07ab1a..f294d30b4937 100644
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ b/connectivity/source/drivers/jdbc/JDriver.cxx
@@ -108,11 +108,9 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const
{
if ( acceptsURL(url) )
{
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
+ Sequence< OUString > aBooleanValues{ "false", "true" };
- std::vector< DriverPropertyInfo > aDriverInfo
+ return
{
{
"JavaDriverClass"
@@ -206,7 +204,6 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const
,Sequence< OUString > ()
}
};
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
}
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index e88da37c53f7..0225381c74b3 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -280,19 +280,16 @@ sal_Bool SAL_CALL ODriverDelegator::acceptsURL(const OUString& url)
Sequence<DriverPropertyInfo> SAL_CALL
ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyValue>& info)
{
- std::vector<DriverPropertyInfo> aDriverInfo;
if (!acceptsURL(url))
return Sequence<DriverPropertyInfo>();
- Sequence<OUString> aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence<OUString> aBoolean{ "0", "1" };
- aDriverInfo.push_back(DriverPropertyInfo("CharSet", "CharSet of the database.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo("SuppressVersionColumns",
- "Display version columns (when available).", false,
- "0", aBoolean));
+ std::vector<DriverPropertyInfo> aDriverInfo{
+ { "CharSet", "CharSet of the database.", false, {}, {} },
+ { "SuppressVersionColumns", "Display version columns (when available).", false, "0",
+ aBoolean }
+ };
const T_DRIVERTYPE eType = lcl_getDriverType(url);
if (eType == T_DRIVERTYPE::Jdbc)
{
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
index 6e4f3d9050d3..5e5b83625e90 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx
@@ -103,13 +103,8 @@ MysqlCDriver::getPropertyInfo(const OUString& url, const Sequence<PropertyValue>
{
if (acceptsURL(url))
{
- ::std::vector<DriverPropertyInfo> aDriverInfo;
-
- aDriverInfo.push_back(DriverPropertyInfo("Hostname", "Name of host", true, "localhost",
- Sequence<OUString>()));
- aDriverInfo.push_back(
- DriverPropertyInfo("Port", "Port", true, "3306", Sequence<OUString>()));
- return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
+ return { { "Hostname", "Name of host", true, "localhost", {} },
+ { "Port", "Port", true, "3306", {} } };
}
return Sequence<DriverPropertyInfo>();
diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx
index 5bdd9e5d0461..df7b3fd206b8 100644
--- a/connectivity/source/drivers/odbc/ODriver.cxx
+++ b/connectivity/source/drivers/odbc/ODriver.cxx
@@ -103,77 +103,74 @@ Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const OUStr
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< OUString > aBooleanValues(2);
- aBooleanValues[0] = "false";
- aBooleanValues[1] = "true";
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "CharSet"
- ,"CharSet of the database."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "UseCatalog"
- ,"Use catalog for file-based databases."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "SystemDriverSettings"
- ,"Driver settings."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "ParameterNameSubstitution"
- ,"Change named parameters with '?'."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IgnoreDriverPrivileges"
- ,"Ignore the privileges from the database driver."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "IsAutoRetrievingEnabled"
- ,"Retrieve generated values."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "AutoRetrievingStatement"
- ,"Auto-increment statement."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "GenerateASBeforeCorrelationName"
- ,"Generate AS before table correlation names."
- ,false
- ,"false"
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "EscapeDateTime"
- ,"Escape date time format."
- ,false
- ,"true"
- ,aBooleanValues)
- );
-
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ Sequence< OUString > aBooleanValues{ "false", "true" };
+
+ return
+ {
+ {
+ "CharSet",
+ "CharSet of the database.",
+ false,
+ {},
+ {}
+ },
+ {
+ "UseCatalog",
+ "Use catalog for file-based databases.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "SystemDriverSettings",
+ "Driver settings.",
+ false,
+ {},
+ {}
+ },
+ {
+ "ParameterNameSubstitution",
+ "Change named parameters with '?'.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "IgnoreDriverPrivileges",
+ "Ignore the privileges from the database driver.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "IsAutoRetrievingEnabled",
+ "Retrieve generated values.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "AutoRetrievingStatement",
+ "Auto-increment statement.",
+ false,
+ {},
+ {}
+ },
+ {
+ "GenerateASBeforeCorrelationName",
+ "Generate AS before table correlation names.",
+ false,
+ "false",
+ aBooleanValues
+ },
+ {
+ "EscapeDateTime",
+ "Escape date time format.",
+ false,
+ "true",
+ aBooleanValues
+ }
+ };
}
::connectivity::SharedResources aResources;
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
More information about the Libreoffice-commits
mailing list