User: rt      
Date: 2008-06-06 14:14:17+0000
Modified:
   dba/dbaccess/source/ui/relationdesign/RelationController.cxx

Log:
 INTEGRATION: CWS dba30c (1.53.4); FILE MERGED
 2008/05/09 08:24:39 oj 1.53.4.2: RESYNC: (1.53-1.54); FILE MERGED
 2008/05/05 11:13:38 oj 1.53.4.1: #i87131# collect keys only once, getKeys 
always refetch keys

File Changes:

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

File [changed]: RelationController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/relationdesign/RelationController.cxx?r1=1.54&r2=1.55
Delta lines:  +85 -79
---------------------
--- RelationController.cxx      2008-05-05 16:07:47+0000        1.54
+++ RelationController.cxx      2008-06-06 14:14:14+0000        1.55
@@ -415,37 +415,42 @@
 // 
-----------------------------------------------------------------------------
 void ORelationController::loadTableData(const Any& _aTable)
 {
-       Reference<XIndexAccess> xKeys;
-    Reference<XKeysSupplier> xKeySup(_aTable,UNO_QUERY);
+    Reference<XPropertySet> xTableProp(_aTable,UNO_QUERY);
+    const ::rtl::OUString sSourceName = ::dbtools::composeTableName( 
getConnection()->getMetaData(), xTableProp, ::dbtools::eInTableDefinitions, 
false, false, false );
+    TTableWindowData::value_type pReferencingTable = existsTable(sSourceName);
+    bool bNotFound = true, bAdded = false;
+    if ( !pReferencingTable )
+       {
+               pReferencingTable.reset(new 
OTableWindowData(xTableProp,sSourceName, sSourceName));
+               pReferencingTable->ShowAll(FALSE);
+        bAdded = true;
+               m_vTableData.push_back(pReferencingTable);
+       }
+
+       Reference<XIndexAccess> xKeys = pReferencingTable->getKeys();
+    Reference<XKeysSupplier> xKeySup(xTableProp,UNO_QUERY);
        
-       if ( xKeySup.is() )
+       if ( !xKeys.is() && xKeySup.is() )
        {
                xKeys = xKeySup->getKeys();
+    }
+    
                if ( xKeys.is() )
                {
-            Reference<XPropertySet> xTableProp(xKeySup,UNO_QUERY);
                        Reference<XPropertySet> xKey;
-                       for(sal_Int32 i=0;i< xKeys->getCount();++i)
+        const sal_Int32 nCount = xKeys->getCount();
+               for(sal_Int32 i = 0 ; i < nCount ; ++i)
                        {
                                xKeys->getByIndex(i) >>= xKey;
                                sal_Int32 nKeyType = 0;
                                xKey->getPropertyValue(PROPERTY_TYPE) >>= 
nKeyType;
                                if ( KeyType::FOREIGN == nKeyType )
                                {
-                                       ::rtl::OUString 
sSourceName,sReferencedTable;
-
-                                       sSourceName = 
::dbtools::composeTableName( getConnection()->getMetaData(), xTableProp, 
::dbtools::eInTableDefinitions, false, false, false );
+                bNotFound = false;
+                               ::rtl::OUString sReferencedTable;
                                        
xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
                                        
//////////////////////////////////////////////////////////////////////
                                        // insert windows
-                    TTableWindowData::value_type pReferencingTable = 
existsTable(sSourceName);
-                                       if ( !pReferencingTable )
-                                       {
-                                               pReferencingTable.reset(new 
OTableWindowData(xTableProp,sSourceName, sSourceName));
-                                               
pReferencingTable->ShowAll(FALSE);
-                                               
m_vTableData.push_back(pReferencingTable);
-                                       }
-
                     TTableWindowData::value_type pReferencedTable = 
existsTable(sReferencedTable);
                                        if ( !pReferencedTable )
                                        {
@@ -502,8 +507,9 @@
                                        pTabConnData->SetCardinality();
                                }
                        }
-               }
-       }
+       } // if ( xKeys.is() )
+    if ( bNotFound && bAdded ) 
+        m_vTableData.pop_back();
 }
 // 
-----------------------------------------------------------------------------
 TTableWindowData::value_type ORelationController::existsTable(const 
::rtl::OUString& _rComposedTableName)  const




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

Reply via email to