[Libreoffice-commits] core.git: connectivity/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 8 12:32:12 UTC 2021


 connectivity/source/drivers/ado/AColumn.cxx               |   17 ++++++++++----
 connectivity/source/drivers/ado/AColumns.cxx              |    5 +++-
 connectivity/source/drivers/ado/AConnection.cxx           |   11 ++++++---
 connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx |    7 ++++-
 connectivity/source/drivers/ado/AResultSetMetaData.cxx    |   11 ++++++---
 connectivity/source/drivers/ado/ATable.cxx                |    6 ++++
 6 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit 87f0786156105ef721af069c636b7814a7a39abc
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jan 8 11:04:53 2021 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jan 8 13:31:29 2021 +0100

    Fix uses of OTools::get/putValue with string arguments
    
    ...after 723a2623bd11c51d506873862893ee4009caaab1 "Use string view here".  My
    clang-cl build's
    
    > connectivity/source/drivers/ado/AColumn.cxx(164,62): error: implicit conversion of constant &u"Autoincrement"[0] of type 'const char16_t *' to 'bool'; use 'true' instead [loplugin:consttobool]
    >                 OTools::putValue(m_aColumn.get_Properties(), u"Autoincrement", getBOOL(rValue));
    >                                                              ^~~~~~~~~~~~~~~~
    > connectivity/source/drivers/ado/AColumn.cxx(239,62): error: implicit conversion of constant &u"Autoincrement"[0] of type 'const char16_t *' to 'bool'; use 'true' instead [loplugin:consttobool]
    >                 m_IsAutoIncrement = OTools::getValue(aProps, u"Autoincrement").getBool();
    >                                                              ^~~~~~~~~~~~~~~~
    
    etc. revealed that those arguments were now silently picking the
    OLEVariant(bool) overload.
    
    Change-Id: I83f0d790591d6be9b84fb6263747085dc7bd94d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108962
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 02f2589df251..c73e2cb245af 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <ado/AColumn.hxx>
 #include <ado/AConnection.hxx>
 #include <ado/Awrapado.hxx>
@@ -161,7 +165,9 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
                 break;
 
             case PROPERTY_ID_ISAUTOINCREMENT:
-                OTools::putValue(m_aColumn.get_Properties(), u"Autoincrement", getBOOL(rValue));
+                OTools::putValue(
+                    m_aColumn.get_Properties(), std::u16string_view(u"Autoincrement"),
+                    getBOOL(rValue));
                 break;
 
             case PROPERTY_ID_IM001:
@@ -236,11 +242,14 @@ void OAdoColumn::fillPropertyValues()
 
             if ( aProps.IsValid() )
             {
-                m_IsAutoIncrement = OTools::getValue(aProps, u"Autoincrement").getBool();
+                m_IsAutoIncrement
+                    = OTools::getValue(aProps, std::u16string_view(u"Autoincrement")).getBool();
 
-                m_Description = OTools::getValue(aProps, u"Description").getString();
+                m_Description
+                    = OTools::getValue(aProps, std::u16string_view(u"Description")).getString();
 
-                m_DefaultValue = OTools::getValue(aProps, u"Default").getString();
+                m_DefaultValue
+                    = OTools::getValue(aProps, std::u16string_view(u"Default")).getString();
             }
         }
     }
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index 13ab128972dc..0ade4a071c45 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -30,6 +30,7 @@
 #include <comphelper/types.hxx>
 #include <connectivity/dbexception.hxx>
 #include <algorithm>
+#include <string_view>
 #include <strings.hrc>
 
 using namespace connectivity::ado;
@@ -103,7 +104,9 @@ sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPro
             bool bAutoIncrement = false;
             pColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
             if ( bAutoIncrement )
