Tag: cws_src680_dba25 User: oj Date: 05/03/07 00:00:19 Modified: /dba/dbaccess/source/core/api/ KeySet.cxx, KeySet.hxx, RowSetCache.cxx
Log: #i37076# set default value in insert row when the column is not modified File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: KeySet.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/KeySet.cxx?r1=1.55.4.1&r2=1.55.4.2 Delta lines: +24 -12 --------------------- --- KeySet.cxx 2 Mar 2005 09:45:33 -0000 1.55.4.1 +++ KeySet.cxx 7 Mar 2005 08:00:15 -0000 1.55.4.2 @@ -2,9 +2,9 @@ * * $RCSfile: KeySet.cxx,v $ * - * $Revision: 1.55.4.1 $ + * $Revision: 1.55.4.2 $ * - * last change: $Author: oj $ $Date: 2005/03/02 09:45:33 $ + * last change: $Author: oj $ $Date: 2005/03/07 08:00:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -524,7 +524,7 @@ if((*_rInsertRow)[nPos].isModified()) { (*_rInsertRow)[nPos].setSigned((*_rOrginalRow)[nPos].isSigned()); - setParameter(i++,xParameter,(*_rInsertRow)[nPos],aIter->second.second); + setParameter(i++,xParameter,(*_rInsertRow)[nPos],aIter->second.second.first); } } // and then the values of the where condition @@ -532,7 +532,7 @@ j = 0; for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i,++j) { - setParameter(i,xParameter,(*_rOrginalRow)[aIter->second.first],aIter->second.second); + setParameter(i,xParameter,(*_rOrginalRow)[aIter->second.first],aIter->second.second.first); } // now we have to set the index values @@ -608,7 +608,7 @@ else { (*_rInsertRow)[nPos].setSigned(m_aSignedFlags[nPos-1]); - setParameter(i++,xParameter,(*_rInsertRow)[nPos],aPosIter->second.second); + setParameter(i++,xParameter,(*_rInsertRow)[nPos],aPosIter->second.second.first); } } } @@ -617,6 +617,13 @@ sal_Bool bAutoValuesFetched = sal_False; if ( m_bInserted ) { + // first insert the default values into the insertrow + OColumnNamePos::const_iterator aIter = m_pColumnNames->begin(); + for(;aIter != m_pColumnNames->end();++aIter) + { + if ( !(*_rInsertRow)[aIter->second.first].isModified() ) + (*_rInsertRow)[aIter->second.first] = aIter->second.second.second; + } try { Reference< XGeneratedResultSet > xGRes(xPrep, UNO_QUERY); @@ -638,7 +645,7 @@ #endif OColumnNamePos::iterator aFind = m_pKeyColumnNames->find(*aAutoIter); if(aFind != m_pKeyColumnNames->end()) - fetchValue(i,aFind->second.second,xRow,(*_rInsertRow)[aFind->second.first]); + fetchValue(i,aFind->second.second.first,xRow,(*_rInsertRow)[aFind->second.first]); } bAutoValuesFetched = sal_True; } @@ -652,7 +659,7 @@ ::comphelper::disposeComponent(xPrep); - if ( !bAutoValuesFetched ) + if ( !bAutoValuesFetched && m_bInserted ) { // first check if all key column values were set ::rtl::OUString sQuote = getIdentifierQuoteString(); @@ -685,12 +692,13 @@ if(xRow.is() && xRes->next()) { aAutoIter = m_aAutoColumns.begin(); - for (sal_Int32 i=1;aAutoIter != m_aAutoColumns.end(); ++aAutoIter,++i) + ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end(); + for (sal_Int32 i=1;aAutoIter != aAutoEnd; ++aAutoIter,++i) { // we will only fetch values which are keycolumns OColumnNamePos::iterator aFind = m_pKeyColumnNames->find(*aAutoIter); if(aFind != m_pKeyColumnNames->end()) - fetchValue(i,aFind->second.second,xRow,(*_rInsertRow)[aFind->second.first]); + fetchValue(i,aFind->second.second.first,xRow,(*_rInsertRow)[aFind->second.first]); } } ::comphelper::disposeComponent(xStatement); @@ -795,7 +803,7 @@ i = 1; for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i) { - setParameter(i,xParameter,(*_rDeleteRow)[aIter->second.first],aIter->second.second); + setParameter(i,xParameter,(*_rDeleteRow)[aIter->second.first],aIter->second.second.first); } // now we have to set the index values @@ -1055,7 +1063,7 @@ for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter,++aIter) { const TPositionTypePair& rPair = aPosIter->second; - fetchValue(rPair.first,rPair.second,m_xDriverRow,*aIter); + fetchValue(rPair.first,rPair.second.first,m_xDriverRow,*aIter); } m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(m_aKeyMap.rbegin()->first+1,OKeySetValue(aKeyRow,0))).first; } @@ -1277,7 +1285,11 @@ { sal_Int32 nType; xColumnProp->getPropertyValue(PROPERTY_TYPE) >>= nType; - _rColumnNames[sRealName] = TPositionTypePair(nPos,nType); + ::rtl::OUString sColumnDefault; + if ( xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE) ) + xColumnProp->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sColumnDefault; + + _rColumnNames[sRealName] = TPositionTypePair(nPos,TTypeDefaultValuePair(nType,sColumnDefault)); break; } } File [changed]: KeySet.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/KeySet.hxx?r1=1.20&r2=1.20.50.1 Delta lines: +5 -4 ------------------- --- KeySet.hxx 17 Nov 2004 14:41:36 -0000 1.20 +++ KeySet.hxx 7 Mar 2005 08:00:16 -0000 1.20.50.1 @@ -2,9 +2,9 @@ * * $RCSfile: KeySet.hxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.20.50.1 $ * - * last change: $Author: obo $ $Date: 2004/11/17 14:41:36 $ + * last change: $Author: oj $ $Date: 2005/03/07 08:00:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,7 +84,8 @@ namespace dbaccess { - typedef ::std::pair<sal_Int32,sal_Int32> TPositionTypePair; + typedef ::std::pair<sal_Int32,::rtl::OUString> TTypeDefaultValuePair; + typedef ::std::pair<sal_Int32,TTypeDefaultValuePair> TPositionTypePair; DECLARE_STL_MAP(::rtl::OUString, TPositionTypePair,::comphelper::UStringMixLess,OColumnNamePos); // the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME File [changed]: RowSetCache.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.cxx?r1=1.74&r2=1.74.50.1 Delta lines: +4 -4 ------------------- --- RowSetCache.cxx 17 Nov 2004 14:42:39 -0000 1.74 +++ RowSetCache.cxx 7 Mar 2005 08:00:16 -0000 1.74.50.1 @@ -2,9 +2,9 @@ * * $RCSfile: RowSetCache.cxx,v $ * - * $Revision: 1.74 $ + * $Revision: 1.74.50.1 $ * - * last change: $Author: obo $ $Date: 2004/11/17 14:42:39 $ + * last change: $Author: oj $ $Date: 2005/03/07 08:00:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1717,7 +1717,7 @@ { sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1; OSL_ENSURE(nValue >= 0 && nValue < static_cast<sal_Int32>(m_pMatrix->size()),"Position is invalid!"); - return ( nValue < 0 || nValue >= m_pMatrix->size() ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue); + return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue); } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
