summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/postgresql
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-23 10:50:14 +0200
committerNoel Grandin <noel@peralex.com>2015-03-23 11:02:11 +0200
commit3e8a7ce7dffcf46a692e5da0b281a104df8d4d95 (patch)
tree1fdb0ad4385724f426c6dbbdc91ce66a4fd3b626 /connectivity/source/drivers/postgresql
parentda631972229389d40e0502e02ff4e2c0761ca3fc (diff)
Revert "loplugin:constantfunction: connectivity"
it seems to be causing unit-test and build failures This reverts commit 5cbb51c009fa266e8418ef93799ac64e431c22f5. Change-Id: Idc6372f98200b23828aa19b22a75b6b2b640d1ab
Diffstat (limited to 'connectivity/source/drivers/postgresql')
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx20
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.hxx1
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx2
4 files changed, 33 insertions, 0 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index b243dfa64944..d334dca139a7 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -124,6 +124,11 @@ std::vector
#define DEFERRABILITY_INITIALLY_IMMEDIATE 6
#define DEFERRABILITY_NONE 7
+void DatabaseMetaData::checkClosed()
+ throw (SQLException, RuntimeException)
+{
+}
+
DatabaseMetaData::DatabaseMetaData(
const ::rtl::Reference< RefCountedMutex > & refMutex,
const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin,
@@ -1105,6 +1110,7 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
// LEM TODO: implement
// LEM TODO: at least fake the columns, even if no row.
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
}
@@ -1117,6 +1123,7 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
{
(void) catalog; (void) schemaPattern; (void) procedureNamePattern; (void) columnNamePattern;
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
// LEM TODO: implement
// LEM TODO: at least fake the columns, even if no row.
return new SequenceResultSet(
@@ -1134,6 +1141,7 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
Statics &statics = getStatics();
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -1251,6 +1259,7 @@ struct SortInternalSchemasLastAndPublicFirst
throw (SQLException, RuntimeException, std::exception)
{
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -1288,6 +1297,7 @@ struct SortInternalSchemasLastAndPublicFirst
// LEM TODO: return the current catalog like JDBC driver?
// at least fake the columns, even if no content
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
}
@@ -1297,6 +1307,7 @@ struct SortInternalSchemasLastAndPublicFirst
{
// LEM TODO: this can be made dynamic, see JDBC driver
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, getStatics().tableTypeNames, getStatics().tableTypeData,
m_pSettings->tc );
@@ -1460,6 +1471,7 @@ static void columnMetaData2DatabaseTypeDescription(
// continue !
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -1643,6 +1655,7 @@ static void columnMetaData2DatabaseTypeDescription(
(void) catalog;
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -1673,6 +1686,7 @@ static void columnMetaData2DatabaseTypeDescription(
{
(void) catalog;
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -1703,6 +1717,7 @@ static void columnMetaData2DatabaseTypeDescription(
(void) catalog; (void) schema; (void) table; (void) scope; (void) nullable;
//LEM TODO: implement! See JDBC driver
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
}
@@ -1715,6 +1730,7 @@ static void columnMetaData2DatabaseTypeDescription(
(void) catalog; (void) schema; (void) table;
//LEM TODO: implement! See JDBC driver
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
}
@@ -1727,6 +1743,7 @@ static void columnMetaData2DatabaseTypeDescription(
(void) catalog;
//LEM TODO: review
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
// 1. TABLE_CAT string =&gt; table catalog (may be NULL )
// 2. TABLE_SCHEM string =&gt; table schema (may be NULL )
@@ -2290,6 +2307,7 @@ static void pgTypeInfo2ResultSet(
{
// Note: Indexes start at 0 (in the API doc, they start at 1)
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
if( isLog( m_pSettings, LogLevel::INFO ) )
{
@@ -2358,6 +2376,7 @@ static sal_Int32 seqContains( const Sequence< sal_Int32 > &seq, sal_Int32 value
(void) catalog; (void) approximate;
//LEM TODO: review
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
/*
1. TABLE_CAT string -> table catalog (may be NULL )
@@ -2548,6 +2567,7 @@ sal_Bool DatabaseMetaData::supportsBatchUpdates( ) throw (SQLException, Runtime
(void) catalog; (void) schemaPattern; (void) typeNamePattern; (void) types;
//LEM TODO: implement! See JDBC driver
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
return new SequenceResultSet(
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
}
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
index a61ac4a6e333..9a54a20b92b4 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.hxx
@@ -56,6 +56,7 @@ class DatabaseMetaData :
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > m_getTablePrivs_stmt;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > m_getColumnPrivs_stmt;
+ void checkClosed() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
sal_Int32 getIntSetting(const OUString& settingName) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
sal_Int32 getMaxIndexKeys() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
sal_Int32 getMaxNameLength() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index 406d31b90382..1e57850187d0 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -333,6 +333,7 @@ sal_Int32 ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
throw (SQLException, RuntimeException, std::exception)
{
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
checkColumnIndex( column );
return m_colDesc[column-1].displaySize;
}
@@ -346,6 +347,7 @@ OUString ResultSetMetaData::getColumnLabel( sal_Int32 column )
OUString ResultSetMetaData::getColumnName( sal_Int32 column ) throw (SQLException, RuntimeException, std::exception)
{
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
checkColumnIndex( column );
return m_colDesc[column-1].name;
@@ -361,6 +363,7 @@ sal_Int32 ResultSetMetaData::getPrecision( sal_Int32 column )
throw (SQLException, RuntimeException, std::exception)
{
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
checkColumnIndex( column );
return m_colDesc[column-1].precision;
}
@@ -369,6 +372,7 @@ sal_Int32 ResultSetMetaData::getScale( sal_Int32 column )
throw (SQLException, RuntimeException, std::exception)
{
MutexGuard guard( m_refMutex->mutex );
+ checkClosed();
checkColumnIndex( column );
return m_colDesc[column-1].scale;
}
@@ -454,6 +458,12 @@ OUString ResultSetMetaData::getColumnServiceName( sal_Int32 column )
return OUString();
}
+void ResultSetMetaData::checkClosed()
+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ // we never close
+}
+
void ResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
index e70d5b04a733..6dc53f0fbc4e 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
@@ -81,6 +81,8 @@ class ResultSetMetaData :
sal_Int32 m_colCount;
+ void checkClosed()
+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
void checkColumnIndex( sal_Int32 columnIndex )
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
void checkTable();