diff options
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_xviews.cxx')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_xviews.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx index db4cf6fbefaf..d656707b64af 100644 --- a/connectivity/source/drivers/postgresql/pq_xviews.cxx +++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx @@ -57,7 +57,6 @@ using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::Type; using com::sun::star::uno::XInterface; using com::sun::star::uno::Reference; -using com::sun::star::uno::Sequence; using com::sun::star::uno::RuntimeException; using com::sun::star::container::NoSuchElementException; @@ -107,7 +106,7 @@ void Views::refresh() Reference< XRow > xRow( rs , UNO_QUERY ); - m_values = Sequence< com::sun::star::uno::Any > (); + m_values.clear(); String2IntMap map; sal_Int32 viewIndex = 0; @@ -126,13 +125,11 @@ void Views::refresh() pView->setPropertyValue_NoBroadcast_public(st.COMMAND, makeAny(command) ); { - const int currentViewIndex = viewIndex++; - assert(currentViewIndex == m_values.getLength()); - m_values.realloc( viewIndex ); - m_values[currentViewIndex] = makeAny( prop ); + m_values.push_back( makeAny( prop ) ); OUStringBuffer buf( table.getLength() + schema.getLength() + 1); buf.append( schema + "." + table ); - map[ buf.makeStringAndClear() ] = currentViewIndex; + map[ buf.makeStringAndClear() ] = viewIndex; + ++viewIndex; } } m_name2index.swap( map ); @@ -199,10 +196,10 @@ void Views::dropByIndex( sal_Int32 index ) ::com::sun::star::uno::RuntimeException, std::exception) { osl::MutexGuard guard( m_refMutex->mutex ); - if( index < 0 || index >= m_values.getLength() ) + if( index < 0 || index >= (sal_Int32)m_values.size() ) { OUStringBuffer buf( 128 ); - buf.append( "VIEWS: Index out of range (allowed 0 to " + OUString::number(m_values.getLength() -1) + + buf.append( "VIEWS: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1) + ", got " + OUString::number( index ) + ")"); throw com::sun::star::lang::IndexOutOfBoundsException( buf.makeStringAndClear(), *this ); |