Use string view here

Change-Id: I597820083f863ec19f05f4da1aa226f4c67cf258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107741
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 4f15d16..02f2589 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -103,7 +103,7 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
{
    if(m_aColumn.IsValid())
    {
        const char* pAdoPropertyName = nullptr;
        std::u16string_view sAdoPropertyName;

        switch(nHandle)
        {
@@ -161,21 +161,21 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
                break;

            case PROPERTY_ID_ISAUTOINCREMENT:
                OTools::putValue( m_aColumn.get_Properties(), OUString( "Autoincrement" ), getBOOL( rValue ) );
                OTools::putValue(m_aColumn.get_Properties(), u"Autoincrement", getBOOL(rValue));
                break;

            case PROPERTY_ID_IM001:
            case PROPERTY_ID_DESCRIPTION:
                pAdoPropertyName = "Description";
                sAdoPropertyName = u"Description";
                break;

            case PROPERTY_ID_DEFAULTVALUE:
                pAdoPropertyName = "Default";
                sAdoPropertyName = u"Default";
                break;
        }

        if ( pAdoPropertyName )
            OTools::putValue( m_aColumn.get_Properties(), OUString::createFromAscii( pAdoPropertyName ), getString( rValue ) );
        if (!sAdoPropertyName.empty())
            OTools::putValue(m_aColumn.get_Properties(), sAdoPropertyName, getString(rValue));
    }
    OColumn_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
@@ -236,11 +236,11 @@ void OAdoColumn::fillPropertyValues()

            if ( aProps.IsValid() )
            {
                m_IsAutoIncrement = OTools::getValue( aProps, OUString("Autoincrement") ).getBool();
                m_IsAutoIncrement = OTools::getValue(aProps, u"Autoincrement").getBool();

                m_Description = OTools::getValue( aProps, OUString("Description") ).getString();
                m_Description = OTools::getValue(aProps, u"Description").getString();

                m_DefaultValue = OTools::getValue( aProps, OUString("Default") ).getString();
                m_DefaultValue = OTools::getValue(aProps, u"Default").getString();
            }
        }
    }
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index e9dc772..13ab128 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -103,7 +103,7 @@ 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(), OUString("Autoincrement"), bAutoIncrement );
                OTools::putValue(aAddedColumn.get_Properties(), 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 c9251a9..74a5736 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -133,8 +133,8 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
            WpADOProperties aProps = m_pAdoConnection->get_Properties();
            if(aProps.IsValid())
            {
                OTools::putValue(aProps,OUString("Jet OLEDB:ODBC Parsing"),true);
                OLEVariant aVar(OTools::getValue(aProps,OUString("Jet OLEDB:Engine Type")));
                OTools::putValue(aProps, u"Jet OLEDB:ODBC Parsing", true);
                OLEVariant aVar(OTools::getValue(aProps, u"Jet OLEDB:Engine Type"));
                if(!aVar.isNull() && !aVar.isEmpty())
                    m_nEngineType = aVar.getInt32();
            }
@@ -198,7 +198,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql )
    WpADOProperties aProps = m_pAdoConnection->get_Properties();
    if(aProps.IsValid())
    {
        OTools::putValue(aProps,OUString("Jet OLEDB:ODBC Parsing"),true);
        OTools::putValue(aProps, 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 34eb750..eb9692d 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
@@ -559,7 +559,7 @@ void OAdoTable::fillPropertyValues()
        {
            WpADOProperties aProps = m_aTable.get_Properties();
            if(aProps.IsValid())
                m_Description = OTools::getValue(aProps,OUString("Description")).getString();
                m_Description = OTools::getValue(aProps, u"Description").getString();
        }
    }
}
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
index 2398334..34fe539 100644
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
@@ -84,7 +84,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column )
    {
        WpADOProperties aProps( aField.get_Properties() );
        if ( aProps.IsValid() )
            bRet = OTools::getValue( aProps, OUString("ISCASESENSITIVE") ).getBool();
            bRet = OTools::getValue(aProps, u"ISCASESENSITIVE").getBool();
    }
    return bRet;
}
@@ -114,7 +114,7 @@ OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column )
    {
        WpADOProperties aProps( aField.get_Properties() );
        if ( aProps.IsValid() )
            sTableName = OTools::getValue( aProps, OUString("BASETABLENAME") ).getString();
            sTableName = OTools::getValue(aProps, u"BASETABLENAME").getString();
    }
    return sTableName;
}
@@ -160,7 +160,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column )
        WpADOProperties aProps( aField.get_Properties() );
        if ( aProps.IsValid() )
        {
            bRet = OTools::getValue( aProps, OUString("ISAUTOINCREMENT") ).getBool();
            bRet = OTools::getValue(aProps, u"ISAUTOINCREMENT").getBool();
        }
    }
    return bRet;
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index 2092555..1aa0f46 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -207,7 +207,7 @@ void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rV

            case PROPERTY_ID_DESCRIPTION:
                OTools::putValue(   m_aTable.get_Properties(),
                                OUString("Description"),
                                u"Description",
                                getString(rValue));
                break;

diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index 5c2d014..8b6ad10 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -45,20 +45,20 @@ OLEString::OLEString(const BSTR& _sBStr)
    :m_sStr(_sBStr)
{
}
OLEString::OLEString(const OUString& _sBStr)
OLEString::OLEString(std::u16string_view _sBStr)
{
    m_sStr = ::SysAllocString(o3tl::toW(_sBStr.getStr()));
    m_sStr = SysAllocStringLen(o3tl::toW(_sBStr.data()), _sBStr.length());
}
OLEString::~OLEString()
{
    if(m_sStr)
        ::SysFreeString(m_sStr);
}
OLEString& OLEString::operator=(const OUString& _rSrc)
OLEString& OLEString::operator=(std::u16string_view _rSrc)
{
    if(m_sStr)
        ::SysFreeString(m_sStr);
    m_sStr = ::SysAllocString(o3tl::toW(_rSrc.getStr()));
    m_sStr = SysAllocStringLen(o3tl::toW(_rSrc.data()), _rSrc.length());
    return *this;
}
OLEString& OLEString::operator=(const OLEString& _rSrc)
@@ -118,11 +118,11 @@ OLEVariant::OLEVariant(sal_Int16 n)             {   VariantInit(this);  vt = VT_
OLEVariant::OLEVariant(sal_Int32 n)             {   VariantInit(this);  vt = VT_I4;     lVal        = n;}
OLEVariant::OLEVariant(sal_Int64 x)             {   VariantInit(this);  vt = VT_I4;     lVal        = static_cast<LONG>(x);}

OLEVariant::OLEVariant(const OUString& us)
OLEVariant::OLEVariant(std::u16string_view us)
{
    ::VariantInit(this);
    vt      = VT_BSTR;
    bstrVal = SysAllocString(o3tl::toW(us.getStr()));
    bstrVal = SysAllocStringLen(o3tl::toW(us.data()), us.length());
}
OLEVariant::~OLEVariant()
{
@@ -273,12 +273,12 @@ void OLEVariant::setBool(bool b)
    vt = VT_BOOL;
    boolVal     = b ? VARIANT_TRUE : VARIANT_FALSE;
}
void OLEVariant::setString(const OUString& us)
void OLEVariant::setString(std::u16string_view us)
{
    HRESULT eRet = VariantClear(this);
    OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
    vt = VT_BSTR;
    bstrVal     = ::SysAllocString(o3tl::toW(us.getStr()));
    bstrVal = SysAllocStringLen(o3tl::toW(us.data()), us.length());
}
void OLEVariant::setNoArg()
{
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index 0c6ebd6..d44287d 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -40,13 +40,13 @@ namespace connectivity::ado
        public:
            OLEString();
            OLEString(const BSTR& _sBStr);
            OLEString(const OUString& _sBStr);
            OLEString(std::u16string_view _sBStr);
            OLEString(const OLEString& _rRh)
            {
                OLEString::operator=(_rRh);
            }
            ~OLEString();
            OLEString& operator=(const OUString& _rSrc);
            OLEString& operator=(std::u16string_view _rSrc);
            OLEString& operator=(const BSTR& _rSrc);
            OLEString& operator=(const OLEString& _rSrc);
            OUString asOUString() const;
@@ -68,7 +68,11 @@ namespace connectivity::ado
            OLEVariant(sal_Int32 n) ;
            OLEVariant(sal_Int64 x) ;

            OLEVariant(const OUString& us) ;
            OLEVariant(std::u16string_view us);
            OLEVariant(const OUString& us)
                : OLEVariant(std::u16string_view(us))
            {
            }
            ~OLEVariant()                   ;
            OLEVariant(const css::util::Date& x );
            OLEVariant(const css::util::Time& x );
@@ -93,7 +97,7 @@ namespace connectivity::ado
            void setChar(unsigned char a)           ;
            void setCurrency(double aCur)           ;
            void setBool(bool b)                    ;
            void setString(const OUString& us) ;
            void setString(std::u16string_view us);
            void setNoArg()                         ;

            void setIDispatch(IDispatch* pDispInterface);