diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-02-07 12:04:02 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-09 13:44:42 +0200 |
commit | 383e11040c2b329705d9f161576cf162390b52a7 (patch) | |
tree | 8d6dab417ea9836f991eafe6580eea0f2f3a5463 /connectivity/source/drivers/postgresql/pq_xkeys.cxx | |
parent | f1cb83cef59c3b1d5ee780e8916832483468fab7 (diff) |
sequence->vector in postgresql
Change-Id: I57bf8f4404df9f73d9a52c651c9f27784f10c937
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_xkeys.cxx')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_xkeys.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx index 7eff2aa8ab0a..9c84ae2f7aa0 100644 --- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx +++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx @@ -58,7 +58,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; @@ -155,7 +154,7 @@ void Keys::refresh() Reference< XRow > xRow( rs , UNO_QUERY ); String2IntMap map; - m_values = Sequence< com::sun::star::uno::Any > (); + m_values.clear(); int keyIndex = 0; while( rs->next() ) { @@ -197,11 +196,9 @@ void Keys::refresh() { - const int currentKeyIndex = keyIndex++; - map[ xRow->getString( 1 ) ] = currentKeyIndex; - assert(currentKeyIndex == m_values.getLength()); - m_values.realloc( keyIndex ); - m_values[currentKeyIndex] = makeAny( prop ); + map[ xRow->getString( 1 ) ] = keyIndex; + m_values.push_back( makeAny( prop ) ); + ++keyIndex; } } m_name2index.swap( map ); @@ -241,10 +238,10 @@ void Keys::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( "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.getLength() -1) + + buf.append( "TABLES: 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 ); |