User: obo     
Date: 2006/07/10 08:37:24

Modified:
   dba/dbaccess/source/ui/misc/datasourceconnector.cxx

Log:
 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

File Changes:

Directory: /dba/dbaccess/source/ui/misc/
========================================

File [changed]: datasourceconnector.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/datasourceconnector.cxx?r1=1.8&r2=1.9
Delta lines:  +49 -19
---------------------
--- datasourceconnector.cxx     20 Jun 2006 03:23:26 -0000      1.8
+++ datasourceconnector.cxx     10 Jul 2006 15:37:21 -0000      1.9
@@ -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,13 +203,9 @@
                {
                        if (bPwdRequired && !sPassword.getLength())
                        {       // password required, but empty -> connect 
using an interaction handler
-                               Reference< XCompletedConnection > 
xConnectionCompletion(_xDataSource, UNO_QUERY);
-                               if (!xConnectionCompletion.is())
-                               {
-                                       OSL_ENSURE(sal_False, 
"ODatasourceConnector::connect: missing an interface ... need an error message 
here!");
-                               }
-                               else
-                               {       // instantiate the default SDB 
interaction handler
+                               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())
                                        {
@@ -214,7 +216,6 @@
                                                xConnection = 
xConnectionCompletion->connectWithCompletion(xHandler);
                                        }
                                }
-                       }
                        else
                        {
                                xConnection = 
_xDataSource->getConnection(sUser, sPassword);
@@ -223,10 +224,16 @@
                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 @@
                        }
 
                        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;




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to