diff options
author | Andreas Bille <abi@openoffice.org> | 2001-04-25 08:09:34 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-04-25 08:09:34 +0000 |
commit | f455dc90e8694e9fea87a0b30421a60d7ae0f9ec (patch) | |
tree | 49c87455ddfe244a3c0f1eff4f910235a89e3afd /ucb | |
parent | f6ccbb73516ea751b484a4590a45ce2c06f6b6d7 (diff) |
Performance improvement in XResultSet_impl::absolute
by Darryl Gove
Somewhat un-understandable, bad compiler optimization?
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/file/filrset.cxx | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index deef29fc4763..f3b4a7370777 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filrset.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: hro $ $Date: 2001-04-03 12:06:25 $ + * last change: $Author: abi $ $Date: 2001-04-25 09:09:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -613,31 +613,63 @@ XResultSet_impl::getRow( } -sal_Bool SAL_CALL -XResultSet_impl::absolute( - sal_Int32 row ) - throw( sdbc::SQLException, - uno::RuntimeException) +// sal_Bool SAL_CALL +// XResultSet_impl::absolute( +// sal_Int32 row ) +// throw( sdbc::SQLException, +// uno::RuntimeException) +// { +// if( !row ) +// throw sdbc::SQLException(); + +// if( row >= 0 ) +// { +// m_nRow = -1; +// while( row-- ) next(); +// } +// else +// { +// row = - row - 1; +// last(); +// while( row-- ) --m_nRow; +// } + +// return 0<= m_nRow && m_nRow < m_aItems.size(); +// } + + +sal_Bool SAL_CALL XResultSet_impl::absolute( sal_Int32 row ) + throw( sdbc::SQLException, uno::RuntimeException) { - if( !row ) - throw sdbc::SQLException(); + if( ! row ) + throw sdbc::SQLException(); if( row >= 0 ) { - m_nRow = -1; - while( row-- ) next(); + // By Darryl Gove : + // m_nRow = -1; + if( row >= m_aItems.size() ) + { + m_nRow=row; + while( ( row-- >=0 ) && ( OneMore() ) ) + ; + } + else + m_nRow=row; } else { row = - row - 1; last(); - while( row-- ) --m_nRow; + while( row-- ) + --m_nRow; } return 0<= m_nRow && m_nRow < m_aItems.size(); } + sal_Bool SAL_CALL XResultSet_impl::relative( sal_Int32 row ) |