Tag: cws_src680_oj14 User: oj Date: 06/03/20 06:06:33 Modified: /dba/dbaccess/source/ui/tabledesign/ TableController.cxx
Log: RESYNC: (1.99-1.100); FILE MERGED 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.99.4.1&r2=1.99.4.2 Delta lines: +38 -6 -------------------- --- TableController.cxx 3 Jan 2006 07:49:27 -0000 1.99.4.1 +++ TableController.cxx 20 Mar 2006 14:06:30 -0000 1.99.4.2 @@ -1089,7 +1089,7 @@ sal_Bool bFoundPKey = sal_False; Reference< XDatabaseMetaData> xMetaData = getMetaData( ); - ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->storesMixedCaseQuotedIdentifiers() : sal_True); + ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True); ::std::vector<OTableRow*>::const_iterator aIter = m_vRowList.begin(); for(;aIter != m_vRowList.end();++aIter) { @@ -1177,7 +1177,7 @@ Reference< XDatabaseMetaData> xMetaData = getMetaData( ); - ::std::map< ::rtl::OUString,sal_Bool,::comphelper::UStringMixLess> aColumns(xMetaData.is() ? (xMetaData->storesMixedCaseQuotedIdentifiers() ? true : false): sal_True); + ::std::map< ::rtl::OUString,sal_Bool,::comphelper::UStringMixLess> aColumns(xMetaData.is() ? (xMetaData->supportsMixedCaseQuotedIdentifiers() ? true : false): sal_True); ::std::vector<OTableRow*>::iterator aIter = m_vRowList.begin(); ::std::vector<OTableRow*>::iterator aEnd = m_vRowList.end(); // first look for columns where something other than the name changed @@ -1330,6 +1330,19 @@ catch(const SQLException&) { // we couldn't alter the column so we have to add new columns bReload = sal_True; + if(xDrop.is() && xAppend.is()) + { + String aMessage(ModuleRes(STR_TABLEDESIGN_ALTER_ERROR)); + aMessage.SearchAndReplaceAscii("$column$",pField->GetName()); + String sTitle(ModuleRes(STR_STAT_WARNING)); + OSQLMessageBox aMsg(getView(),sTitle,aMessage,WB_YES_NO|WB_DEF_YES,OSQLMessageBox::Warning); + if ( aMsg.Execute() != RET_YES ) + { + continue; + } + } + else + throw; } } else @@ -1470,8 +1483,27 @@ 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<OTableRow*>::iterator aIter = m_vRowList.begin(); + ::std::vector<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; } } @@ -1576,7 +1608,7 @@ ::rtl::OUString sName = _rName; Reference< XDatabaseMetaData> xMetaData = getMetaData( ); - ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->storesMixedCaseQuotedIdentifiers() : sal_True); + ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True); ::std::vector<OTableRow*>::const_iterator aIter = m_vRowList.begin(); for(sal_Int32 i=0;aIter != m_vRowList.end();++aIter) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
