connectivity/inc/strings.hxx                   |  112 ++++++++++++-------------
 connectivity/source/commontools/dbtools2.cxx   |    7 +
 connectivity/source/drivers/evoab2/NDriver.hxx |    2 
 connectivity/source/inc/dbase/DIndex.hxx       |    2 
 include/connectivity/dbtools.hxx               |    4 
 5 files changed, 68 insertions(+), 59 deletions(-)

New commits:
commit dc4ee83823d6cb94a507e2ebb9cc8eb56a6a3fa6
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Nov 24 13:11:22 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Nov 24 13:56:23 2021 +0100

    loplugin:stringliteraldefine in connectivity
    
    Change-Id: I6b2528c684fe56a114959a1d26101a882eee2106
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125759
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/inc/strings.hxx b/connectivity/inc/strings.hxx
index 5a08f67c5114..ffd28ac63706 100644
--- a/connectivity/inc/strings.hxx
+++ b/connectivity/inc/strings.hxx
@@ -12,63 +12,63 @@
 // = log messages for the JDBC driver
 
 #define STR_LOG_DRIVER_CONNECTING_URL           "jdbcBridge: connecting to URL 
'$1$'"
-#define STR_LOG_DRIVER_SUCCESS                  "jdbcBridge: success"
-#define STR_LOG_CREATE_STATEMENT                "c$1$: creating statement"
-#define STR_LOG_CREATED_STATEMENT_ID            "c$1$: created statement, 
statement id: s$2$"
-#define STR_LOG_PREPARE_STATEMENT               "c$1$: preparing statement: 
$2$"
-#define STR_LOG_PREPARED_STATEMENT_ID           "c$1$: prepared statement, 
statement id: s$2$"
-#define STR_LOG_PREPARE_CALL                    "c$1$: preparing call: $2$"
-#define STR_LOG_PREPARED_CALL_ID                "c$1$: prepared call, 
statement id: s$2$"
-#define STR_LOG_NATIVE_SQL                      "c$1$: native SQL: $2$ -> $3$"
-#define STR_LOG_LOADING_DRIVER                  "c$1$: attempting to load 
driver class $2$"
-#define STR_LOG_NO_DRIVER_CLASS                 "c$1$: no Java Driver Class 
was provided"
-#define STR_LOG_CONN_SUCCESS                    "c$1$: success"
-#define STR_LOG_NO_SYSTEM_CONNECTION            "c$1$: JDBC driver did not 
provide a JDBC connection"
-#define STR_LOG_GOT_JDBC_CONNECTION             "c$1$: obtained a JDBC 
connection for $2$"
-#define STR_LOG_SHUTDOWN_CONNECTION             "c$1$: shutting down 
connection"
-#define STR_LOG_GENERATED_VALUES                "s$1$: retrieving generated 
values"
-#define STR_LOG_GENERATED_VALUES_FALLBACK       "s$1$: getGeneratedValues: 
falling back to statement: $2$"
-#define STR_LOG_EXECUTE_STATEMENT               "s$1$: going to execute: $2$"
-#define STR_LOG_EXECUTE_QUERY                   "s$1$: going to execute query: 
$2$"
-#define STR_LOG_CLOSING_STATEMENT               "s$1$: closing/disposing 
statement"
-#define STR_LOG_EXECUTE_UPDATE                  "s$1$: going to execute 
update: $2$"
-#define STR_LOG_UPDATE_COUNT                    "s$1$: update count: $2$"
-#define STR_LOG_RESULT_SET_CONCURRENCY          "s$1$: going to set result set 
concurrency: $2$"
-#define STR_LOG_RESULT_SET_TYPE                 "s$1$: going to set result set 
type: $2$"
-#define STR_LOG_FETCH_DIRECTION                 "s$1$: fetch direction: $2$"
-#define STR_LOG_FETCH_SIZE                      "s$1$: fetch size: $2$"
-#define STR_LOG_SET_ESCAPE_PROCESSING           "s$1$: going to set escape 
processing: $2$"
-#define STR_LOG_EXECUTING_PREPARED              "s$1$: executing previously 
prepared statement"
-#define STR_LOG_EXECUTING_PREPARED_UPDATE       "s$1$: executing previously 
prepared update statement"
-#define STR_LOG_EXECUTING_PREPARED_QUERY        "s$1$: executing previously 
prepared query"
-#define STR_LOG_STRING_PARAMETER                "s$1$: parameter no. $2$: 
type: string; value: $3$"
-#define STR_LOG_BOOLEAN_PARAMETER               "s$1$: parameter no. $2$: 
type: boolean; value: $3$"
-#define STR_LOG_BYTE_PARAMETER                  "s$1$: parameter no. $2$: 
type: byte; value: $3$"
-#define STR_LOG_DATE_PARAMETER                  "s$1$: parameter no. $2$: 
type: date; value: $3$"
-#define STR_LOG_TIME_PARAMETER                  "s$1$: parameter no. $2$: 
type: time; value: $3$"
-#define STR_LOG_TIMESTAMP_PARAMETER             "s$1$: parameter no. $2$: 
type: timestamp; value: $3$"
-#define STR_LOG_DOUBLE_PARAMETER                "s$1$: parameter no. $2$: 
type: double; value: $3$"
-#define STR_LOG_FLOAT_PARAMETER                 "s$1$: parameter no. $2$: 
type: float; value: $3$"
-#define STR_LOG_INT_PARAMETER                   "s$1$: parameter no. $2$: 
type: int; value: $3$"
-#define STR_LOG_LONG_PARAMETER                  "s$1$: parameter no. $2$: 
type: long; value: $3$"
-#define STR_LOG_NULL_PARAMETER                  "s$1$: parameter no. $2$: 
sql-type: $3$; value: null"
-#define STR_LOG_OBJECT_NULL_PARAMETER           "s$1$: parameter no. $2$: 
setting to null"
-#define STR_LOG_SHORT_PARAMETER                 "s$1$: parameter no. $2$: 
type: short; value: $3$"
-#define STR_LOG_BYTES_PARAMETER                 "s$1$: parameter no. $2$: 
type: byte[]"
-#define STR_LOG_CHARSTREAM_PARAMETER            "s$1$: parameter no. $2$: 
type: character stream"
-#define STR_LOG_BINARYSTREAM_PARAMETER          "s$1$: parameter no. $2$: 
type: binary stream"
-#define STR_LOG_CLEAR_PARAMETERS                "s$1$: clearing all parameters"
-#define STR_LOG_META_DATA_METHOD                "c$1$: entering 
XDatabaseMetaData::$2$"
-#define STR_LOG_META_DATA_METHOD_ARG1           "c$1$: entering 
XDatabaseMetaData::$2$( '$3$' )"
-#define STR_LOG_META_DATA_METHOD_ARG2           "c$1$: entering 
XDatabaseMetaData::$2$( '$3$', '$4$' )"
-#define STR_LOG_META_DATA_METHOD_ARG3           "c$1$: entering 
XDatabaseMetaData::$2$( '$3$', '$4$', '$5$' )"
-#define STR_LOG_META_DATA_METHOD_ARG4           "c$1$: entering 
XDatabaseMetaData::$2$( '$3$', '$4$', '$5$', '$6$' )"
-#define STR_LOG_META_DATA_RESULT                "c$1$: leaving 
XDatabaseMetaData::$2$: success-with-result: $3$"
-#define STR_LOG_META_DATA_SUCCESS               "c$1$: leaving 
XDatabaseMetaData::$2$: success"
+inline constexpr OUStringLiteral STR_LOG_DRIVER_SUCCESS = u"jdbcBridge: 
success";
+inline constexpr OUStringLiteral STR_LOG_CREATE_STATEMENT = u"c$1$: creating 
statement";
+inline constexpr OUStringLiteral STR_LOG_CREATED_STATEMENT_ID = u"c$1$: 
created statement, statement id: s$2$";
+inline constexpr OUStringLiteral STR_LOG_PREPARE_STATEMENT = u"c$1$: preparing 
statement: $2$";
+inline constexpr OUStringLiteral STR_LOG_PREPARED_STATEMENT_ID = u"c$1$: 
prepared statement, statement id: s$2$";
+inline constexpr OUStringLiteral STR_LOG_PREPARE_CALL = u"c$1$: preparing 
call: $2$";
+inline constexpr OUStringLiteral STR_LOG_PREPARED_CALL_ID = u"c$1$: prepared 
call, statement id: s$2$";
+inline constexpr OUStringLiteral STR_LOG_NATIVE_SQL = u"c$1$: native SQL: $2$ 
-> $3$";
+inline constexpr OUStringLiteral STR_LOG_LOADING_DRIVER = u"c$1$: attempting 
to load driver class $2$";
+inline constexpr OUStringLiteral STR_LOG_NO_DRIVER_CLASS = u"c$1$: no Java 
Driver Class was provided";
+inline constexpr OUStringLiteral STR_LOG_CONN_SUCCESS = u"c$1$: success";
+inline constexpr OUStringLiteral STR_LOG_NO_SYSTEM_CONNECTION = u"c$1$: JDBC 
driver did not provide a JDBC connection";
+inline constexpr OUStringLiteral STR_LOG_GOT_JDBC_CONNECTION = u"c$1$: 
obtained a JDBC connection for $2$";
+inline constexpr OUStringLiteral STR_LOG_SHUTDOWN_CONNECTION = u"c$1$: 
shutting down connection";
+inline constexpr OUStringLiteral STR_LOG_GENERATED_VALUES = u"s$1$: retrieving 
generated values";
+inline constexpr OUStringLiteral STR_LOG_GENERATED_VALUES_FALLBACK = u"s$1$: 
getGeneratedValues: falling back to statement: $2$";
+inline constexpr OUStringLiteral STR_LOG_EXECUTE_STATEMENT = u"s$1$: going to 
execute: $2$";
+inline constexpr OUStringLiteral STR_LOG_EXECUTE_QUERY = u"s$1$: going to 
execute query: $2$";
+inline constexpr OUStringLiteral STR_LOG_CLOSING_STATEMENT = u"s$1$: 
closing/disposing statement";
+inline constexpr OUStringLiteral STR_LOG_EXECUTE_UPDATE = u"s$1$: going to 
execute update: $2$";
+inline constexpr OUStringLiteral STR_LOG_UPDATE_COUNT = u"s$1$: update count: 
$2$";
+inline constexpr OUStringLiteral STR_LOG_RESULT_SET_CONCURRENCY = u"s$1$: 
going to set result set concurrency: $2$";
+inline constexpr OUStringLiteral STR_LOG_RESULT_SET_TYPE = u"s$1$: going to 
set result set type: $2$";
+inline constexpr OUStringLiteral STR_LOG_FETCH_DIRECTION = u"s$1$: fetch 
direction: $2$";
+inline constexpr OUStringLiteral STR_LOG_FETCH_SIZE = u"s$1$: fetch size: $2$";
+inline constexpr OUStringLiteral STR_LOG_SET_ESCAPE_PROCESSING = u"s$1$: going 
to set escape processing: $2$";
+inline constexpr OUStringLiteral STR_LOG_EXECUTING_PREPARED = u"s$1$: 
executing previously prepared statement";
+inline constexpr OUStringLiteral STR_LOG_EXECUTING_PREPARED_UPDATE = u"s$1$: 
executing previously prepared update statement";
+inline constexpr OUStringLiteral STR_LOG_EXECUTING_PREPARED_QUERY = u"s$1$: 
executing previously prepared query";
+inline constexpr OUStringLiteral STR_LOG_STRING_PARAMETER = u"s$1$: parameter 
no. $2$: type: string; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_BOOLEAN_PARAMETER = u"s$1$: parameter 
no. $2$: type: boolean; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_BYTE_PARAMETER = u"s$1$: parameter 
no. $2$: type: byte; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_DATE_PARAMETER = u"s$1$: parameter 
no. $2$: type: date; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_TIME_PARAMETER = u"s$1$: parameter 
no. $2$: type: time; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_TIMESTAMP_PARAMETER = u"s$1$: 
parameter no. $2$: type: timestamp; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_DOUBLE_PARAMETER = u"s$1$: parameter 
no. $2$: type: double; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_FLOAT_PARAMETER = u"s$1$: parameter 
no. $2$: type: float; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_INT_PARAMETER = u"s$1$: parameter no. 
$2$: type: int; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_LONG_PARAMETER = u"s$1$: parameter 
no. $2$: type: long; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_NULL_PARAMETER = u"s$1$: parameter 
no. $2$: sql-type: $3$; value: null";
+inline constexpr OUStringLiteral STR_LOG_OBJECT_NULL_PARAMETER = u"s$1$: 
parameter no. $2$: setting to null";
+inline constexpr OUStringLiteral STR_LOG_SHORT_PARAMETER = u"s$1$: parameter 
no. $2$: type: short; value: $3$";
+inline constexpr OUStringLiteral STR_LOG_BYTES_PARAMETER = u"s$1$: parameter 
no. $2$: type: byte[]";
+inline constexpr OUStringLiteral STR_LOG_CHARSTREAM_PARAMETER = u"s$1$: 
parameter no. $2$: type: character stream";
+inline constexpr OUStringLiteral STR_LOG_BINARYSTREAM_PARAMETER = u"s$1$: 
parameter no. $2$: type: binary stream";
+inline constexpr OUStringLiteral STR_LOG_CLEAR_PARAMETERS = u"s$1$: clearing 
all parameters";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_METHOD = u"c$1$: entering 
XDatabaseMetaData::$2$";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_METHOD_ARG1 = u"c$1$: 
entering XDatabaseMetaData::$2$( '$3$' )";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_METHOD_ARG2 = u"c$1$: 
entering XDatabaseMetaData::$2$( '$3$', '$4$' )";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_METHOD_ARG3 = u"c$1$: 
entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$' )";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_METHOD_ARG4 = u"c$1$: 
entering XDatabaseMetaData::$2$( '$3$', '$4$', '$5$', '$6$' )";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_RESULT = u"c$1$: leaving 
XDatabaseMetaData::$2$: success-with-result: $3$";
+inline constexpr OUStringLiteral STR_LOG_META_DATA_SUCCESS = u"c$1$: leaving 
XDatabaseMetaData::$2$: success";
 #define STR_LOG_THROWING_EXCEPTION              "SQLException to be thrown: 
