summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2018-04-23 21:30:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-25 08:31:33 +0200
commit7a67d7a7c10aad2bbc5dc3d0048259a8b80970cb (patch)
tree2cbd4a4d50750af3abc931537130346d6d853dd2 /connectivity
parentb4ba8dc9ef1635c75b363838b6016d3851387020 (diff)
use more thread safe static initializer in postgresql driver
Change-Id: Idb210207112994e1247c35e0dce1c6cd2f80f371 Reviewed-on: https://gerrit.libreoffice.org/53365 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx85
-rw-r--r--connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx22
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx94
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx95
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindex.cxx39
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkey.cxx39
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.cxx48
-rw-r--r--connectivity/source/drivers/postgresql/pq_xuser.cxx21
-rw-r--r--connectivity/source/drivers/postgresql/pq_xview.cxx19
10 files changed, 168 insertions, 314 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 2c7498271cb9..6828c471c1ed 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -84,44 +84,34 @@ namespace pq_sdbc_driver
{
static ::cppu::IPropertyArrayHelper & getResultSetPropertyArrayHelper()
{
- static ::cppu::IPropertyArrayHelper *pArrayHelper;
- if( ! pArrayHelper )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pArrayHelper )
- {
- static Property aTable[] =
- {
- // LEM TODO: this needs to be kept in sync with other, e.g. pq_statics.css:508
- // Should really share!
- // At least use for the handles the #define'd values in .hxx file...
- Property(
- "CursorName", 0,
- ::cppu::UnoType<OUString>::get() , 0 ),
- Property(
- "EscapeProcessing", 1,
- cppu::UnoType<bool>::get() , 0 ),
- Property(
- "FetchDirection", 2,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "FetchSize", 3,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "IsBookmarkable", 4,
- cppu::UnoType<bool>::get() , 0 ),
- Property(
- "ResultSetConcurrency", 5,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "ResultSetType", 6,
- ::cppu::UnoType<sal_Int32>::get() , 0 )
- };
- static_assert( SAL_N_ELEMENTS(aTable) == BASERESULTSET_SIZE, "wrong number of elements" );
- static ::cppu::OPropertyArrayHelper arrayHelper( aTable, BASERESULTSET_SIZE, true );
- pArrayHelper = &arrayHelper;
- }
- }
+ // LEM TODO: this needs to be kept in sync with other, e.g. pq_statics.css:508
+ // Should really share!
+ // At least use for the handles the #define'd values in .hxx file...
+ static ::cppu::OPropertyArrayHelper arrayHelper(
+ Sequence<Property>{
+ Property(
+ "CursorName", 0,
+ ::cppu::UnoType<OUString>::get() , 0 ),
+ Property(
+ "EscapeProcessing", 1,
+ cppu::UnoType<bool>::get() , 0 ),
+ Property(
+ "FetchDirection", 2,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "FetchSize", 3,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "IsBookmarkable", 4,
+ cppu::UnoType<bool>::get() , 0 ),
+ Property(
+ "ResultSetConcurrency", 5,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "ResultSetType", 6,
+ ::cppu::UnoType<sal_Int32>::get() , 0 )},
+ true );
+ static ::cppu::IPropertyArrayHelper *pArrayHelper = &arrayHelper;
return *pArrayHelper;
}
@@ -176,20 +166,11 @@ Any BaseResultSet::queryInterface( const Type & rType )
Sequence<Type > BaseResultSet::getTypes()
{
- static Sequence< Type > *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static Sequence< Type > collection(
- ::comphelper::concatSequences(
- OPropertySetHelper::getTypes(),
- BaseResultSet_BASE::getTypes()));
- pCollection = &collection;
- }
- }
- return *pCollection;
+ static Sequence< Type > collection(
+ ::comphelper::concatSequences(
+ OPropertySetHelper::getTypes(),
+ BaseResultSet_BASE::getTypes()));
+ return collection;
}
Sequence< sal_Int8> BaseResultSet::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
index 4b46576d8667..8a41491636a3 100644
--- a/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx
@@ -39,8 +39,6 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
-using osl::MutexGuard;
-
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Any;
@@ -82,20 +80,12 @@ css::uno::Any FakedUpdateableResultSet::queryInterface(
css::uno::Sequence< css::uno::Type > FakedUpdateableResultSet::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<XResultSetUpdate>::get(),
- cppu::UnoType<XRowUpdate>::get(),
- ResultSet::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection s_collection(
+ cppu::UnoType<XResultSetUpdate>::get(),
+ cppu::UnoType<XRowUpdate>::get(),
+ ResultSet::getTypes());
+
+ return s_collection.getTypes();
}
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index b9032c7bb5ab..865222cbcc83 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -57,7 +57,6 @@
#include <connectivity/dbconversion.hxx>
-using osl::Mutex;
using osl::MutexGuard;
@@ -90,47 +89,38 @@ namespace pq_sdbc_driver
{
static ::cppu::IPropertyArrayHelper & getPreparedStatementPropertyArrayHelper()
{
- static ::cppu::IPropertyArrayHelper *pArrayHelper;
- if( ! pArrayHelper )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pArrayHelper )
- {
- static Property aTable[] =
- {
- Property(
- "CursorName", 0,
- ::cppu::UnoType<OUString>::get() , 0 ),
- Property(
- "EscapeProcessing", 1,
- cppu::UnoType<bool>::get() , 0 ),
- Property(
- "FetchDirection", 2,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "FetchSize", 3,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "MaxFieldSize", 4,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "MaxRows", 5,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "QueryTimeOut", 6,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "ResultSetConcurrency", 7,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "ResultSetType", 8,
- ::cppu::UnoType<sal_Int32>::get() , 0 )
- };
- static_assert( SAL_N_ELEMENTS(aTable) == PREPARED_STATEMENT_SIZE, "wrong number of elements" );
- static ::cppu::OPropertyArrayHelper arrayHelper( aTable, PREPARED_STATEMENT_SIZE, true );
- pArrayHelper = &arrayHelper;
- }
- }
+ static ::cppu::OPropertyArrayHelper arrayHelper(
+ Sequence<Property>{
+ Property(
+ "CursorName", 0,
+ ::cppu::UnoType<OUString>::get() , 0 ),
+ Property(
+ "EscapeProcessing", 1,
+ cppu::UnoType<bool>::get() , 0 ),
+ Property(
+ "FetchDirection", 2,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "FetchSize", 3,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "MaxFieldSize", 4,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "MaxRows", 5,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "QueryTimeOut", 6,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "ResultSetConcurrency", 7,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "ResultSetType", 8,
+ ::cppu::UnoType<sal_Int32>::get() , 0 )},
+ true );
+ static ::cppu::IPropertyArrayHelper *pArrayHelper = &arrayHelper;
+
return *pArrayHelper;
}
@@ -239,20 +229,12 @@ Any PreparedStatement::queryInterface( const Type & rType )
Sequence< Type > PreparedStatement::getTypes()
{
- static Sequence< Type > *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static Sequence< Type > collection(
- ::comphelper::concatSequences(
- OPropertySetHelper::getTypes(),
- PreparedStatement_BASE::getTypes()));
- pCollection = &collection;
- }
- }
- return *pCollection;
+ static Sequence< Type > collection(
+ ::comphelper::concatSequences(
+ OPropertySetHelper::getTypes(),
+ PreparedStatement_BASE::getTypes()));
+
+ return collection;
}
Sequence< sal_Int8> PreparedStatement::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 5a3beca846c0..b50f9008c720 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -67,7 +67,6 @@
#include <string.h>
-using osl::Mutex;
using osl::MutexGuard;
@@ -108,47 +107,39 @@ namespace pq_sdbc_driver
{
static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper()
{
- static ::cppu::IPropertyArrayHelper *pArrayHelper;
- if( ! pArrayHelper )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pArrayHelper )
- {
- static Property aTable[] =
- {
- Property(
- "CursorName", 0,
- ::cppu::UnoType<OUString>::get() , 0 ),
- Property(
- "EscapeProcessing", 1,
- cppu::UnoType<bool>::get() , 0 ),
- Property(
- "FetchDirection", 2,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "FetchSize", 3,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "MaxFieldSize", 4,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "MaxRows", 5,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "QueryTimeOut", 6,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "ResultSetConcurrency", 7,
- ::cppu::UnoType<sal_Int32>::get() , 0 ),
- Property(
- "ResultSetType", 8,
- ::cppu::UnoType<sal_Int32>::get() , 0 )
- };
- static_assert( SAL_N_ELEMENTS(aTable) == STATEMENT_SIZE, "wrong number of elements" );
- static ::cppu::OPropertyArrayHelper arrayHelper( aTable, STATEMENT_SIZE, true );
- pArrayHelper = &arrayHelper;
- }
- }
+ static ::cppu::OPropertyArrayHelper arrayHelper(
+ Sequence<Property>{
+ Property(
+ "CursorName", 0,
+ ::cppu::UnoType<OUString>::get() , 0 ),
+ Property(
+ "EscapeProcessing", 1,
+ cppu::UnoType<bool>::get() , 0 ),
+ Property(
+ "FetchDirection", 2,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "FetchSize", 3,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "MaxFieldSize", 4,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "MaxRows", 5,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "QueryTimeOut", 6,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "ResultSetConcurrency", 7,
+ ::cppu::UnoType<sal_Int32>::get() , 0 ),
+ Property(
+ "ResultSetType", 8,
+ ::cppu::UnoType<sal_Int32>::get() , 0 )},
+ true );
+
+ static ::cppu::IPropertyArrayHelper *pArrayHelper = &arrayHelper;
+
return *pArrayHelper;
}
@@ -194,20 +185,12 @@ Any Statement::queryInterface( const Type & rType )
Sequence< Type > Statement::getTypes()
{
- static Sequence< Type > *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static Sequence< Type > collection(
- ::comphelper::concatSequences(
- OPropertySetHelper::getTypes(),
- Statement_BASE::getTypes()));
- pCollection = &collection;
- }
- }
- return *pCollection;
+ static Sequence< Type > collection(
+ ::comphelper::concatSequences(
+ OPropertySetHelper::getTypes(),
+ Statement_BASE::getTypes()));
+
+ return collection;
}
Sequence< sal_Int8> Statement::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index 773053b9fe98..0d503693f5b3 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -147,20 +147,12 @@ css::uno::Any UpdateableResultSet::queryInterface(
css::uno::Sequence< css::uno::Type > UpdateableResultSet::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<XResultSetUpdate>::get(),
- cppu::UnoType<XRowUpdate>::get(),
- SequenceResultSet::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<XResultSetUpdate>::get(),
+ cppu::UnoType<XRowUpdate>::get(),
+ SequenceResultSet::getTypes());
+
+ return collection.getTypes();
}
diff --git a/connectivity/source/drivers/postgresql/pq_xindex.cxx b/connectivity/source/drivers/postgresql/pq_xindex.cxx
index 8a88ed64ca86..cb4b56136999 100644
--- a/connectivity/source/drivers/postgresql/pq_xindex.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindex.cxx
@@ -46,9 +46,6 @@
#include "pq_tools.hxx"
#include "pq_statics.hxx"
-using osl::MutexGuard;
-using osl::Mutex;
-
using com::sun::star::container::XNameAccess;
using com::sun::star::uno::Reference;
@@ -103,19 +100,11 @@ Reference< XNameAccess > Index::getColumns( )
Sequence<Type > Index::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> Index::getImplementationId()
@@ -175,19 +164,11 @@ Reference< XNameAccess > IndexDescriptor::getColumns( )
Sequence<Type > IndexDescriptor::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> IndexDescriptor::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_xkey.cxx b/connectivity/source/drivers/postgresql/pq_xkey.cxx
index ab7e3768e836..7eaaeb73f9e3 100644
--- a/connectivity/source/drivers/postgresql/pq_xkey.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkey.cxx
@@ -46,9 +46,6 @@
#include "pq_tools.hxx"
#include "pq_statics.hxx"
-using osl::MutexGuard;
-using osl::Mutex;
-
using com::sun::star::container::XNameAccess;
using com::sun::star::uno::Reference;
@@ -105,19 +102,11 @@ Reference< XNameAccess > Key::getColumns( )
Sequence<Type > Key::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> Key::getImplementationId()
@@ -172,19 +161,11 @@ Reference< XNameAccess > KeyDescriptor::getColumns( )
Sequence<Type > KeyDescriptor::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> KeyDescriptor::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index 1d9e37cae218..84e627844d91 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -263,23 +263,15 @@ void Table::alterColumnByIndex(
Sequence<Type > Table::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XIndexesSupplier>::get(),
- cppu::UnoType<css::sdbcx::XKeysSupplier>::get(),
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- cppu::UnoType<css::sdbcx::XRename>::get(),
- cppu::UnoType<css::sdbcx::XAlterTable>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XIndexesSupplier>::get(),
+ cppu::UnoType<css::sdbcx::XKeysSupplier>::get(),
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ cppu::UnoType<css::sdbcx::XRename>::get(),
+ cppu::UnoType<css::sdbcx::XAlterTable>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> Table::getImplementationId()
@@ -368,21 +360,13 @@ Reference< XIndexAccess > TableDescriptor::getKeys( )
Sequence<Type > TableDescriptor::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XIndexesSupplier>::get(),
- cppu::UnoType<css::sdbcx::XKeysSupplier>::get(),
- cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XIndexesSupplier>::get(),
+ cppu::UnoType<css::sdbcx::XKeysSupplier>::get(),
+ cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> TableDescriptor::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_xuser.cxx b/connectivity/source/drivers/postgresql/pq_xuser.cxx
index 52f1470c14e6..766b80d2587a 100644
--- a/connectivity/source/drivers/postgresql/pq_xuser.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xuser.cxx
@@ -46,9 +46,6 @@
#include "pq_tools.hxx"
#include "pq_statics.hxx"
-using osl::MutexGuard;
-using osl::Mutex;
-
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Any;
@@ -86,19 +83,11 @@ Reference< XPropertySet > User::createDataDescriptor( )
Sequence<Type > User::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XUser>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XUser>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> User::getImplementationId()
diff --git a/connectivity/source/drivers/postgresql/pq_xview.cxx b/connectivity/source/drivers/postgresql/pq_xview.cxx
index 99f2f8510c2a..47ae1a91d90c 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.cxx
@@ -48,7 +48,6 @@
#include "pq_tools.hxx"
using osl::MutexGuard;
-using osl::Mutex;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Sequence;
@@ -156,19 +155,11 @@ void View::rename( const OUString& newName )
Sequence<Type > View::getTypes()
{
- static cppu::OTypeCollection *pCollection;
- if( ! pCollection )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static cppu::OTypeCollection collection(
- cppu::UnoType<css::sdbcx::XRename>::get(),
- ReflectionBase::getTypes());
- pCollection = &collection;
- }
- }
- return pCollection->getTypes();
+ static cppu::OTypeCollection collection(
+ cppu::UnoType<css::sdbcx::XRename>::get(),
+ ReflectionBase::getTypes());
+
+ return collection.getTypes();
}
Sequence< sal_Int8> View::getImplementationId()