diff options
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_xkeys.cxx')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_xkeys.cxx | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx index 84507202fa9a..0758be630e04 100644 --- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx +++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx @@ -49,6 +49,8 @@ #include <com/sun/star/sdbc/KeyRule.hpp> #include <com/sun/star/sdbcx/KeyType.hpp> #include <cppuhelper/exc_hlp.hxx> +#include <o3tl/safeint.hxx> +#include <utility> #include "pq_xkeys.hxx" #include "pq_xkey.hxx" @@ -60,7 +62,7 @@ using osl::MutexGuard; using css::beans::XPropertySet; -using com::sun::star::uno::makeAny; +using com::sun::star::uno::Any; using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::Reference; @@ -78,11 +80,11 @@ Keys::Keys( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex, const css::uno::Reference< css::sdbc::XConnection > & origin, ConnectionSettings *pSettings, - const OUString &schemaName, - const OUString &tableName) + OUString schemaName, + OUString tableName) : Container( refMutex, origin, pSettings, getStatics().KEY ), - m_schemaName( schemaName ), - m_tableName( tableName ) + m_schemaName(std::move( schemaName )), + m_tableName(std::move( tableName )) {} Keys::~Keys() @@ -156,16 +158,16 @@ void Keys::refresh() Reference< css::beans::XPropertySet > prop = pKey; pKey->setPropertyValue_NoBroadcast_public( - st.NAME, makeAny( xRow->getString( 1 ) ) ); + st.NAME, Any( xRow->getString( 1 ) ) ); sal_Int32 keyType = string2keytype( xRow->getString(2) ); - pKey->setPropertyValue_NoBroadcast_public( st.TYPE, makeAny( keyType ) ); + pKey->setPropertyValue_NoBroadcast_public( st.TYPE, Any( keyType ) ); pKey->setPropertyValue_NoBroadcast_public( - st.UPDATE_RULE, makeAny( string2keyrule( xRow->getString(3) ) ) ); + st.UPDATE_RULE, Any( string2keyrule( xRow->getString(3) ) ) ); pKey->setPropertyValue_NoBroadcast_public( - st.DELETE_RULE, makeAny( string2keyrule( xRow->getString(4) ) ) ); + st.DELETE_RULE, Any( string2keyrule( xRow->getString(4) ) ) ); pKey->setPropertyValue_NoBroadcast_public( st.PRIVATE_COLUMNS, - makeAny( + Any( convertMappedIntArray2StringArray( mainMap, string2intarray( xRow->getString( 7 ) ) ) ) ); @@ -174,13 +176,13 @@ void Keys::refresh() { OUString buf = xRow->getString( 6 ) + "." + xRow->getString( 5 ); pKey->setPropertyValue_NoBroadcast_public( - st.REFERENCED_TABLE, makeAny( buf ) ); + st.REFERENCED_TABLE, Any( buf ) ); Int2StringMap foreignMap; fillAttnum2attnameMap( foreignMap, m_origin, xRow->getString(6), xRow->getString(5)); pKey->setPropertyValue_NoBroadcast_public( st.PRIVATE_FOREIGN_COLUMNS, - makeAny( + Any( convertMappedIntArray2StringArray( foreignMap, string2intarray( xRow->getString(8) ) ) ) ); @@ -189,7 +191,7 @@ void Keys::refresh() { map[ xRow->getString( 1 ) ] = keyIndex; - m_values.push_back( makeAny( prop ) ); + m_values.push_back( Any( prop ) ); ++keyIndex; } } @@ -226,7 +228,7 @@ void Keys::appendByDescriptor( void Keys::dropByIndex( sal_Int32 index ) { osl::MutexGuard guard( m_xMutex->GetMutex() ); - if( index < 0 || index >= static_cast<sal_Int32>(m_values.size()) ) + if( index < 0 || o3tl::make_unsigned(index) >= m_values.size() ) { throw css::lang::IndexOutOfBoundsException( "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1) |