message: '$1$', SQLState: $2$, ErrorCode: $3$"
-#define STR_LOG_SETTING_SYSTEM_PROPERTY         "setting system property 
\"$1$\" to value \"$2$\""
+inline constexpr OUStringLiteral STR_LOG_SETTING_SYSTEM_PROPERTY = u"setting 
system property \"$1$\" to value \"$2$\"";
 
-#define STR_DB_NOT_CONNECTED_STATE              "08003"
-#define STR_DATA_CANNOT_SELECT_UNFILTERED_STATE "IM001"
+inline constexpr OUStringLiteral STR_DB_NOT_CONNECTED_STATE = u"08003";
+inline constexpr OUStringLiteral STR_DATA_CANNOT_SELECT_UNFILTERED_STATE = 
u"IM001";
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/connectivity/source/commontools/dbtools2.cxx 
b/connectivity/source/commontools/dbtools2.cxx
index 5f07a272cec2..a04015754374 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -573,6 +573,11 @@ Reference<XPropertySet> createSDBCXColumn(const 
Reference<XPropertySet>& _xTable
 
 
 bool getBooleanDataSourceSetting( const Reference< XConnection >& 
_rxConnection, const char* _pAsciiSettingName )
+{
+    return getBooleanDataSourceSetting(_rxConnection, 
OUString::createFromAscii( _pAsciiSettingName ));
+}
+
+bool getBooleanDataSourceSetting( const Reference< XConnection >& 
_rxConnection, const OUString & rSettingName )
 {
     bool bValue( false );
     try
@@ -585,7 +590,7 @@ bool getBooleanDataSourceSetting( const Reference< 
XConnection >& _rxConnection,
                 xDataSourceProperties->getPropertyValue("Settings"),
                 UNO_QUERY_THROW
             );
-            OSL_VERIFY( xSettings->getPropertyValue( 
OUString::createFromAscii( _pAsciiSettingName ) ) >>= bValue );
+            OSL_VERIFY( xSettings->getPropertyValue( rSettingName ) >>= bValue 
);
         }
     }
     catch( const Exception& )
