Tag: cws_src680_dba30
User: fs      
Date: 2006/07/19 05:09:28

Modified:
   dba/dbaccess/source/core/api/RowSetCache.cxx

Log:
 RESYNC: (1.84-1.86); FILE MERGED

File Changes:

Directory: /dba/dbaccess/source/core/api/
=========================================

File [changed]: RowSetCache.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.cxx?r1=1.78.16.3&r2=1.78.16.4
Delta lines:  +44 -38
---------------------
--- RowSetCache.cxx     21 Mar 2006 18:21:04 -0000      1.78.16.3
+++ RowSetCache.cxx     19 Jul 2006 12:09:26 -0000      1.78.16.4
@@ -135,27 +135,28 @@
 ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                                                   const Reference< 
XSingleSelectQueryAnalyzer >& _xAnalyzer,
                                                   const Reference< 
XMultiServiceFactory >& _xServiceFactory,
-                                                  const ORowSetValueVector&    
_rParameterRow,
                                                   const ::rtl::OUString& 
_rUpdateTableName,
                                                   sal_Bool&    _bModified,
                                                   sal_Bool&    _bNew)
-       : m_xSet(_xRs)
+       :m_xSet(_xRs)
+       ,m_xMetaData(Reference< XResultSetMetaDataSupplier 
>(_xRs,UNO_QUERY)->getMetaData())
+       ,m_xServiceFactory(_xServiceFactory)
+       ,m_pCacheSet(NULL)
+       ,m_pMatrix(NULL)
+       ,m_pInsertMatrix(NULL)
+    ,m_nLastColumnIndex(0)
+       ,m_nFetchSize(0)
+       ,m_nRowCount(0)
+    ,m_nPrivileges( Privilege::SELECT )
+       ,m_nPosition(0)
        ,m_nStartPos(0)
        ,m_nEndPos(0)
-       ,m_nPosition(0)
-       ,m_nRowCount(0)
+       ,m_bRowCountFinal(sal_False)
        ,m_bBeforeFirst(sal_True)
        ,m_bAfterLast( sal_False )
-       ,m_bRowCountFinal(sal_False)
        ,m_bUpdated(sal_False)
-       ,m_xMetaData(Reference< XResultSetMetaDataSupplier 
>(_xRs,UNO_QUERY)->getMetaData())
-       ,m_xServiceFactory(_xServiceFactory)
-       ,m_nFetchSize(0)
-       ,m_bNew(_bNew)
        ,m_bModified(_bModified)
-       ,m_pMatrix(NULL)
-       ,m_pInsertMatrix(NULL)
-       ,m_pCacheSet(NULL)
+       ,m_bNew(_bNew)
 {
     DBG_CTOR(ORowSetCache,NULL);
 
@@ -229,7 +230,7 @@
                                                        {
                                                                
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
                                                                
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
-                                                               OColumnNamePos 
aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers() ? true : 
false);
+                                SelectColumnsMetaData aColumnNames(xMeta.is() 
&& xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false);
                                                                
::dbaccess::getColumnPositions(xSelColumns,xColumns,aUpdateTableName,aColumnNames);
                                                                bAllKeysFound = 
!aColumnNames.empty() && sal_Int32(aColumnNames.size()) == 
xColumns->getElementNames().getLength();
                                                        }
