summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2011-11-30 15:57:08 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2011-11-30 16:00:13 +0100
commit5f3bd5bed3f5d677208dc1b897b2f21eb5f622bb (patch)
tree7cdece771c2aabbf07616e0b3c7928782e365975 /connectivity/source/drivers/postgresql/pq_xcolumns.cxx
parentc75e15c980714c746a0b4b023cecf486cbe81bdc (diff)
pgsql-sdbc: Robustify against empty arrays, etc
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_xcolumns.cxx')
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index 1e1bfd315165..18f2965d288d 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -55,8 +55,6 @@
*
************************************************************************/
-#include <vector>
-
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
@@ -340,8 +338,8 @@ void Columns::refresh()
String2IntMap map;
- std::vector< Any, Allocator< Any> > vec;
- sal_Int32 columnIndex = 0;
+ m_values = Sequence< com::sun::star::uno::Any > ();
+ int columnIndex = 0;
while( rs->next() )
{
Column * pColumn =
@@ -359,11 +357,14 @@ void Columns::refresh()
// m_tableName,
// name ) );
- vec.push_back( makeAny( prop ) );
- map[ name ] = columnIndex;
- columnIndex ++;
+ {
+ const int currentColumnIndex = columnIndex++;
+ assert(currentColumnIndex == m_values.getLength());
+ m_values.realloc( columnIndex );
+ m_values[currentColumnIndex] = makeAny( prop );
+ map[ name ] = currentColumnIndex;
+ }
}
- m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() );
m_name2index.swap( map );
}
catch ( com::sun::star::sdbc::SQLException & e )