User: obo Date: 06/01/19 07:45:16 Modified: /dba/dbaccess/source/ui/tabledesign/ TableController.cxx
Log: INTEGRATION: CWS dba202e (1.99.56); FILE MERGED 2006/01/03 12:14:33 oj 1.99.56.1: #i59584# check if exception was thrown 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&r2=1.100 Delta lines: +35 -3 -------------------- --- TableController.cxx 23 Sep 2005 12:45:53 -0000 1.99 +++ TableController.cxx 19 Jan 2006 15:45:13 -0000 1.100 @@ -1104,7 +1104,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) { @@ -1192,7 +1192,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 @@ -1345,6 +1345,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 @@ -1485,8 +1498,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; } } @@ -1591,7 +1623,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]
