diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-10-30 14:17:57 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-10-30 14:17:57 +0000 |
commit | 633c2170b26e87d97242b385039a04764b06d790 (patch) | |
tree | 6eaa0524fbaeae2651d57ef06aaba6d30ad1a34f /extensions/source/propctrlr/formcontroller.cxx | |
parent | 73da475667dc994772e3a9037276dfddec606eff (diff) |
connectRowSet: better error message upon failure
Diffstat (limited to 'extensions/source/propctrlr/formcontroller.cxx')
-rw-r--r-- | extensions/source/propctrlr/formcontroller.cxx | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx index 254d46e9312d..1f1dc34de231 100644 --- a/extensions/source/propctrlr/formcontroller.cxx +++ b/extensions/source/propctrlr/formcontroller.cxx @@ -2,9 +2,9 @@ * * $RCSfile: formcontroller.cxx,v $ * - * $Revision: 1.44 $ + * $Revision: 1.45 $ * - * last change: $Author: tbe $ $Date: 2001-10-19 12:58:51 $ + * last change: $Author: fs $ $Date: 2001-10-30 15:17:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1041,7 +1041,27 @@ namespace pcr catch (Exception&) { } if (aErrorInfo.isValid() && haveView()) - showError(aErrorInfo, VCLUnoHelper::GetInterface(m_pView), m_xORB); + { + ::rtl::OUString sDataSourceName; + try + { + Reference< XPropertySet > xRSP( getRowSet(), UNO_QUERY ); + if ( xRSP.is() ) + xRSP->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDataSourceName; + } + catch( const Exception& ) + { + DBG_ERROR( "OPropertyBrowserController::connectRowset: caught an exception during error handling!" ); + } + // additional info about what happended + String sInfo( ModuleRes( RID_STR_UNABLETOCONNECT ) ); + sInfo.SearchAndReplaceAllAscii( "$name$", sDataSourceName ); + + SQLContext aContext; + aContext.Message = sInfo; + aContext.NextException = aErrorInfo.get(); + showError( aContext, VCLUnoHelper::GetInterface( m_pView ), m_xORB); + } } //------------------------------------------------------------------------ @@ -1081,17 +1101,22 @@ namespace pcr else aProperty.sValue = String(); - if (bInit) + if ( bInit ) connectRowset(); //////////////////////////////////////////////////////////// // Enums setzen - Sequence< ::rtl::OUString > aCommandTypes = m_pPropertyInfo->getPropertyEnumRepresentations(PROPERTY_ID_COMMANDTYPE); - sal_Int32 nPos = GetStringPos(sCommandType, aCommandTypes); - if (0 == nPos) - SetTables(aProperty); - else if (1 == nPos) - SetQueries(aProperty); + + sal_Bool bFailedToConnect = bInit && !haveRowsetConnection(); + if ( !bFailedToConnect ) + { + Sequence< ::rtl::OUString > aCommandTypes = m_pPropertyInfo->getPropertyEnumRepresentations(PROPERTY_ID_COMMANDTYPE); + sal_Int32 nPos = GetStringPos(sCommandType, aCommandTypes); + if (0 == nPos) + SetTables(aProperty); + else if (1 == nPos) + SetQueries(aProperty); + } getPropertyBox()->ChangeEntry(aProperty, getPropertyBox()->GetPropertyPos(aProperty.sName)); Commit(aProperty.sName, aProperty.sValue, NULL); @@ -2608,6 +2633,9 @@ namespace pcr /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.44 2001/10/19 12:58:51 tbe + * #92755# Assign Standard Values for Basic Controls in Designmode + * * Revision 1.43 2001/08/27 16:57:39 fs * #91537# changed the runtime representation for form (control) StarBasic script events (now with 'application' resp. 'document') * |