summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2018-12-18 22:04:18 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2018-12-18 22:18:12 +0100
commita9d4f2bebda3380a3b6843f9df1204c9b062b3a8 (patch)
tree90c2f139b733672875a9017edad257d7a97cc919
parentfaac30002b5a2af6050d440456e09dccedb15fee (diff)
postgresql: correctly implement XMultipleResults interface
note that we implement it in a very limited way, since we will always return only a single result. Change-Id: Idc7927d1a6896b78f6de8627ba857982821ac629
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx9
2 files changed, 13 insertions, 0 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 865222cbcc83..a976d7e3dfc4 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -741,6 +741,10 @@ sal_Int32 PreparedStatement::getUpdateCount( )
}
sal_Bool PreparedStatement::getMoreResults( )
{
+ Reference< XCloseable > lastResultSet = m_lastResultset;
+ if( lastResultSet.is() )
+ lastResultSet->close();
+ m_multipleResultUpdateCount = -1;
return false;
}
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index db99a20910b0..a95a48674607 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -936,6 +936,15 @@ sal_Int32 Statement::getUpdateCount( )
sal_Bool Statement::getMoreResults( )
{
+ // The PostgreSQL C interface always returns a single result,
+ // so we will never have multiple ones.
+ // Implicitly close the open resultset (if any) as per spec,
+ // and setup to signal "no more result, neither as resultset,
+ // nor as update count".
+ Reference< XCloseable > lastResultSetHolder = m_lastResultset;
+ if( lastResultSetHolder.is() )
+ lastResultSetHolder->close();
+ m_multipleResultUpdateCount = -1;
return false;
}