@@ -296,7 +297,7 @@
                else
                {
                        Reference<XDatabaseMetaData> xMeta = 
xConnection->getMetaData();
-                       OColumnNamePos aColumnNames(xMeta.is() && 
xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false);
+            SelectColumnsMetaData aColumnNames(xMeta.is() && 
xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false);
                        Reference<XColumnsSupplier> 
xColSup(_xAnalyzer,UNO_QUERY);
                        Reference<XNameAccess> xSelColumns      = 
xColSup->getColumns();
                        Reference<XNameAccess> xColumns         = 
m_aUpdateTable->getColumns();
@@ -420,7 +421,7 @@
                        if ( !aCacheIter->second.pRowSet->isInsertRow() 
                                && aCacheIter->second.aIterator != 
m_pMatrix->end() && !m_bModified )
                        {
-                               sal_Int16 nDist = (aCacheIter->second.aIterator 
- m_pMatrix->begin());
+                               ptrdiff_t nDist = (aCacheIter->second.aIterator 
- m_pMatrix->begin());
                                aPositions.push_back(nDist);
                                aCacheIterToChange[aCacheIter->first] = 
sal_True;
                        }
@@ -475,10 +476,9 @@
                case DataType::SMALLINT:
                case DataType::INTEGER:
                        return makeAny((sal_Int32)(*(*m_aMatrixIter))[0]);
-                       break;
                default:
                        if((*(*m_aMatrixIter))[0].isNull())
-                               (*(*m_aMatrixIter))[0] = 
m_pCacheSet->getBookmark(*m_aMatrixIter);
+                               (*(*m_aMatrixIter))[0] = 
m_pCacheSet->getBookmark();
                        return (*(*m_aMatrixIter))[0].getAny();
        }
 }
@@ -516,8 +516,8 @@
 sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 
rows )
 {
        
-       sal_Bool bRet;
-       if(bRet = moveToBookmark(bookmark))
+       sal_Bool bRet( moveToBookmark( bookmark ) );
+       if ( bRet )
        {
                m_nPosition = m_pCacheSet->getRow() + rows;
                absolute(m_nPosition);
@@ -529,9 +529,9 @@
        return bRet;
 }
 // -------------------------------------------------------------------------
-sal_Int32 ORowSetCache::compareBookmarks( const Any& first, const Any& second )
+sal_Int32 ORowSetCache::compareBookmarks( const Any& _first, const Any& 
_second )
 {
-       return (!first.hasValue() || !second.hasValue()) ? 
CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(first,second);
+       return (!_first.hasValue() || !_second.hasValue()) ? 
CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(_first,_second);
 }
 // -------------------------------------------------------------------------
 sal_Bool ORowSetCache::hasOrderedBookmarks(  )
@@ -591,7 +591,7 @@
        (*(*m_aInsertRow))[columnIndex].setModified();
 }
 // -------------------------------------------------------------------------
