summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2001-04-12 05:30:10 +0000
committerFrank Schönheit <fs@openoffice.org>2001-04-12 05:30:10 +0000
commitebc2f2aa2a914f34f639a05774d92b0abf204db0 (patch)
tree3cc2eacf2f62026558842fea58076498274f687d /extensions
parent75a1dad40000f068276b3e69798c098ab2953f62 (diff)
#84694# +recalcConnection: show an error when trying to open a new connection
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/formcontroller.cxx57
1 files changed, 51 insertions, 6 deletions
diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx
index fb2051dda7c1..bfce301bfe1c 100644
--- a/extensions/source/propctrlr/formcontroller.cxx
+++ b/extensions/source/propctrlr/formcontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: formcontroller.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: fs $ $Date: 2001-04-03 12:44:06 $
+ * last change: $Author: fs $ $Date: 2001-04-12 06:30:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -150,6 +150,12 @@
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
#ifndef _NUMUNO_HXX
#include <svtools/numuno.hxx>
#endif
@@ -251,6 +257,9 @@
#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_
#include <com/sun/star/awt/FontStrikeout.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
+#include <com/sun/star/sdb/SQLContext.hpp>
+#endif
#ifndef _CTRLTOOL_HXX
#include <svtools/ctrltool.hxx>
#endif
@@ -321,6 +330,7 @@ namespace pcr
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
+ using namespace ::dbtools;
//========================================================================
//= helper
@@ -847,7 +857,7 @@ namespace pcr
Reference< XPropertySet > xField;
try
{
- Reference< XConnection > xConnection = ::dbtools::calcConnection(Reference< XRowSet > (xFormSet, UNO_QUERY),m_xORB);
+ Reference< XConnection > xConnection = ::dbtools::getConnection(Reference< XRowSet > (xFormSet, UNO_QUERY));
if (!xConnection.is())
return;
@@ -928,7 +938,7 @@ namespace pcr
Reference< XTablesSupplier > xTables;
try
{
- xTables = Reference< XTablesSupplier > (::dbtools::calcConnection(xRowSet,m_xORB),UNO_QUERY);
+ xTables = Reference< XTablesSupplier > (::dbtools::getConnection(xRowSet),UNO_QUERY);
}
catch (Exception&)
{
@@ -982,7 +992,7 @@ namespace pcr
Reference< XQueriesSupplier > xSupplyQueries;
try
{
- xSupplyQueries = Reference< XQueriesSupplier > (::dbtools::calcConnection(xRowSet,m_xORB),UNO_QUERY);
+ xSupplyQueries = Reference< XQueriesSupplier > (::dbtools::getConnection(xRowSet),UNO_QUERY);
}
catch (Exception&)
{
@@ -1010,6 +1020,31 @@ namespace pcr
}
//------------------------------------------------------------------------
+ void OPropertyBrowserController::recalcConnection()
+ {
+ SQLExceptionInfo aErrorInfo;
+ try
+ {
+ Reference< XRowSet > xRowSet(m_xPropValueAccess, UNO_QUERY);
+ if (xRowSet.is())
+ if (m_pView)
+ {
+ WaitObject aWaitCursor(m_pView);
+ ::dbtools::calcConnection(xRowSet,m_xORB);
+ }
+ else
+ ::dbtools::calcConnection(xRowSet,m_xORB);
+ }
+ catch (SQLContext& e) { aErrorInfo = e; }
+ catch (SQLWarning& e) { aErrorInfo = e; }
+ catch (SQLException& e) { aErrorInfo = e; }
+ catch (Exception&) { }
+
+ if (aErrorInfo.isValid() && haveView())
+ showError(aErrorInfo, VCLUnoHelper::GetInterface(m_pView), m_xORB);
+ }
+
+ //------------------------------------------------------------------------
void OPropertyBrowserController::SetCursorSource(sal_Bool bInit)
{
try
@@ -1047,6 +1082,9 @@ namespace pcr
else
aProperty.sValue = String();
+ if (bInit)
+ recalcConnection();
+
////////////////////////////////////////////////////////////
// Enums setzen
Sequence< ::rtl::OUString > aCommandTypes = m_pPropertyInfo->getPropertyEnumRepresentations(PROPERTY_ID_COMMANDTYPE);
@@ -2695,7 +2733,11 @@ namespace pcr
m_xPropStateAccess->setPropertyToDefault(rName);
}
- SetCursorSource();
+ // 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();
+
+ SetCursorSource(sal_False);
SetListSource();
}
}
@@ -2724,6 +2766,9 @@ namespace pcr
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.14 2001/04/03 12:44:06 fs
+ * corrected SetQueries for list-/combo boxes
+ *
* Revision 1.13 2001/03/21 15:42:13 fs
* #82696# use the new font dialog for changing the control font
*