summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/ui/misc/datasourceconnector.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-07-10 14:37:21 +0000
committerOliver Bolte <obo@openoffice.org>2006-07-10 14:37:21 +0000
commita20ffa15bfc1248d3af9fa69a9abb0a0bcd774e3 (patch)
treeb688c98404d69507ca2a0e9ab38042a5e762a70b /dbaccess/source/ui/misc/datasourceconnector.cxx
parentINTEGRATION: CWS qiq (1.45.18); FILE MERGED (diff)
downloadcore-a20ffa15bfc1248d3af9fa69a9abb0a0bcd774e3.tar.gz
core-a20ffa15bfc1248d3af9fa69a9abb0a0bcd774e3.zip
INTEGRATION: CWS qiq (1.7.124); FILE MERGED
2006/06/27 12:48:56 fs 1.7.124.2: RESYNC: (1.7-1.8); FILE MERGED 2006/05/15 14:21:47 fs 1.7.124.1: #i51143# display warnings which were encountered during connecting to the database
Diffstat (limited to 'dbaccess/source/ui/misc/datasourceconnector.cxx')
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx66
1 files changed, 48 insertions, 18 deletions
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index f30ede8307d5..89dc7513e7cd 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: datasourceconnector.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: hr $ $Date: 2006-06-20 03:23:26 $
+ * last change: $Author: obo $ $Date: 2006-07-10 15:37:21 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -42,6 +42,9 @@
#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
#endif
+#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
@@ -78,6 +81,9 @@
#ifndef SVTOOLS_FILENOTATION_HXX
#include <svtools/filenotation.hxx>
#endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
#ifndef _DBU_MISC_HRC_
#include "dbu_misc.hrc"
#endif
@@ -197,22 +203,17 @@ namespace dbaui
{
if (bPwdRequired && !sPassword.getLength())
{ // password required, but empty -> connect using an interaction handler
- Reference< XCompletedConnection > xConnectionCompletion(_xDataSource, UNO_QUERY);
- if (!xConnectionCompletion.is())
+ Reference< XCompletedConnection > xConnectionCompletion( _xDataSource, UNO_QUERY_THROW );
+
+ // instantiate the default SDB interaction handler
+ Reference< XInteractionHandler > xHandler(m_xORB->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
+ if (!xHandler.is())
{
- OSL_ENSURE(sal_False, "ODatasourceConnector::connect: missing an interface ... need an error message here!");
+ ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True);
}
else
- { // instantiate the default SDB interaction handler
- Reference< XInteractionHandler > xHandler(m_xORB->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
- if (!xHandler.is())
- {
- ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True);
- }
- else
- {
- xConnection = xConnectionCompletion->connectWithCompletion(xHandler);
- }
+ {
+ xConnection = xConnectionCompletion->connectWithCompletion(xHandler);
}
}
else
@@ -223,10 +224,16 @@ namespace dbaui
catch(SQLContext& e) { aInfo = SQLExceptionInfo(e); }
catch(SQLWarning& e) { aInfo = SQLExceptionInfo(e); }
catch(SQLException& e) { aInfo = SQLExceptionInfo(e); }
- catch(Exception&) { OSL_ENSURE(sal_False, "SbaTableQueryBrowser::OnExpandEntry: could not connect - unknown exception!"); }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( !_bShowError )
+ return xConnection;
- // display the error (if any)
- if ( _bShowError && aInfo.isValid() )
+ // was there and error?
+ if ( aInfo.isValid() )
{
if ( m_sContextInformation.getLength() )
{
@@ -240,6 +247,29 @@ namespace dbaui
}
showError(aInfo, m_pErrorMessageParent, m_xORB);
+ return xConnection;
+ }
+
+ // was there a warning?
+ Reference< XWarningsSupplier > xConnectionWarnings( xConnection, UNO_QUERY );
+ if ( xConnectionWarnings.is() )
+ {
+ try
+ {
+ Any aWarnings( xConnectionWarnings->getWarnings() );
+ if ( aWarnings.hasValue() )
+ {
+ SQLContext aContext;
+ aContext.Message = String( ModuleRes( STR_WARNINGS_DURING_CONNECT ) );
+ aContext.NextException = aWarnings;
+ showError( SQLExceptionInfo( aContext ), m_pErrorMessageParent, m_xORB );
+ }
+ xConnectionWarnings->clearWarnings();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
return xConnection;