summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-01-14 16:19:14 +0100
committerJulien Nabet <serval2412@yahoo.fr>2017-01-24 06:12:28 +0000
commit93dd5ae6ca8f6e812e63d68465512acda114ee27 (patch)
tree7e325596cc08d85433f168a8c755d0353f68ab13 /connectivity
parentc6d9e749b72c18cb71f7ffc25bb3474ee5c355b4 (diff)
loplugin:refcounting
Change-Id: Ied9ecabb3cb6b5d629ec72db164df452d8ca114a Reviewed-on: https://gerrit.libreoffice.org/33479 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/Clob.cxx14
-rw-r--r--connectivity/source/drivers/firebird/Clob.hxx3
2 files changed, 11 insertions, 6 deletions
diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx
index 65cd03e10942..83d95797d4d9 100644
--- a/connectivity/source/drivers/firebird/Clob.cxx
+++ b/connectivity/source/drivers/firebird/Clob.cxx
@@ -28,13 +28,14 @@ Clob::Clob(isc_db_handle* pDatabaseHandle,
isc_tr_handle* pTransactionHandle,
ISC_QUAD& aBlobID):
Clob_BASE(m_aMutex),
- m_aBlob(pDatabaseHandle, pTransactionHandle, aBlobID)
+ m_aBlob(new connectivity::firebird::Blob(pDatabaseHandle, pTransactionHandle, aBlobID))
{
}
void SAL_CALL Clob::disposing()
{
- m_aBlob.disposing();
+ m_aBlob->dispose();
+ m_aBlob.clear();
Clob_BASE::disposing();
}
@@ -46,7 +47,7 @@ sal_Int64 SAL_CALL Clob::length()
// read the entire blob
// TODO FIXME better solution?
- uno::Sequence < sal_Int8 > aEntireBlob = m_aBlob.getBytes( 1, m_aBlob.length());
+ uno::Sequence < sal_Int8 > aEntireBlob = m_aBlob->getBytes( 1, m_aBlob->length());
OUString sEntireClob ( reinterpret_cast< sal_Char *>( aEntireBlob.getArray() ),
aEntireBlob.getLength(),
RTL_TEXTENCODING_UTF8 );
@@ -63,7 +64,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition,
// read the entire blob
// TODO FIXME better solution?
// TODO FIXME Assume indexing of nPosition starts at position 1.
- uno::Sequence < sal_Int8 > aEntireBlob = m_aBlob.getBytes( 1, m_aBlob.length());
+ uno::Sequence < sal_Int8 > aEntireBlob = m_aBlob->getBytes( 1, m_aBlob->length());
OUString sEntireClob ( reinterpret_cast< sal_Char *>( aEntireBlob.getArray() ),
aEntireBlob.getLength(),
RTL_TEXTENCODING_UTF8 );
@@ -77,7 +78,10 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition,
uno::Reference< XInputStream > SAL_CALL Clob::getCharacterStream()
throw(SQLException, RuntimeException, std::exception)
{
- return m_aBlob.getBinaryStream();
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(Clob_BASE::rBHelper.bDisposed);
+
+ return m_aBlob->getBinaryStream();
}
sal_Int64 SAL_CALL Clob::position(const OUString& /*rPattern*/,
diff --git a/connectivity/source/drivers/firebird/Clob.hxx b/connectivity/source/drivers/firebird/Clob.hxx
index bbe47f6b8966..dfa40dedd484 100644
--- a/connectivity/source/drivers/firebird/Clob.hxx
+++ b/connectivity/source/drivers/firebird/Clob.hxx
@@ -16,6 +16,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/sdbc/XClob.hpp>
+#include <rtl/ref.hxx>
namespace connectivity
{
@@ -35,7 +36,7 @@ namespace connectivity
* hence we store the data in a Blob, and the Clob class is
* a wrapper around that.
*/
- connectivity::firebird::Blob m_aBlob;
+ rtl::Reference<connectivity::firebird::Blob> m_aBlob;
public:
Clob(isc_db_handle* pDatabaseHandle,