#87690# don't set connections on rowsets permanently - instead dispose connections which we created ourself upon switching to a new object

This commit is contained in:
Frank Schönheit 2001-08-06 13:52:59 +00:00
parent 4b9b946368
commit c37c90364a
3 changed files with 68 additions and 15 deletions

View file

@ -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/*
*

View file

@ -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
*

View file

@ -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
*