On Sat, Mar 30, 2013 at 08:07:15AM -0700, julien2412 [via Document Foundation Mail Archive] wrote:
<br/><br/>> I noticed that a variable wasn't incremented in this loop:
<br/><div class='shrinkable-quote'><br/>> 1772 void OResultSet::clearInsertRow()
<br/>> 1773 {
<br/>> ...
<br/>> 1778 for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
<br/>> 1779 {
<br/>> 1780 ORowSetValueDecoratorRef& rValue = (*aIter);
<br/>> 1781 if ( rValue->isBound() )
<br/>> 1782 {
<br/>> 1783 (m_aRow->get())[nPos]->setValue( (*aIter)->getValue() );
<br/>> 1784 }
<br/>> 1785 rValue->setBound(nPos == 0);
<br/>> 1786 rValue->setModified(sal_False);
<br/>> 1787 rValue->setNull();
<br/>> 1788 }
<br/>> 1789 }
</div><br/>> See
<br/>> <a href="http://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/file/FResultSet.cxx#1772" target="_top" rel="nofollow" link="external">http://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/file/FResultSet.cxx#1772</a><br/><br/>Which variable is not incremented? I don't see what is not
<br/>incremented; both aIter and nPos are incremented, by the statement
<br/>"++aIter,++nPos"
<br/><div class='shrinkable-quote'><br/>> I searched about "clearInsertRow" and found this method:
<br/>> 1638 void ORowSetCache::clearInsertRow()
<br/>> 1639 {
<br/>> 1640 // we don't unbound the bookmark column
<br/>> 1641 if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->is() )
<br/>> 1642 {
<br/>> 1643 ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
<br/>> 1644 ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
<br/>> 1645 for(;aIter != aEnd;++aIter)
<br/>> 1646 {
<br/>> 1647 aIter->setBound(sal_False);
<br/>> 1648 aIter->setModified(sal_False);
<br/>> 1649 aIter->setNull();
<br/>> 1650 }
<br/>> 1651 }
<br/>> 1652 }
<br/>> <a href="http://opengrok.libreoffice.org/xref/core/dbaccess/source/core/api/RowSetCache.cxx#1638" target="_top" rel="nofollow" link="external">http://opengrok.libreoffice.org/xref/core/dbaccess/source/core/api/RowSetCache.cxx#1638</a></div><br/>> I wonder if it's normal that these functions are different. For example,
<br/>> should we consider a bookmark column in first method?
<br/><br/>Well, one is in a specific driver and the other in a generic wrapper
<br/>/ cache, so the first may well make things specific to the underlying
<br/>database...
<br/><br/>Specifically, well, the first "treats" the bookmark column (which is
<br/>always and by definition the column 0; the normal columns are numbered
<br/>starting from 1), and sets it to bound.
<br/><br/>The second just skips the bookmark column.
<br/><br/>I don't immediately see anything wrong with the difference, but I
<br/>cannot explain it either, so basically I'm not sure there.
<br/><br/>> Then if it's ok, should we increment nPos in first one (...)
<br/><br/>nPos is incremented.
<br/><br/>--
<br/>Lionel
<br/>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://nabble.documentfoundation.org/About-clearInsertRow-connectivity-and-dbaccess-module-tp4047094p4047882.html">Re: About clearInsertRow() (connectivity and dbaccess module)</a><br/>
Sent from the <a href="http://nabble.documentfoundation.org/Dev-f1639786.html">Dev mailing list archive</a> at Nabble.com.<br/>