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