Tag: cws_src680_dba24d
User: fs      
Date: 2007-11-17 21:13:43+0000
Modified:
   dba/dbaccess/source/ui/misc/WCopyTable.cxx

Log:
 #i81658# disallow views when target connection does not support creating them

File Changes:

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

File [changed]: WCopyTable.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/WCopyTable.cxx?r1=1.53.28.3&r2=1.53.28.4
Delta lines:  +26 -5
--------------------
--- WCopyTable.cxx      2007-11-15 15:16:46+0000        1.53.28.3
+++ WCopyTable.cxx      2007-11-17 21:13:41+0000        1.53.28.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: WCopyTable.cxx,v $
  *
- *  $Revision: 1.53.28.3 $
+ *  $Revision: 1.53.28.4 $
  *
- *  last change: $Author: fs $ $Date: 2007/11/15 15:16:46 $
+ *  last change: $Author: fs $ $Date: 2007/11/17 21:13:41 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -516,6 +516,19 @@
     return ::rtl::OUString();
 }
 
+//------------------------------------------------------------------------
+namespace
+{
+    bool lcl_canCreateViewFor_nothrow( const Reference< XConnection >& 
_rxConnection )
+    {
+           Reference< XViewsSupplier > xSup( _rxConnection, UNO_QUERY );
+           Reference< XDataDescriptorFactory > xViewFac;
+           if ( xSup.is() )
+                   xViewFac.set( xSup->getViews(), UNO_QUERY );
+        return xViewFac.is();
+    }
+}
+
 //========================================================================
 //= OCopyTableWizard
 //========================================================================
@@ -576,9 +589,17 @@
        ::dbaui::fillTypeInfo( m_xDestConnection, m_sTypeNames, 
m_aDestTypeInfo, m_aDestTypeInfoIndex );
        impl_loadSourceData();
 
-       OCopyTable* pPage1( new OCopyTable( this ) );
+    bool bAllowViews = true;
+    // if the source is a, don't allow creating views #100644# (oj)
+    // (fs: Hmm? A SELECT * FROM <view> would be created, where #100644# 
claims this is nonsense. Why?
     if ( m_rSourceObject.isView() )
-        // if it is a view disable the view checkbox #100644#
+        bAllowViews = false;
+    // no views if the target connection does not support creating them
+    if ( !lcl_canCreateViewFor_nothrow( m_xDestConnection ) )
+        bAllowViews = false;
+
+       OCopyTable* pPage1( new OCopyTable( this ) );
+    if ( !bAllowViews )
         pPage1->disallowViews();
        pPage1->setCreateStyleAction();
        AddWizardPage(pPage1);




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

Reply via email to