Tag: cws_src680_dba24d
User: fs      
Date: 2007-11-18 12:48:22+0000
Modified:
   dba/dbaccess/source/ui/misc/WCopyTable.cxx

Log:
 don't allow creating views if source and target DB differ

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.4&r2=1.53.28.5
Delta lines:  +12 -2
--------------------
--- WCopyTable.cxx      2007-11-17 21:13:41+0000        1.53.28.4
+++ WCopyTable.cxx      2007-11-18 12:48:20+0000        1.53.28.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: WCopyTable.cxx,v $
  *
- *  $Revision: 1.53.28.4 $
+ *  $Revision: 1.53.28.5 $
  *
- *  last change: $Author: fs $ $Date: 2007/11/17 21:13:41 $
+ *  last change: $Author: fs $ $Date: 2007/11/18 12:48:20 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -527,6 +527,13 @@
                    xViewFac.set( xSup->getViews(), UNO_QUERY );
         return xViewFac.is();
     }
+
+    bool lcl_sameConnection_throw( const Reference< XConnection >& _rxLHS, 
const Reference< XConnection >& _rxRHS )
+    {
+        Reference< XDatabaseMetaData > xMetaLHS( _rxLHS->getMetaData(), 
UNO_QUERY_THROW );
+        Reference< XDatabaseMetaData > xMetaRHS( _rxRHS->getMetaData(), 
UNO_QUERY_THROW );
+        return xMetaLHS->getURL().equals( xMetaRHS->getURL() );
+    }
 }
 
 //========================================================================
@@ -597,6 +604,9 @@
     // no views if the target connection does not support creating them
     if ( !lcl_canCreateViewFor_nothrow( m_xDestConnection ) )
         bAllowViews = false;
+    // no views if we're copying to a different database
+    if ( !lcl_sameConnection_throw( _xSourceConnection, m_xDestConnection ) )
+        bAllowViews = false;
 
        OCopyTable* pPage1( new OCopyTable( this ) );
     if ( !bAllowViews )




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

Reply via email to