-void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, 
sal_Int32 scale )
+void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, 
sal_Int32 /*scale*/ )
 {
        checkUpdateConditions(columnIndex);
 
@@ -809,15 +809,15 @@
                                
::std::rotate(m_pMatrix->begin(),aEnd,m_pMatrix->end());
                                // now correct the iterator in our iterator 
vector
                                //      
rotateCacheIterator(aEnd-m_pMatrix->begin()); //can't be used because they 
decrement and here we need to increment
-                               sal_Int16 nNewDist = aEnd - m_pMatrix->begin();
-                               sal_Int16 nOffSet = m_pMatrix->end() - aEnd;
+                               ptrdiff_t nNewDist = aEnd - m_pMatrix->begin();
+                               ptrdiff_t nOffSet = m_pMatrix->end() - aEnd;
                                ORowSetCacheMap::iterator aCacheIter = 
m_aCacheIterators.begin();
                                for(;aCacheIter != 
m_aCacheIterators.end();++aCacheIter)
                                {
                                        if ( 
!aCacheIter->second.pRowSet->isInsertRow() 
                                                && aCacheIter->second.aIterator 
!= m_pMatrix->end() && !m_bModified )
                                        {
-                                               sal_Int16 nDist = 
(aCacheIter->second.aIterator - m_pMatrix->begin());
+                                               ptrdiff_t nDist = 
(aCacheIter->second.aIterator - m_pMatrix->begin());
                                                if ( nDist >= nNewDist )
                                                {
                                                        
aCacheIter->second.aIterator = m_pMatrix->end();
@@ -857,7 +857,8 @@
                                ORowSetMatrix::iterator aIter = 
m_pMatrix->begin();
                                for(sal_Int32 i=0;i<m_nFetchSize;++i,++aIter)
                                {
-                                       if(bCheck = m_pCacheSet->next())
+                    bCheck = m_pCacheSet->next();
+                                       if ( bCheck )
                                        {
                                                if(!aIter->isValid())
                                                        *aIter = new 
ORowSetValueVector(m_xMetaData->getColumnCount());
@@ -880,16 +881,20 @@
                        m_aMatrixIter = calcPosition();
                        if(!m_aMatrixIter->isValid())
                        {
-                               sal_Bool bOk;
-                               if(bOk = m_pCacheSet->absolute(m_nPosition))
+                               sal_Bool bOk( m_pCacheSet->absolute( 
m_nPosition ) );
+                               if ( bOk )
                                {
                                        *m_aMatrixIter = new 
ORowSetValueVector(m_xMetaData->getColumnCount());
                                        
m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition);
                                        // we have to read one row forward to 
enshure that we know when we are on last row
                                        // but only when we don't know it 
already
-                                       if(!m_bRowCountFinal && (bOk = 
m_pCacheSet->absolute(m_nPosition+1)))
+                                       if ( !m_bRowCountFinal )
+                    {
+                        bOk = m_pCacheSet->absolute( m_nPosition + 1 );
+                        if ( bOk )
                                                m_nRowCount = 
std::max(sal_Int32(m_nPosition+1),m_nRowCount);
                                }
+                               }
                                if(!bOk)
                                {
                                        if(!m_bRowCountFinal)
@@ -926,7 +931,7 @@
                        {       // rotate the end to the front
                                
::std::rotate(m_pMatrix->begin(),aIter,m_pMatrix->end());
                                // now correct the iterator in our iterator 
vector
-                               rotateCacheIterator(aIter - m_pMatrix->begin());
+                               rotateCacheIterator( (sal_Int16)( aIter - 
m_pMatrix->begin() ) );
                                m_nStartPos = nNewStartPos - 1; // must be -1
                                // now I can say how many rows we have
                                if(!bOk)
@@ -945,7 +950,7 @@
                                //      m_nStartPos = (aIter - 
m_pMatrix->begin());
                                
::std::rotate(m_pMatrix->begin(),aIter,m_pMatrix->end());
                                // now correct the iterator in our iterator 
vector
-                               rotateCacheIterator(aIter - m_pMatrix->begin());
+                               rotateCacheIterator( (sal_Int16)( aIter - 
m_pMatrix->begin() ) );
 
                                if ( !m_bRowCountFinal )
                                {
@@ -968,7 +973,8 @@
                                bCheck  = m_pCacheSet->absolute(m_nStartPos);
                                for(; !aIter->isValid() && bCheck;++aIter)
                                {
-                                       if(bCheck = m_pCacheSet->next()) // 
resultset stands on right position
+                    bCheck = m_pCacheSet->next();
+                                       if ( bCheck ) // resultset stands on 
right position
                                        {
                                                *aIter = new 
ORowSetValueVector(m_xMetaData->getColumnCount());
                                                
m_pCacheSet->fillValueRow(*aIter,++nPos);
@@ -1197,10 +1203,10 @@
        if ( !m_bNew || !m_aInsertRow->isValid() )
                throw 
SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any()
 );
 
-       sal_Bool bRet;
        m_pCacheSet->insertRow(*m_aInsertRow,m_aUpdateTable);
 
-       if ( bRet = rowInserted() )
+       sal_Bool bRet( rowInserted() );
+       if ( bRet )
        {
                ++m_nRowCount;
                Any aBookmark = (*(*m_aInsertRow))[0].makeAny();
@@ -1344,7 +1350,7 @@
                        if ( !aCacheIter->second.pRowSet->isInsertRow()
                                && aCacheIter->second.aIterator != 
m_pMatrix->end() && !m_bModified )
                        {
-                               sal_Int16 nDist = (aCacheIter->second.aIterator 
- m_pMatrix->begin());
+                               ptrdiff_t nDist = (aCacheIter->second.aIterator 
- m_pMatrix->begin());
                                if(nDist < _nDist)
                                {
                                        aCacheIter->second.aIterator = 
m_pMatrix->end();




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to