summaryrefslogtreecommitdiff
path: root/extensions/source
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2001-08-06 13:52:59 +0000
committerFrank Schönheit <fs@openoffice.org>2001-08-06 13:52:59 +0000
commitc37c90364a9bb41d528f2b0ed65561c154d1c283 (patch)
treeab14028b549c444d0afe8397eb2e39396ded8956 /extensions/source
parent4b9b94636874a9768d3d7861cf52fa3efc74419c (diff)
#87690# don't set connections on rowsets permanently - instead dispose connections which we created ourself upon switching to a new object
Diffstat (limited to 'extensions/source')
-rw-r--r--extensions/source/propctrlr/formcontroller.cxx50
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx10
-rw-r--r--extensions/source/propctrlr/propcontroller.hxx23
3 files changed, 68 insertions, 15 deletions
diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx
index 691d44cb2a83..271a538e1c8f 100644
--- a/extensions/source/propctrlr/formcontroller.cxx
+++ b/extensions/source/propctrlr/formcontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: formcontroller.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: fs $ $Date: 2001-07-23 13:33:33 $
+ * last change: $Author: fs $ $Date: 2001-08-06 14:52:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -987,20 +987,47 @@ namespace pcr
}
//------------------------------------------------------------------------
- void OPropertyBrowserController::recalcConnection()
+ void OPropertyBrowserController::cleanupRowsetConnection()
{
+ Reference< XComponent > xConnComp( m_xRowsetConnection, UNO_QUERY );
+ if ( xConnComp.is() )
+ xConnComp->dispose();
+ m_xRowsetConnection.clear();
+ }
+
+ //------------------------------------------------------------------------
+ void OPropertyBrowserController::connectRowset()
+ {
+ // if we have a previous connection, dispose it
+ if ( haveRowsetConnection() )
+ cleanupRowsetConnection();
+
SQLExceptionInfo aErrorInfo;
try
{
+ // the rowset
Reference< XRowSet > xRowSet(m_xPropValueAccess, UNO_QUERY);
if (xRowSet.is())
- if (m_pView)
{
- WaitObject aWaitCursor(m_pView);
- ::dbtools::calcConnection(xRowSet,m_xORB);
+ // does the rowset already have a connection?
+ Reference< XConnection > xConnection = ::dbtools::getConnection( xRowSet );
+
+ if ( !xConnection.is() )
+ { // no -> calculate one
+ if (m_pView)
+ {
+ WaitObject aWaitCursor(m_pView);
+ xConnection = ::dbtools::connectRowset( xRowSet, m_xORB, sal_False );
+ }
+ else
+ {
+ xConnection = ::dbtools::connectRowset( xRowSet, m_xORB, sal_False );
+ }
+ // remember for later disposal
+ // (we opened the connection, thus we own it)
+ m_xRowsetConnection = xConnection;
+ }
}
- else
- ::dbtools::calcConnection(xRowSet,m_xORB);
}
catch (SQLContext& e) { aErrorInfo = e; }
catch (SQLWarning& e) { aErrorInfo = e; }
@@ -1049,7 +1076,7 @@ namespace pcr
aProperty.sValue = String();
if (bInit)
- recalcConnection();
+ connectRowset();
////////////////////////////////////////////////////////////
// Enums setzen
@@ -2488,7 +2515,7 @@ namespace pcr
// try to open a connection for the new data source. Needed for filling the table list etc., but the methods doing this
// don't display errors, and we want to have an error message.
- recalcConnection();
+ connectRowset();
SetCursorSource(sal_False);
SetListSource();
@@ -2519,6 +2546,9 @@ namespace pcr
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.37 2001/07/23 13:33:33 fs
+ * #900071# correctly call XFilePickerControlAccess::setValue
+ *
* Revision 1.36 2001/06/15 10:26:46 fs
* #86986# moved css/ui/* to css/ui/dialogs/*
*
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 42da25436c8f..eb45ca89a120 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: propcontroller.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: fs $ $Date: 2001-06-11 11:33:04 $
+ * last change: $Author: fs $ $Date: 2001-08-06 14:52:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -696,6 +696,9 @@ namespace pcr
m_nClassId = 0;
m_bHasListSource = m_bHasCursorSource = sal_False;
+
+ // and some heavily form specific stuff, again
+ cleanupRowsetConnection();
}
//------------------------------------------------------------------------
@@ -1047,6 +1050,9 @@ namespace pcr
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.14 2001/06/11 11:33:04 fs
+ * #86096# changed the implementation name for consistency
+ *
* Revision 1.13 2001/05/30 13:41:46 fs
* #86838# be a focus listener on the container window, forward the focus to the property box
*
diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx
index 558cb379ce4f..deac846cae54 100644
--- a/extensions/source/propctrlr/propcontroller.hxx
+++ b/extensions/source/propctrlr/propcontroller.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: propcontroller.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: fs $ $Date: 2001-06-11 11:32:48 $
+ * last change: $Author: fs $ $Date: 2001-08-06 14:52:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,7 +74,9 @@
#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTIONACCESS_HPP_
#include <com/sun/star/beans/XIntrospectionAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
@@ -123,7 +125,12 @@
#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
#include <comphelper/propertycontainer.hxx>
#endif
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
#endif
@@ -182,6 +189,9 @@ namespace pcr
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
m_xView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xRowsetConnection;
+
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xIntrospecteeAsProperty;
@@ -340,7 +350,11 @@ namespace pcr
void SetListSource(sal_Bool _bInit = sal_False);
void SetStringSeq(const ::com::sun::star::beans::Property& rProperty, OLineDescriptor& _rUIData);
- void recalcConnection();
+
+ void connectRowset();
+ void cleanupRowsetConnection();
+ sal_Bool haveRowsetConnection( ) const { return m_xRowsetConnection.is(); }
+
sal_uInt32 GetPropertyPos(const ::rtl::OUString& _rPropName);
::rtl::OUString GetPropertyValue(const ::rtl::OUString& _rPropName);
@@ -391,6 +405,9 @@ namespace pcr
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.10 2001/06/11 11:32:48 fs
+ * #86096# changed the property ids
+ *
* Revision 1.9 2001/06/06 08:14:28 fs
* #86096# +implGetInt32FontProperty / +implInvalidateItem
*