Tag: cws_dev300_dba30c
User: oj      
Date: 2008-05-05 12:50:50+0000
Modified:
   dba/dbaccess/source/ui/tabledesign/TableController.cxx

Log:
 #i87421# check if primary was already append by column append

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.119&r2=1.119.4.1
Delta lines:  +16 -3
--------------------
--- TableController.cxx 2008-04-10 16:40:26+0000        1.119
+++ TableController.cxx 2008-05-05 12:50:46+0000        1.119.4.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableController.cxx,v $
- * $Revision: 1.119 $
+ * $Revision: 1.119.4.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -861,7 +861,20 @@
                return; // the database doesn't support keys
 
        OSL_ENSURE(_rxSup.is(),"No XKeysSupplier!");
-       Reference<XDataDescriptorFactory> 
xKeyFactory(_rxSup->getKeys(),UNO_QUERY);
+    Reference<XIndexAccess> xKeys(_rxSup->getKeys(),UNO_QUERY);
+    Reference<XPropertySet> xProp;
+    const sal_Int32 nCount = xKeys->getCount();
+       for(sal_Int32 i=0;i< nCount ;++i)
+       {
+               xKeys->getByIndex(i) >>= xProp;
+               sal_Int32 nKeyType = 0;
+               xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+               if(KeyType::PRIMARY == nKeyType)
+               {
+            return; // primary key already exists after appending a column
+               }
+       }
+       Reference<XDataDescriptorFactory> xKeyFactory(xKeys,UNO_QUERY);
        OSL_ENSURE(xKeyFactory.is(),"No XDataDescriptorFactory Interface!");
        if ( !xKeyFactory.is() )
                return;




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

Reply via email to