-                OTools::putValue(aAddedColumn.get_Properties(), u"Autoincrement", bAutoIncrement);
+                OTools::putValue(
+                    aAddedColumn.get_Properties(), std::u16string_view(u"Autoincrement"),
+                    bAutoIncrement);
 
             if ( aFind != pTypeInfoMap->end() &&  aColumn.get_Type() != aAddedColumn.get_Type() ) // change column type if necessary
                 aColumn.put_Type(aFind->first);
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 74a573687903..6a26265c4d42 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <ado/AConnection.hxx>
 #include <ado/ADatabaseMetaData.hxx>
 #include <ado/ADriver.hxx>
@@ -133,8 +137,9 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
             WpADOProperties aProps = m_pAdoConnection->get_Properties();
             if(aProps.IsValid())
             {
-                OTools::putValue(aProps, u"Jet OLEDB:ODBC Parsing", true);
-                OLEVariant aVar(OTools::getValue(aProps, u"Jet OLEDB:Engine Type"));
+                OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
+                OLEVariant aVar(
+                    OTools::getValue(aProps, std::u16string_view(u"Jet OLEDB:Engine Type")));
                 if(!aVar.isNull() && !aVar.isEmpty())
                     m_nEngineType = aVar.getInt32();
             }
@@ -198,7 +203,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql )
     WpADOProperties aProps = m_pAdoConnection->get_Properties();
     if(aProps.IsValid())
     {
-        OTools::putValue(aProps, u"Jet OLEDB:ODBC Parsing", true);
+        OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
         WpADOCommand aCommand;
         aCommand.Create();
         aCommand.put_ActiveConnection(static_cast<IDispatch*>(*m_pAdoConnection));
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
index eb9692d9339d..3b39585c6f00 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <ado/ADatabaseMetaData.hxx>
 #include <ado/ADatabaseMetaDataResultSetMetaData.hxx>
 #include <ado/Awrapado.hxx>
@@ -559,7 +563,8 @@ void OAdoTable::fillPropertyValues()
         {
             WpADOProperties aProps = m_aTable.get_Properties();
             if(aProps.IsValid())
-                m_Description = OTools::getValue(aProps, u"Description").getString();
+                m_Description
+                    = OTools::getValue(aProps, std::u16string_view(u"Description")).getString();
         }
     }
 }
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
index 34fe539e14a2..e64c1c45b6e9 100644
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <ado/AResultSetMetaData.hxx>
 #include <com/sun/star/sdbc/DataType.hpp>
 #include <com/sun/star/sdbc/ColumnValue.hpp>
@@ -84,7 +88,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column )
     {
         WpADOProperties aProps( aField.get_Properties() );
         if ( aProps.IsValid() )
-            bRet = OTools::getValue(aProps, u"ISCASESENSITIVE").getBool();
+            bRet = OTools::getValue(aProps, std::u16string_view(u"ISCASESENSITIVE")).getBool();
     }
     return bRet;
 }
@@ -114,7 +118,8 @@ OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column )
     {
         WpADOProperties aProps( aField.get_Properties() );
         if ( aProps.IsValid() )
-            sTableName = OTools::getValue(aProps, u"BASETABLENAME").getString();
+            sTableName
+                = OTools::getValue(aProps, std::u16string_view(u"BASETABLENAME")).getString();
     }
     return sTableName;
 }
@@ -160,7 +165,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column )
         WpADOProperties aProps( aField.get_Properties() );
         if ( aProps.IsValid() )
         {
-            bRet = OTools::getValue(aProps, u"ISAUTOINCREMENT").getBool();
+            bRet = OTools::getValue(aProps, std::u16string_view(u"ISAUTOINCREMENT")).getBool();
         }
     }
     return bRet;
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index 1aa0f463020a..92f28ce56a06 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include <ado/ATable.hxx>
 #include <ado/AIndexes.hxx>
 #include <ado/AColumns.hxx>
@@ -207,7 +211,7 @@ void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rV
 
             case PROPERTY_ID_DESCRIPTION:
                 OTools::putValue(   m_aTable.get_Properties(),
-                                u"Description",
+                                std::u16string_view(u"Description"),
                                 getString(rValue));
                 break;
 


More information about the Libreoffice-commits mailing list