Tag: cws_src680_dba24a
User: oj      
Date: 2007-08-28 08:56:34+0000
Modified:
   dba/dbaccess/source/ui/tabledesign/TableController.cxx

Log:
 #i76186# do not reset primary key flag

File Changes:

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

File [changed]: TableController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/tabledesign/TableController.cxx?r1=1.112&r2=1.112.18.1
Delta lines:  +31 -42
---------------------
--- TableController.cxx 2007-07-06 08:43:02+0000        1.112
+++ TableController.cxx 2007-08-28 08:56:32+0000        1.112.18.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: TableController.cxx,v $
  *
- *  $Revision: 1.112 $
+ *  $Revision: 1.112.18.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/06 08:43:02 $
+ *  last change: $Author: oj $ $Date: 2007/08/28 08:56:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1481,6 +1481,8 @@
 // 
-----------------------------------------------------------------------------
 void OTableController::dropPrimaryKey()
 {
+    try
+    {
        Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
        Reference<XIndexAccess> xKeys;
        if(xKeySup.is())
@@ -1491,36 +1493,23 @@
                Reference<XPropertySet> xProp;
                for(sal_Int32 i=0;i< xKeys->getCount();++i)
                {
-                       xKeys->getByIndex(i) >>= xProp;
+                xProp.set(xKeys->getByIndex(i),UNO_QUERY);
                        sal_Int32 nKeyType = 0;
                        xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
                        if(KeyType::PRIMARY == nKeyType)
                        {
-                               Reference<XNameAccess> xKeyColumns      = 
getKeyColumns();
-                               Sequence< ::rtl::OUString> aColumnNames = 
xKeyColumns->getElementNames();
-                               xKeyColumns = NULL;
                                Reference<XDrop> xDrop(xKeys,UNO_QUERY);
                                xDrop->dropByIndex(i); // delete the key
-                               ::std::vector< ::boost::shared_ptr<OTableRow> 
>::iterator aIter = m_vRowList.begin();
-                               ::std::vector< ::boost::shared_ptr<OTableRow> 
>::iterator aEnd = m_vRowList.end();
-                               for(;aIter != aEnd;++aIter)
-                               {
-                                       OSL_ENSURE(*aIter,"OTableRow is null!");
-                                       OFieldDescription* pField = 
(*aIter)->GetActFieldDescr();
-                                       if ( !pField )
-                                               continue;
-                                       ::rtl::OUString sName = 
pField->GetName();
-                                       const ::rtl::OUString* pIter = 
aColumnNames.getConstArray();
-                                       const ::rtl::OUString* pEnd = pIter + 
aColumnNames.getLength();
-                                       for(;pIter != pEnd && *pIter != 
sName;++pIter)
-                                               ;
-                                       if ( pIter != pEnd )
-                                               
pField->SetPrimaryKey(sal_False);
-                               }
                                break;
                        }
                }
        }
+    }
+    catch(Exception&)
+    {
+        OSL_ENSURE(0,"Exception caught!");
+    }
+
 }
 // 
-----------------------------------------------------------------------------
 void OTableController::assignTable() 




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

Reply via email to