diff --git a/connectivity/source/drivers/evoab2/NDriver.hxx 
b/connectivity/source/drivers/evoab2/NDriver.hxx
index 9015add76be8..9d3b57fa7988 100644
--- a/connectivity/source/drivers/evoab2/NDriver.hxx
+++ b/connectivity/source/drivers/evoab2/NDriver.hxx
@@ -28,7 +28,7 @@
 #include <cppuhelper/compbase.hxx>
 #include <connectivity/CommonTools.hxx>
 
-#define EVOAB_DRIVER_IMPL_NAME  "com.sun.star.comp.sdbc.evoab.OEvoabDriver"
+inline constexpr OUStringLiteral EVOAB_DRIVER_IMPL_NAME = 
u"com.sun.star.comp.sdbc.evoab.OEvoabDriver";
 
 namespace connectivity::evoab
     {
diff --git a/connectivity/source/inc/dbase/DIndex.hxx 
b/connectivity/source/inc/dbase/DIndex.hxx
index e936a7e37c65..a75ce918ff6c 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -23,7 +23,7 @@
 #include <dbase/DTable.hxx>
 #include <dbase/dindexnode.hxx>
 
-#define dBASE_III_GROUP "dBase III"
+inline constexpr OStringLiteral dBASE_III_GROUP = "dBase III";
 
 namespace connectivity::dbase
     {
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
index 505228a9931a..941a978aee69 100644
--- a/include/connectivity/dbtools.hxx
+++ b/include/connectivity/dbtools.hxx
@@ -321,6 +321,10 @@ namespace dbtools
             const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
             const char* _pAsciiSettingName
         );
+    OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+            const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+            const OUString& rSettingName
+        );
 
     /** check if a specific property is enabled in the info sequence
         @deprecated

Reply via email to