summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-10-26 06:45:13 +0000
committerOcke Janssen <oj@openoffice.org>2001-10-26 06:45:13 +0000
commit35ee89f2629bc5fc238cae94054009cad890b858 (patch)
treeceb052c4883d57ce383751dff45e9c7681abb552 /connectivity
parent4b9ab688176b1205cfcd65f46ce37ca8139066db (diff)
#93524# new class for hidding deleted rows
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/TSkipDeletedSet.cxx274
-rw-r--r--connectivity/source/commontools/makefile.mk33
-rw-r--r--connectivity/source/drivers/adabas/BTable.cxx11
-rw-r--r--connectivity/source/drivers/adabas/BTables.cxx21
-rw-r--r--connectivity/source/drivers/calc/CResultSet.cxx8
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx34
-rw-r--r--connectivity/source/drivers/dbase/DNoException.cxx38
-rw-r--r--connectivity/source/drivers/dbase/DResultSet.cxx8
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx8
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx342
-rw-r--r--connectivity/source/drivers/flat/ENoException.cxx33
-rw-r--r--connectivity/source/drivers/flat/EResultSet.cxx8
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx291
-rw-r--r--connectivity/source/inc/TResultSetHelper.hxx93
-rw-r--r--connectivity/source/inc/TSkipDeletedSet.hxx125
-rw-r--r--connectivity/source/inc/calc/CTable.hxx6
-rw-r--r--connectivity/source/inc/dbase/DTable.hxx6
-rw-r--r--connectivity/source/inc/file/FResultSet.hxx25
-rw-r--r--connectivity/source/inc/file/FTable.hxx23
-rw-r--r--connectivity/source/inc/flat/ETable.hxx6
-rw-r--r--connectivity/source/inc/mozaddressbook/MABTable.hxx6
-rw-r--r--connectivity/source/inc/odbc/OResultSet.hxx20
22 files changed, 911 insertions, 508 deletions
diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx b/connectivity/source/commontools/TSkipDeletedSet.cxx
new file mode 100644
index 000000000000..289430e52f8f
--- /dev/null
+++ b/connectivity/source/commontools/TSkipDeletedSet.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * $RCSfile: TSkipDeletedSet.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-10-26 07:39:22 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
+#include "TSkipDeletedSet.hxx"
+#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+using namespace connectivity;
+// -----------------------------------------------------------------------------
+OSkipDeletedSet::OSkipDeletedSet(IResultSetHelper* _pHelper)
+ : m_pHelper(_pHelper)
+{
+}
+// -----------------------------------------------------------------------------
+sal_Bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
+{
+ OSL_ENSURE(_eCursorPosition != IResultSetHelper::BOOKMARK,"OSkipDeletedSet::SkipDeleted can't be called for BOOKMARK");
+
+ IResultSetHelper::Movement eDelPosition = _eCursorPosition;
+ sal_Int32 nDelOffset = abs(_nOffset);
+
+ switch (_eCursorPosition)
+ {
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::FIRST: // set the movement when positioning failed
+ eDelPosition = IResultSetHelper::NEXT;
+ nDelOffset = 1;
+ break;
+ case IResultSetHelper::LAST:
+ eDelPosition = IResultSetHelper::PRIOR; // lsat row is invalid so position before
+ nDelOffset = 1;
+ break;
+ case IResultSetHelper::RELATIVE:
+ eDelPosition = (_nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
+ break;
+ }
+
+ sal_Int32 nNewOffset = _nOffset;
+ sal_Bool bDone = sal_True;
+ sal_Bool bDataFound = sal_False;
+
+ if (_eCursorPosition == IResultSetHelper::ABSOLUTE)
+ {
+ return moveAbsolute(_nOffset,_bRetrieveData);
+ }
+ else if (_eCursorPosition == IResultSetHelper::LAST)
+ {
+ sal_Int32 nBookmark = 0;
+ sal_Int32 nCurPos = 1;
+ // first position on the last known row
+ if(m_aBookmarks.empty())
+ {
+ bDataFound = m_pHelper->move(IResultSetHelper::FIRST, 0, _bRetrieveData);
+ if(bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ }
+ else
+ {
+ // I already have a bookmark so we can positioned on that and look if it is the last one
+ nBookmark = (*m_aBookmarksPositions.rbegin())->first;
+
+ bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK, nBookmark, _bRetrieveData);
+ OSL_ENSURE((m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()),"A bookmark should not be deleted!");
+ nCurPos = (*m_aBookmarksPositions.rbegin())->second;
+ }
+
+
+ // and than move forward until we are after the last row
+ while(bDataFound)
+ {
+ bDataFound = m_pHelper->move(IResultSetHelper::NEXT, 1, sal_False); // we don't need the data here
+ if(bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ { // we weren't on the last row we remember it and move on
+ ++nCurPos;
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ }
+ else if(!bDataFound && m_aBookmarks.size())
+ {
+ // i already know the last bookmark :-)
+ // now we only have to repositioning us to the last row
+ nBookmark = (*m_aBookmarksPositions.rbegin())->first;
+ bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK, nBookmark, _bRetrieveData);
+ break;
+ }
+ }
+ return bDataFound;
+ }
+ else if (_eCursorPosition != IResultSetHelper::RELATIVE)
+ {
+ bDataFound = m_pHelper->move(_eCursorPosition, _nOffset, _bRetrieveData);
+ bDone = bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted());
+ }
+ else
+ {
+ bDataFound = m_pHelper->move(eDelPosition, 1, _bRetrieveData);
+ if (bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ {
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ bDone = (--nDelOffset) == 0;
+ }
+ else
+ bDone = sal_False;
+ }
+
+ while (bDataFound && !bDone) // solange iterieren bis man auf einem gltigen Satz ist
+ {
+ bDataFound = m_pHelper->move(eDelPosition, 1, _bRetrieveData);
+ if (_eCursorPosition != IResultSetHelper::RELATIVE)
+ bDone = bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted());
+ else if (bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ {
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ bDone = (--nDelOffset) == 0;
+ }
+ else
+ bDone = sal_False;
+ }
+
+ if(bDataFound && bDone && m_aBookmarks.find(m_pHelper->getDriverPos()) == m_aBookmarks.end())
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+
+ return bDataFound;
+}
+// -------------------------------------------------------------------------
+sal_Bool OSkipDeletedSet::moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData)
+{
+ sal_Bool bDataFound = sal_False;
+ sal_Int32 nNewOffset = _nOffset;
+ if(nNewOffset > 0)
+ {
+ if((sal_Int32)m_aBookmarks.size() < nNewOffset)
+ {
+ // bookmark isn't known yet
+ // start at the last position
+ sal_Int32 nCurPos = 0,nLastBookmark = 1;
+ IResultSetHelper::Movement eFilePos = IResultSetHelper::FIRST;
+ if(!m_aBookmarks.empty())
+ {
+ nLastBookmark = (*m_aBookmarksPositions.rbegin())->first;
+ nCurPos = (*m_aBookmarksPositions.rbegin())->second;
+ nNewOffset = nNewOffset - nCurPos;
+ bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK, nLastBookmark, _bRetrieveData);
+ }
+ else
+ {
+ bDataFound = m_pHelper->move(IResultSetHelper::FIRST, 0, _bRetrieveData );
+ if(bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ {
+ ++nCurPos;
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ --nNewOffset;
+ }
+ }
+ // now move to that row we need and don't count deleted rows
+ while (bDataFound && nNewOffset)
+ {
+ bDataFound = m_pHelper->move(IResultSetHelper::NEXT, 1, _bRetrieveData);
+ if(bDataFound && (m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()))
+ {
+ ++nCurPos;
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
+ --nNewOffset;
+ }
+ }
+ }
+ else
+ {
+ sal_Int32 nBookmark = m_aBookmarksPositions[nNewOffset-1]->first;
+ bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK,nBookmark, _bRetrieveData);
+ OSL_ENSURE((m_pHelper->deletedVisible() || !m_pHelper->isRowDeleted()),"moveAbsolute: row can't be deleted!");
+ }
+ }
+ else
+ {
+ ++nNewOffset;
+ bDataFound = skipDeleted(IResultSetHelper::LAST,0,nNewOffset == 0);
+
+ for(sal_Int32 i=nNewOffset+1;bDataFound && i <= 0;++i)
+ bDataFound = skipDeleted(IResultSetHelper::PRIOR,1,i == 0);
+
+ }
+ return bDataFound;
+}
+// -----------------------------------------------------------------------------
+void OSkipDeletedSet::clear()
+{
+ ::std::vector<TInt2IntMap::iterator>().swap(m_aBookmarksPositions);
+ TInt2IntMap().swap(m_aBookmarks);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OSkipDeletedSet::getMappedPosition(sal_Int32 _nPos) const
+{
+ ::std::map<sal_Int32,sal_Int32>::const_iterator aFind = m_aBookmarks.find(_nPos);
+ OSL_ENSURE(aFind != m_aBookmarks.end(),"OResultSet::getRow() invalid bookmark!");
+ return aFind->second;
+}
+// -----------------------------------------------------------------------------
+void OSkipDeletedSet::insertNewPosition(sal_Int32 _nPos)
+{
+ m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type(_nPos,m_aBookmarksPositions.size()+1)).first);
+}
+// -----------------------------------------------------------------------------
+void OSkipDeletedSet::deletePosition(sal_Int32 _nPos)
+{
+ TInt2IntMap::iterator aFind = m_aBookmarks.find(_nPos);
+ OSL_ENSURE(aFind != m_aBookmarks.end(),"OResultSet::deleteRow() bookmark not found!");
+ TInt2IntMap::iterator aIter = aFind;
+ ++aIter;
+ for (; aIter != m_aBookmarks.end() ; ++aIter)
+ --(aIter->second);
+ m_aBookmarksPositions.erase(m_aBookmarksPositions.begin() + aFind->second-1);
+ m_aBookmarks.erase(_nPos);
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk
index a72c80629ec2..ce2cbca01356 100644
--- a/connectivity/source/commontools/makefile.mk
+++ b/connectivity/source/commontools/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.17 $
+# $Revision: 1.18 $
#
-# last change: $Author: oj $ $Date: 2001-08-29 12:16:07 $
+# last change: $Author: oj $ $Date: 2001-10-26 07:39:41 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -72,23 +72,6 @@ ENVCFLAGS+=/FR$(SLO)$/
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
-
-SLOFILES=\
- $(SLO)$/TSortIndex.obj \
- $(SLO)$/TConnection.obj \
- $(SLO)$/conncleanup.obj \
- $(SLO)$/emptymetadata.obj \
- $(SLO)$/dbcharset.obj \
- $(SLO)$/dbtools.obj \
- $(SLO)$/dbexception.obj \
- $(SLO)$/dbconversion.obj \
- $(SLO)$/DateConversion.obj \
- $(SLO)$/CommonTools.obj \
- $(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \
- $(SLO)$/FDatabaseMetaDataResultSet.obj \
- $(SLO)$/FValue.obj \
- $(SLO)$/TDatabaseMetaDataBase.obj
-
EXCEPTIONSFILES=\
$(SLO)$/TConnection.obj \
$(SLO)$/conncleanup.obj \
@@ -99,7 +82,17 @@ EXCEPTIONSFILES=\
$(SLO)$/DateConversion.obj \
$(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \
$(SLO)$/FDatabaseMetaDataResultSet.obj \
- $(SLO)$/TDatabaseMetaDataBase.obj
+ $(SLO)$/TDatabaseMetaDataBase.obj \
+ $(SLO)$/TSkipDeletedSet.obj
+
+SLOFILES=\
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/TSortIndex.obj \
+ $(SLO)$/dbcharset.obj \
+ $(SLO)$/dbconversion.obj \
+ $(SLO)$/FValue.obj
+
+
# --- Targets ------------------------------------------------------
diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx
index 12db6d7e3e09..6ef919c1d4cf 100644
--- a/connectivity/source/drivers/adabas/BTable.cxx
+++ b/connectivity/source/drivers/adabas/BTable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: BTable.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 16:22:16 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:43:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -449,8 +449,11 @@ void SAL_CALL OAdabasTable::alterColumnByIndex( sal_Int32 index, const Reference
::rtl::OUString SAL_CALL OAdabasTable::getName() throw(::com::sun::star::uno::RuntimeException)
{
::rtl::OUString sName = m_SchemaName;
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
- sName += sDot;
+ if(m_SchemaName.getLength())
+ {
+ const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
+ sName += sDot;
+ }
sName += m_Name;
return sName;
}
diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx
index 2a164550cb45..7a2a5285ab31 100644
--- a/connectivity/source/drivers/adabas/BTables.cxx
+++ b/connectivity/source/drivers/adabas/BTables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: BTables.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:39:41 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:43:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -189,9 +189,13 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ
OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
Reference< XStatement > xStmt = pConnection->createStatement( );
- aSql = ::rtl::OUString::createFromAscii("COMMENT ON TABLE ")
- + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + aQuote + sDot
- + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
+ aSql = ::rtl::OUString::createFromAscii("COMMENT ON TABLE ");
+ ::rtl::OUString sSchema;
+ descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema;
+ if(sSchema.getLength())
+ aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
+
+ aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
+ ::rtl::OUString::createFromAscii(" '")
+ getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)))
+ ::rtl::OUString::createFromAscii("'");
@@ -202,9 +206,10 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ
Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
Reference< XPropertySet > xColProp;
- aSql = ::rtl::OUString::createFromAscii("COMMENT ON COLUMN ")
- + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + aQuote + sDot
- + aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + sDot
+ aSql = ::rtl::OUString::createFromAscii("COMMENT ON COLUMN ");
+ if(sSchema.getLength())
+ aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
+ aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + sDot
+ aQuote;
for(sal_Int32 i=0;i<xColumns->getCount();++i)
diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx
index 9f13c14e0e4e..8ccd83b14e7b 100644
--- a/connectivity/source/drivers/calc/CResultSet.cxx
+++ b/connectivity/source/drivers/calc/CResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CResultSet.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 17:26:36 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:44:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,7 +147,7 @@ sal_Bool SAL_CALL OCalcResultSet::moveToBookmark( const Any& bookmark ) throw(
m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- return Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_True);
+ return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
@@ -158,7 +158,7 @@ sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark,
m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_False);
+ Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
return relative(rows);
}
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index b7e710faa397..7722d82b8fe0 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CTable.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: oj $ $Date: 2001-10-18 13:18:01 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:44:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -772,7 +772,7 @@ sal_Int32 OCalcTable::getCurrentLastPos() const
return m_nDataRows;
}
//------------------------------------------------------------------
-sal_Bool OCalcTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+sal_Bool OCalcTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
{
// ----------------------------------------------------------
// Positionierung vorbereiten:
@@ -783,25 +783,25 @@ sal_Bool OCalcTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
switch(eCursorPosition)
{
- case FILE_NEXT:
+ case IResultSetHelper::NEXT:
m_nFilePos++;
break;
- case FILE_PRIOR:
+ case IResultSetHelper::PRIOR:
if (m_nFilePos > 0)
m_nFilePos--;
break;
- case FILE_FIRST:
+ case IResultSetHelper::FIRST:
m_nFilePos = 1;
break;
- case FILE_LAST:
+ case IResultSetHelper::LAST:
m_nFilePos = nNumberOfRecords;
break;
- case FILE_RELATIVE:
+ case IResultSetHelper::RELATIVE:
m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
: (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
break;
- case FILE_ABSOLUTE:
- case FILE_BOOKMARK:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::BOOKMARK:
m_nFilePos = (sal_uInt32)nOffset;
break;
}
@@ -820,20 +820,20 @@ sal_Bool OCalcTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
Error:
switch(eCursorPosition)
{
- case FILE_PRIOR:
- case FILE_FIRST:
+ case IResultSetHelper::PRIOR:
+ case IResultSetHelper::FIRST:
m_nFilePos = 0;
break;
- case FILE_LAST:
- case FILE_NEXT:
- case FILE_ABSOLUTE:
- case FILE_RELATIVE:
+ case IResultSetHelper::LAST:
+ case IResultSetHelper::NEXT:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::RELATIVE:
if (nOffset > 0)
m_nFilePos = nNumberOfRecords + 1;
else if (nOffset < 0)
m_nFilePos = 0;
break;
- case FILE_BOOKMARK:
+ case IResultSetHelper::BOOKMARK:
m_nFilePos = nTempPos; // vorherige Position
}
// aStatus.Set(SDB_STAT_NO_DATA_FOUND);
diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx
index f13f4a98e030..5c9a2975d65c 100644
--- a/connectivity/source/drivers/dbase/DNoException.cxx
+++ b/connectivity/source/drivers/dbase/DNoException.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DNoException.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: hr $ $Date: 2001-10-18 10:28:09 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:44:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,7 +80,7 @@ using namespace connectivity::dbase;
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
//------------------------------------------------------------------
-sal_Bool ODbaseTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
{
// ----------------------------------------------------------
// Positionierung vorbereiten:
@@ -92,25 +92,25 @@ sal_Bool ODbaseTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, s
switch(eCursorPosition)
{
- case FILE_NEXT:
+ case IResultSetHelper::NEXT:
++m_nFilePos;
break;
- case FILE_PRIOR:
+ case IResultSetHelper::PRIOR:
if (m_nFilePos > 0)
--m_nFilePos;
break;
- case FILE_FIRST:
+ case IResultSetHelper::FIRST:
m_nFilePos = 1;
break;
- case FILE_LAST:
+ case IResultSetHelper::LAST:
m_nFilePos = nNumberOfRecords;
break;
- case FILE_RELATIVE:
+ case IResultSetHelper::RELATIVE:
m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
: (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
break;
- case FILE_ABSOLUTE:
- case FILE_BOOKMARK:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::BOOKMARK:
m_nFilePos = (sal_uInt32)nOffset;
break;
}
@@ -140,20 +140,20 @@ sal_Bool ODbaseTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, s
Error:
switch(eCursorPosition)
{
- case FILE_PRIOR:
- case FILE_FIRST:
+ case IResultSetHelper::PRIOR:
+ case IResultSetHelper::FIRST:
m_nFilePos = 0;
break;
- case FILE_LAST:
- case FILE_NEXT:
- case FILE_ABSOLUTE:
- case FILE_RELATIVE:
+ case IResultSetHelper::LAST:
+ case IResultSetHelper::NEXT:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::RELATIVE:
if (nOffset > 0)
m_nFilePos = nNumberOfRecords + 1;
else if (nOffset < 0)
m_nFilePos = 0;
break;
- case FILE_BOOKMARK:
+ case IResultSetHelper::BOOKMARK:
m_nFilePos = nTempPos; // vorherige Position
}
// aStatus.Set(SDB_STAT_NO_DATA_FOUND);
@@ -208,7 +208,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
{
if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0)
{
-// String aText = String(SdbResId(STR_STAT_FILE_INVALID));
+// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
// aStatus.Set(SDB_STAT_ERROR,
@@ -222,7 +222,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
}
else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08)
{
-// String aText = String(SdbResId(STR_STAT_FILE_INVALID));
+// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
// aStatus.Set(SDB_STAT_ERROR,
diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx
index 6bc6d5cbeddd..786903a00126 100644
--- a/connectivity/source/drivers/dbase/DResultSet.cxx
+++ b/connectivity/source/drivers/dbase/DResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DResultSet.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: hr $ $Date: 2001-10-18 09:41:25 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:44:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -157,7 +157,7 @@ sal_Bool SAL_CALL ODbaseResultSet::moveToBookmark( const Any& bookmark ) throw(
m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- return Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_True);
+ return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODbaseResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
@@ -166,7 +166,7 @@ sal_Bool SAL_CALL ODbaseResultSet::moveRelativeToBookmark( const Any& bookmark,
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_False);
+ Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
return relative(rows);
}
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 67c90bf7e244..ac177a879d10 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DTable.cxx,v $
*
- * $Revision: 1.69 $
+ * $Revision: 1.70 $
*
- * last change: $Author: oj $ $Date: 2001-10-19 07:30:39 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:44:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -126,7 +126,7 @@
#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
#endif
-#ifndef _UNOTOOLS_TEMPFILE_HXX
+#ifndef _UNOTOOLS_TEMPIFILE_HXX
#include <unotools/tempfile.hxx>
#endif
#ifndef _UNOTOOLS_UCBHELPER_HXX
@@ -1990,7 +1990,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
OValueVector::iterator aIter;
for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos)
{
- if(bOk = seekRow(FILE_BOOKMARK,nRowPos+1,nCurPos))
+ if(bOk = seekRow(IResultSetHelper::BOOKMARK,nRowPos+1,nCurPos))
{
if(bOk = fetchRow(aRow,m_aColumns.getBody(),sal_True,sal_True))
{
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 05be000f5074..c4fbbe51a674 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FResultSet.cxx,v $
*
- * $Revision: 1.75 $
+ * $Revision: 1.76 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 17:08:08 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:43:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -190,6 +190,7 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIte
,m_nCurrentPosition(0)
,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted())
,m_pSQLAnalyzer(NULL)
+ ,m_aSkipDeletedSet(this)
{
DBG_CTOR(OResultSet ,NULL);
osl_incrementInterlockedCount( &m_refCount );
@@ -244,8 +245,7 @@ void OResultSet::clear()
if(m_aInsertRow.isValid())
m_aInsertRow->clear();
- ::std::vector<TInt2IntMap::iterator>().swap(m_aBookmarksPositions);
- TInt2IntMap().swap(m_aBookmarks);
+ m_aSkipDeletedSet.clear();
}
// -------------------------------------------------------------------------
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
@@ -361,14 +361,7 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row");
- sal_Int32 nPos = (sal_Int32)(*m_aRow)[0];
- ::std::map<sal_Int32,sal_Int32>::const_iterator aFind = m_aBookmarks.find(nPos);
- OSL_ENSURE(aFind != m_aBookmarks.end(),"OResultSet::getRow() invalid bookmark!");
- return aFind->second;
-// ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aBookmarkToPos.begin();
-// for(;aIter != aFind;++aIter,++nRowPos)
-// ;
-// return nRowPos;
+ return m_aSkipDeletedSet.getMappedPosition((*m_aRow)[0]);
}
// -------------------------------------------------------------------------
@@ -506,7 +499,7 @@ sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return SkipDeleted(OFileTable::FILE_FIRST,1,sal_True);
+ return m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,sal_True);
}
// -------------------------------------------------------------------------
@@ -515,28 +508,28 @@ sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
// here I know definitely that I stand on the last record
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return SkipDeleted(OFileTable::FILE_LAST,1,sal_True);
+ return m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return SkipDeleted(OFileTable::FILE_ABSOLUTE,row,sal_True);
+ return m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return SkipDeleted(OFileTable::FILE_RELATIVE,row,sal_True);
+ return m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return SkipDeleted(OFileTable::FILE_PRIOR,0,sal_True);
+ return m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,sal_True);
}
// -------------------------------------------------------------------------
Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
@@ -595,11 +588,11 @@ sal_Bool OResultSet::evaluate()
{
if(m_aEvaluateIter == m_pEvaluationKeySet->end())
return sal_False;
- bRet = m_pTable->seekRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
+ bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
++m_aEvaluateIter;
}
else
- bRet = m_pTable->seekRow(OFileTable::FILE_NEXT,1,m_nRowPos);
+ bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
if(bRet)
{
if(m_pEvaluationKeySet)
@@ -622,7 +615,7 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? SkipDeleted(OFileTable::FILE_NEXT,1,sal_True) : sal_False;
+ return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::NEXT,1,sal_True) : sal_False;
}
// -------------------------------------------------------------------------
@@ -631,7 +624,6 @@ sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
return m_bWasNull;
}
// -------------------------------------------------------------------------
@@ -660,7 +652,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
// we know that we append new rows at the end
// so we have to know where the end is
- SkipDeleted(OFileTable::FILE_LAST,1,sal_False);
+ m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False);
m_bRowInserted = m_pTable->InsertRow(m_aInsertRow.getBody(), TRUE,Reference<XIndexAccess>(m_xColNames,UNO_QUERY));
if(m_bRowInserted && m_pFileSet.isValid())
{
@@ -669,7 +661,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
(*m_aInsertRow)[0] = sal_Int32(m_pFileSet->size());
clearInsertRow();
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
+ m_aSkipDeletedSet.insertNewPosition((*m_aRow)[0]);
}
}
// -------------------------------------------------------------------------
@@ -705,14 +697,7 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException)
{
m_aRow->setDeleted(sal_True);
// don't touch the m_pFileSet member here
- TInt2IntMap::iterator aFind = m_aBookmarks.find(nPos);
- OSL_ENSURE(aFind != m_aBookmarks.end(),"OResultSet::deleteRow() bookmark not found!");
- TInt2IntMap::iterator aIter = aFind;
- ++aIter;
- for (; aIter != m_aBookmarks.end() ; ++aIter)
- --(aIter->second);
- m_aBookmarksPositions.erase(m_aBookmarksPositions.begin() + aFind->second-1);
- m_aBookmarks.erase(nPos);
+ m_aSkipDeletedSet.deletePosition(nPos);
}
}
// -------------------------------------------------------------------------
@@ -904,7 +889,7 @@ IPropertyArrayHelper & OResultSet::getInfoHelper()
}
//------------------------------------------------------------------
-BOOL OResultSet::ExecuteRow(OFileTable::FilePosition eFirstCursorPosition,
+BOOL OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
INT32 nFirstOffset,
BOOL bRebind,
BOOL bEvaluate,
@@ -913,7 +898,7 @@ BOOL OResultSet::ExecuteRow(OFileTable::FilePosition eFirstCursorPosition,
OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!");
// Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ...
- OFileTable::FilePosition eCursorPosition = eFirstCursorPosition;
+ IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition;
INT32 nOffset = nFirstOffset;
UINT32 nLoopCount = 0;
@@ -921,7 +906,7 @@ again:
// protect from reading over the end when someboby is inserting while we are reading
// this method works only for dBase at the moment !!!!
- if (eCursorPosition == OFileTable::FILE_NEXT && m_nFilePos == m_nLastVisitedPos)
+ if (eCursorPosition == IResultSetHelper::NEXT && m_nFilePos == m_nLastVisitedPos)
{
return sal_False;
}
@@ -960,26 +945,26 @@ again:
else if (m_pFileSet.isValid())
{
OSL_ENSURE(//!m_pFileSet->IsFrozen() &&
- eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!");
- eCursorPosition = OFileTable::FILE_NEXT;
+ eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
+ eCursorPosition = IResultSetHelper::NEXT;
nOffset = 1;
}
- else if (eCursorPosition == OFileTable::FILE_FIRST ||
- eCursorPosition == OFileTable::FILE_NEXT ||
- eCursorPosition == OFileTable::FILE_ABSOLUTE)
+ else if (eCursorPosition == IResultSetHelper::FIRST ||
+ eCursorPosition == IResultSetHelper::NEXT ||
+ eCursorPosition == IResultSetHelper::ABSOLUTE)
{
- eCursorPosition = OFileTable::FILE_NEXT;
+ eCursorPosition = IResultSetHelper::NEXT;
nOffset = 1;
}
- else if (eCursorPosition == OFileTable::FILE_LAST ||
- eCursorPosition == OFileTable::FILE_PRIOR)
+ else if (eCursorPosition == IResultSetHelper::LAST ||
+ eCursorPosition == IResultSetHelper::PRIOR)
{
- eCursorPosition = OFileTable::FILE_PRIOR;
+ eCursorPosition = IResultSetHelper::PRIOR;
nOffset = 1;
}
- else if (eCursorPosition == OFileTable::FILE_RELATIVE)
+ else if (eCursorPosition == IResultSetHelper::RELATIVE)
{
- eCursorPosition = (nOffset >= 0) ? OFileTable::FILE_NEXT : OFileTable::FILE_PRIOR;
+ eCursorPosition = (nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
}
else
{
@@ -1043,7 +1028,7 @@ again:
}
//-------------------------------------------------------------------
-BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData)
+BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData)
{
//IgnoreDeletedRows:
@@ -1067,25 +1052,25 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
{
switch(eCursorPosition)
{
- case OFileTable::FILE_NEXT:
+ case IResultSetHelper::NEXT:
++m_nRowPos;
break;
- case OFileTable::FILE_PRIOR:
+ case IResultSetHelper::PRIOR:
if (m_nRowPos >= 0)
--m_nRowPos;
break;
- case OFileTable::FILE_FIRST:
+ case IResultSetHelper::FIRST:
m_nRowPos = 0;
break;
- case OFileTable::FILE_LAST:
+ case IResultSetHelper::LAST:
// OSL_ENSURE(IsRowCountFinal(), "Fehler im Keyset!"); // mu eingefroren sein, sonst Fehler beim SQLCursor
m_nRowPos = m_pFileSet->size() - 1;
break;
- case OFileTable::FILE_RELATIVE:
+ case IResultSetHelper::RELATIVE:
m_nRowPos += nOffset;
break;
- case OFileTable::FILE_ABSOLUTE:
- case OFileTable::FILE_BOOKMARK:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::BOOKMARK:
m_nRowPos = nOffset -1;
break;
}
@@ -1094,7 +1079,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
// Der FileCursor ist auerhalb des gueltigen Bereichs, wenn
// a.) m_nRowPos < 1
// b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size()
- if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != OFileTable::FILE_BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->size() )) // && m_pFileSet->IsFrozen()
+ if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->size() )) // && m_pFileSet->IsFrozen()
{
// aStatus.Set(SQL_STAT_NO_DATA_FOUND);
goto Error;
@@ -1104,7 +1089,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
if (m_nRowPos < (INT32)m_pFileSet->size())
{
// Fetch ueber Index
- ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_pFileSet)[m_nRowPos],TRUE,FALSE,bRetrieveData);
+ ExecuteRow(IResultSetHelper::BOOKMARK,(*m_pFileSet)[m_nRowPos],TRUE,FALSE,bRetrieveData);
// now set the bookmark for outside
(*m_aRow->begin()) = sal_Int32(m_nRowPos + 1);
@@ -1116,7 +1101,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
{
m_aFileSetIter = m_pFileSet->end()-1;
// m_pFileSet->SeekPos(m_pFileSet->size()-1);
- m_pTable->seekRow(OFileTable::FILE_BOOKMARK, *m_aFileSetIter, m_nFilePos);
+ m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);
}
sal_Bool bOK = sal_True;
// Ermitteln der Anzahl weiterer Fetches
@@ -1130,16 +1115,16 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
else if (m_nRowPos == 0)
{
m_aEvaluateIter = m_pEvaluationKeySet->begin();
- bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData);
+ bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData);
}
else
{
++m_aEvaluateIter;
- bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData);
+ bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData);
}
}
else
- bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE, FALSE);//bRetrieveData);
+ bOK = ExecuteRow(IResultSetHelper::NEXT,1,FALSE,TRUE, FALSE);//bRetrieveData);
}
if (bOK)
@@ -1169,23 +1154,23 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
// Fetch des COUNT(*)
switch (eCursorPosition)
{
- case OFileTable::FILE_NEXT:
+ case IResultSetHelper::NEXT:
++m_nRowPos;
break;
- case OFileTable::FILE_PRIOR:
+ case IResultSetHelper::PRIOR:
--m_nRowPos;
break;
- case OFileTable::FILE_FIRST:
+ case IResultSetHelper::FIRST:
m_nRowPos = 0;
break;
- case OFileTable::FILE_LAST:
+ case IResultSetHelper::LAST:
m_nRowPos = 0;
break;
- case OFileTable::FILE_RELATIVE:
+ case IResultSetHelper::RELATIVE:
m_nRowPos += nOffset;
break;
- case OFileTable::FILE_ABSOLUTE:
- case OFileTable::FILE_BOOKMARK:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::BOOKMARK:
m_nRowPos = nOffset - 1;
break;
}
@@ -1223,20 +1208,20 @@ Error:
{
switch(eCursorPosition)
{
- case OFileTable::FILE_PRIOR:
- case OFileTable::FILE_FIRST:
+ case IResultSetHelper::PRIOR:
+ case IResultSetHelper::FIRST:
m_nRowPos = -1;
break;
- case OFileTable::FILE_LAST:
- case OFileTable::FILE_NEXT:
- case OFileTable::FILE_ABSOLUTE:
- case OFileTable::FILE_RELATIVE:
+ case IResultSetHelper::LAST:
+ case IResultSetHelper::NEXT:
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::RELATIVE:
if (nOffset > 0)
m_nRowPos = (m_pFileSet.isValid()) ? m_pFileSet->size() : -1;
else if (nOffset < 0)
m_nRowPos = -1;
break;
- case OFileTable::FILE_BOOKMARK:
+ case IResultSetHelper::BOOKMARK:
m_nRowPos = nTempPos; // vorherige Position
}
}
@@ -1245,179 +1230,6 @@ Error:
// OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE;
return sal_False;
}
-
-//------------------------------------------------------------------
-BOOL OResultSet::SkipDeleted(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData)
-{
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- OSL_ENSURE(eCursorPosition != OFileTable::FILE_BOOKMARK,"OResultSet::SkipDeleted can't be called for BOOKMARK");
-
- OFileTable::FilePosition eDelPosition = eCursorPosition;
- INT32 nDelOffset = abs(nOffset);
- BOOL bDataFound;
- BOOL bDone = sal_True;
-
- switch (eCursorPosition)
- {
- case OFileTable::FILE_ABSOLUTE:
- case OFileTable::FILE_FIRST: // erster Satz nicht gltig, gehe auf nchsten
- eDelPosition = OFileTable::FILE_NEXT;
- nDelOffset = 1;
- break;
- case OFileTable::FILE_LAST:
- eDelPosition = OFileTable::FILE_PRIOR; // letzter Satz nicht gltig, gehe auf vorherigen
- nDelOffset = 1;
- break;
- case OFileTable::FILE_RELATIVE:
- eDelPosition = (nOffset >= 0) ? OFileTable::FILE_NEXT : OFileTable::FILE_PRIOR;
- break;
- }
-
- sal_Int32 nNewOffset = nOffset;
-
- if (eCursorPosition == OFileTable::FILE_ABSOLUTE)
- {
- return moveAbsolute(nOffset,bRetrieveData);
- }
- else if (eCursorPosition == OFileTable::FILE_LAST)
- {
- sal_Int32 nBookmark = 0;
- sal_Int32 nCurPos = 1;
- // first position on the last known row
- if(m_aBookmarks.empty())
- {
- bDataFound = Move(OFileTable::FILE_FIRST, 1, bRetrieveData);
- if(bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- }
- else
- {
- // I already have a bookmark so we can positioned on that and look if it is the last one
- nBookmark = (*m_aBookmarksPositions.rbegin())->first;
-
- bDataFound = Move(OFileTable::FILE_BOOKMARK, nBookmark, bRetrieveData);
- OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"A bookmark should not be deleted!");
- nCurPos = (*m_aBookmarksPositions.rbegin())->second;
- }
-
-
- // and than move forward until we are after the last row
- while(bDataFound)
- {
- bDataFound = Move(OFileTable::FILE_NEXT, 1, sal_False); // we don't need the data here
- if(bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- { // we weren't on the last row we remember it and move on
- ++nCurPos;
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- }
- else if(!bDataFound && m_aBookmarks.size())
- {
- // i already know the last bookmark :-)
- // now we only have to repositioning us to the last row
- nBookmark = (*m_aBookmarksPositions.rbegin())->first;
- bDataFound = Move(OFileTable::FILE_BOOKMARK, nBookmark, bRetrieveData);
- break;
- }
- }
- return bDataFound;
- }
- else if (eCursorPosition != OFileTable::FILE_RELATIVE)
- {
- bDataFound = Move(eCursorPosition, nOffset, bRetrieveData);
- bDone = bDataFound && (m_bShowDeleted || !m_aRow->isDeleted());
- }
- else
- {
- bDataFound = Move(eDelPosition, 1, bRetrieveData);
- if (bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- {
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- bDone = (--nDelOffset) == 0;
- }
- else
- bDone = FALSE;
- }
- sal_Int32 nRowPos = m_nRowPos;
-
- while (bDataFound && !bDone) // solange iterieren bis man auf einem gltigen Satz ist
- {
- bDataFound = Move(eDelPosition, 1, bRetrieveData);
- if (eCursorPosition != OFileTable::FILE_RELATIVE)
- bDone = bDataFound && (m_bShowDeleted || !m_aRow->isDeleted());
- else if (bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- {
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- bDone = (--nDelOffset) == 0;
- }
- else
- bDone = FALSE;
- }
-
- if(bDataFound && bDone && m_aBookmarks.find((sal_Int32)(*m_aRow)[0]) == m_aBookmarks.end())
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
-
- return bDataFound;
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData)
-{
- sal_Bool bDataFound = sal_False;
- sal_Int32 nNewOffset = _nOffset;
- if(nNewOffset > 0)
- {
- if((sal_Int32)m_aBookmarks.size() < nNewOffset)
- {
- // bookmark isn't known yet
- // start at the last position
- sal_Int32 nCurPos = 0,nLastBookmark = 1;
- OFileTable::FilePosition eFilePos = OFileTable::FILE_FIRST;
- if(!m_aBookmarks.empty())
- {
- nLastBookmark = (*m_aBookmarksPositions.rbegin())->first;
- nCurPos = (*m_aBookmarksPositions.rbegin())->second;
- nNewOffset = nNewOffset - nCurPos;
- bDataFound = Move(OFileTable::FILE_BOOKMARK, nLastBookmark, _bRetrieveData);
- }
- else
- {
- bDataFound = Move(OFileTable::FILE_FIRST, 1, _bRetrieveData );
- if(bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- {
- ++nCurPos;
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- --nNewOffset;
- }
- }
- // now move to that row we need and don't count deleted rows
- while (bDataFound && nNewOffset)
- {
- bDataFound = Move(OFileTable::FILE_NEXT, 1, _bRetrieveData);
- if(bDataFound && (m_bShowDeleted || !m_aRow->isDeleted()))
- {
- ++nCurPos;
- m_aBookmarksPositions.push_back(m_aBookmarks.insert(TInt2IntMap::value_type((sal_Int32)(*m_aRow)[0],m_aBookmarksPositions.size()+1)).first);
- --nNewOffset;
- }
- }
- }
- else
- {
- sal_Int32 nBookmark = m_aBookmarksPositions[nNewOffset-1]->first;
- bDataFound = Move(OFileTable::FILE_BOOKMARK,nBookmark, _bRetrieveData);
- OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"moveAbsolute row can't be deleted!");
- }
- }
- else
- {
- ++nNewOffset;
- bDataFound = SkipDeleted(OFileTable::FILE_LAST,1,nNewOffset == 0);
-
- for(sal_Int32 i=nNewOffset+1;bDataFound && i <= 0;++i)
- bDataFound = SkipDeleted(OFileTable::FILE_PRIOR,1,i == 0);
-
- }
- return bDataFound;
-}
// -------------------------------------------------------------------------
BOOL OResultSet::OpenImpl()
{
@@ -1521,9 +1333,9 @@ BOOL OResultSet::OpenImpl()
while (bOK)
{
if (m_pEvaluationKeySet)
- ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
+ ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
else
- bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE);
+ bOK = ExecuteRow(IResultSetHelper::NEXT,1,FALSE,TRUE);
if (bOK)
{
@@ -1649,12 +1461,12 @@ BOOL OResultSet::OpenImpl()
{
if (m_pEvaluationKeySet)
{
- ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
+ ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
++m_aEvaluateIter;
bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
}
else
- bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE);
+ bOK = ExecuteRow(IResultSetHelper::NEXT,1,FALSE,TRUE);
}
// Sortiertes Keyset erzeugen
@@ -1708,7 +1520,7 @@ BOOL OResultSet::OpenImpl()
nPos = (*m_pFileSet)[j]; // aktuell zu lschender Key
if(!nWasAllwaysFound[j] && nPos) // nur falls noch nicht nach dieser Row gesucht wurde
{
- ExecuteRow(OFileTable::FILE_BOOKMARK,nPos,TRUE,FALSE);
+ ExecuteRow(IResultSetHelper::BOOKMARK,nPos,TRUE,FALSE);
*aSearchRow = *m_aRow;
// jetzt den Rest nach doppelten durchsuchen
INT32 nKey;
@@ -1716,7 +1528,7 @@ BOOL OResultSet::OpenImpl()
for(INT32 i = j-1; i >= 0 ;i--)
{
nKey = (*m_pFileSet)[i];
- ExecuteRow(OFileTable::FILE_BOOKMARK,nKey ,TRUE,FALSE);
+ ExecuteRow(IResultSetHelper::BOOKMARK,nKey ,TRUE,FALSE);
if(!nWasAllwaysFound[i])
{
OValueVector::iterator aRowIter = m_aRow->begin();
@@ -1782,9 +1594,9 @@ BOOL OResultSet::OpenImpl()
while (bOK)
{
if (m_pEvaluationKeySet)
- ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
+ ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE);
else
- bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE);
+ bOK = ExecuteRow(IResultSetHelper::NEXT,1,FALSE,TRUE);
if (bOK)
{
@@ -1974,8 +1786,28 @@ void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount)
}
}
// -----------------------------------------------------------------------------
-sal_Bool OResultSet::fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex)
+sal_Bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xIndex)
{
return sal_False;
}
// -----------------------------------------------------------------------------
+sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
+{
+ return Move(_eCursorPosition,_nOffset,_bRetrieveData);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OResultSet::getDriverPos() const
+{
+ return (*m_aRow)[0];
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::deletedVisible() const
+{
+ return m_bShowDeleted;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::isRowDeleted() const
+{
+ return m_aRow->isDeleted();
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/flat/ENoException.cxx b/connectivity/source/drivers/flat/ENoException.cxx
index 4b21641648ee..ca8401a7096f 100644
--- a/connectivity/source/drivers/flat/ENoException.cxx
+++ b/connectivity/source/drivers/flat/ENoException.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ENoException.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:01:55 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:45:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,7 @@
#include "flat/EConnection.hxx"
#endif
+using namespace connectivity;
using namespace connectivity::flat;
//------------------------------------------------------------------
@@ -199,7 +200,7 @@ sal_Bool OFlatTable::checkHeaderLine()
return sal_True;
}
//------------------------------------------------------------------
-sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
{
OFlatConnection* pConnection = (OFlatConnection*)m_pConnection;
// ----------------------------------------------------------
@@ -210,12 +211,12 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
switch(eCursorPosition)
{
- case FILE_FIRST:
+ case IResultSetHelper::FIRST:
m_nFilePos = 0;
m_nRowPos = 1;
// run through
- case FILE_NEXT:
- if(eCursorPosition != FILE_FIRST)
+ case IResultSetHelper::NEXT:
+ if(eCursorPosition != IResultSetHelper::FIRST)
++m_nRowPos;
m_pFileStream->Seek(m_nFilePos);
if (m_pFileStream->IsEof() || !checkHeaderLine())
@@ -234,7 +235,7 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
}
nCurPos = m_pFileStream->Tell();
break;
- case FILE_PRIOR:
+ case IResultSetHelper::PRIOR:
--m_nRowPos;
if(m_nRowPos > 0)
{
@@ -253,7 +254,7 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
break;
break;
- case FILE_LAST:
+ case IResultSetHelper::LAST:
if(m_nMaxRowCount)
{
m_nFilePos = m_aRowToFilePos.rbegin()->second;
@@ -268,24 +269,24 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
}
else
{
- while(seekRow(FILE_NEXT,1,nCurPos)) ; // run through after last row
+ while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row
// now I know all
- seekRow(FILE_PRIOR,1,nCurPos);
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
}
break;
- case FILE_RELATIVE:
+ case IResultSetHelper::RELATIVE:
if(nOffset > 0)
{
for(sal_Int32 i = 0;i<nOffset;++i)
- seekRow(FILE_NEXT,1,nCurPos);
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
}
else if(nOffset < 0)
{
for(sal_Int32 i = nOffset;i;++i)
- seekRow(FILE_PRIOR,1,nCurPos);
+ seekRow(IResultSetHelper::PRIOR,1,nCurPos);
}
break;
- case FILE_ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE:
{
if(nOffset < 0)
nOffset = m_nRowPos + nOffset;
@@ -314,7 +315,7 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
m_nRowPos = m_aRowToFilePos.rbegin()->first;
nCurPos = m_nFilePos = m_aRowToFilePos.rbegin()->second;
while(m_nRowPos != nOffset)
- seekRow(FILE_NEXT,1,nCurPos);
+ seekRow(IResultSetHelper::NEXT,1,nCurPos);
}
else
{
@@ -333,7 +334,7 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa
}
break;
- case FILE_BOOKMARK:
+ case IResultSetHelper::BOOKMARK:
m_pFileStream->Seek(nOffset);
if (m_pFileStream->IsEof())
return sal_False;
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
index 8f0d564ee332..b3e9595a387f 100644
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ b/connectivity/source/drivers/flat/EResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: EResultSet.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: oj $ $Date: 2001-10-18 13:17:58 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:45:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,7 +171,7 @@ sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark ) throw(
m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- return Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_True);
+ return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
@@ -182,7 +182,7 @@ sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark,
m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
- Move(OFileTable::FILE_BOOKMARK,comphelper::getINT32(bookmark),sal_False);
+ Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
return relative(rows);
}
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index 5240f25facc7..449e14de1c19 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OResultSet.cxx,v $
*
- * $Revision: 1.44 $
+ * $Revision: 1.45 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 14:55:07 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:42:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,15 @@
#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
#endif
@@ -117,7 +126,7 @@ using namespace com::sun::star::util;
//------------------------------------------------------------------------------
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
-::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
+::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException)
{
return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.odbc.ResultSet");
}
@@ -156,19 +165,46 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
,m_nLastColumnPos(0)
,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
,m_pStatement(pStmt)
+ ,m_pSkipDeletedSet(NULL)
+ ,m_bRowInserted(sal_False)
+ ,m_bRowDeleted(sal_False)
{
osl_incrementInterlockedCount( &m_refCount );
try
{
m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
+ }
+ catch(Exception&)
+ { // we don't want our result destroy here
+ }
+ SQLINTEGER nCurType = 0;
+ try
+ {
+ N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nCurType,SQL_IS_UINTEGER,0);
+
+ SQLUSMALLINT nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
+ if(SQL_CURSOR_KEYSET_DRIVEN == nCurType)
+ nAskFor = SQL_KEYSET_CURSOR_ATTRIBUTES2;
+ else if(SQL_CURSOR_STATIC == nCurType)
+ nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
+ else if(SQL_CURSOR_FORWARD_ONLY == nCurType)
+ nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
+ else if(SQL_CURSOR_DYNAMIC == nCurType)
+ nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
SQLUINTEGER nValueLen = 0;
+ OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,nAskFor,nValueLen,*(Reference< XInterface >*)this);
+ if((nValueLen & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS)
+ m_pSkipDeletedSet = new OSkipDeletedSet(this);
+ }
+ catch(Exception&)
+ { // we don't want our result destroy here
+ }
+ try
+ {
+ SQLUINTEGER nValueLen = 0;
OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,*(Reference< XInterface >*)this);
-
- SQLINTEGER nCurType = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nCurType,SQL_IS_UINTEGER,0);
-
m_bFetchData = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER && nCurType != SQL_CURSOR_FORWARD_ONLY);
}
catch(Exception&)
@@ -182,6 +218,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
OResultSet::~OResultSet()
{
delete m_pRowStatusArray;
+ delete m_pSkipDeletedSet;
}
// -----------------------------------------------------------------------------
void OResultSet::construct()
@@ -528,12 +565,10 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
sal_Int32 nValue = 0;
OTools::ThrowException(m_pStatement->getOwnConnection(),N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_NUMBER,&nValue,SQL_IS_UINTEGER,0),m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(!nValue) // some driver dosen't support this
- m_nRowPos = nValue;
- return nValue;
+
+ return m_pSkipDeletedSet ? m_pSkipDeletedSet->getMappedPosition(nValue) : nValue;
}
// -------------------------------------------------------------------------
@@ -698,8 +733,6 @@ void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nLastColumnPos = 0;
if(last())
next();
m_bEOF = sal_True;
@@ -719,76 +752,28 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet;
- if(bRet = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO))
- m_nRowPos = 1;
- return bRet;
+ return moveImpl(IResultSetHelper::FIRST,0,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- // here I know definitely that I stand on the last record
- return m_bLastRecord = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO);
+ return moveImpl(IResultSetHelper::LAST,0,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- m_nRowPos = row;
- return bRet;
+ return moveImpl(IResultSetHelper::ABSOLUTE,row,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- m_nRowPos += row;
- return bRet;
+ return moveImpl(IResultSetHelper::RELATIVE,row,sal_True);
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet || m_nCurrentFetchState == SQL_NO_DATA)
- --m_nRowPos;
- return bRet;
+ return moveImpl(IResultSetHelper::PRIOR,0,sal_True);
}
// -------------------------------------------------------------------------
Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
@@ -801,13 +786,15 @@ Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OResultSet::rowDeleted() throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ sal_Bool bRet = m_bRowDeleted;
+ m_bRowDeleted = sal_False;
- return m_pRowStatusArray[0] == SQL_ROW_DELETED;
+ return bRet;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
@@ -815,8 +802,10 @@ sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeExcepti
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ sal_Bool bInserted = m_bRowInserted;
+ m_bRowInserted = sal_False;
- return m_pRowStatusArray[0] == SQL_ROW_ADDED;
+ return bInserted;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
@@ -831,17 +820,7 @@ sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeExceptio
sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO)
- ++m_nRowPos;
- return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
+ return moveImpl(IResultSetHelper::NEXT,1,sal_True);
}
// -------------------------------------------------------------------------
@@ -879,7 +858,20 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- SQLRETURN nRet;
+ SQLSMALLINT nMaxLen = 20;
+ SQLINTEGER nRealLen = 0;
+ Sequence<sal_Int8> aBookmark(nMaxLen);
+
+ SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
+ 0,
+ SQL_C_VARBOOKMARK,
+ aBookmark.getArray(),
+ nMaxLen,
+ &nRealLen
+ );
+ // Sequence<sal_Int8> aRealBookmark(nMaxLen);
+
+
if(getOdbcFunction(ODBC3SQLBulkOperations))
nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_ADD);
else
@@ -889,6 +881,13 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_ADD,SQL_LOCK_NO_CHANGE);
}
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+
+ if(m_pSkipDeletedSet)
+ {
+ if(moveToBookmark(makeAny(aBookmark)))
+ m_pSkipDeletedSet->insertNewPosition(getDriverPos());
+ }
+ m_bRowInserted = sal_True;
nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND);
}
// -------------------------------------------------------------------------
@@ -926,8 +925,13 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
// -------------------------------------------------------------------------
void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException)
{
+ sal_Int32 nPos = getDriverPos();
SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+
+ m_bRowDeleted = m_pRowStatusArray[0] == SQL_ROW_DELETED;
+ if(m_pSkipDeletedSet)
+ m_pSkipDeletedSet->deletePosition(nPos);
}
// -------------------------------------------------------------------------
@@ -1165,40 +1169,27 @@ sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLEx
// XDeleteRows
Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- SQLRETURN nReturn;
-
- const Any* pBegin = rows.getConstArray();
- const Any* pEnd = pBegin + rows.getLength();
-
- typedef sal_Int8* sal_INT8;
- sal_Int8** pArray = new sal_INT8[rows.getLength()];
- for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin)
- {
- pArray[i] = ((Sequence<sal_Int8>*)pBegin->getValue())->getArray();
- }
-
- sal_Int32* pStatusArray = new sal_Int32[rows.getLength()];
-
-
- nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR ,(SQLPOINTER)pStatusArray,SQL_IS_POINTER);
- nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)rows.getLength(),SQL_IS_INTEGER);
- sal_Int32 nLen = rows.getLength();
- nReturn = N3SQLBindCol(m_aStatementHandle,0,SQL_C_VARBOOKMARK,pArray,rows.getLength(),&nLen);
- nReturn = N3SQLBulkOperations(m_aStatementHandle,SQL_DELETE_BY_BOOKMARK);
+ Sequence< sal_Int32 > aRet(rows.getLength());
+ sal_Int32 *pRet = aRet.getArray();
- delete [] pArray;
+ const Any *pBegin = rows.getConstArray();
+ const Any *pEnd = pBegin + rows.getLength();
- Sequence< sal_Int32 > aRet(rows.getLength());
- for(sal_Int32 j=0;j<rows.getLength();++j)
+ for(;pBegin != pEnd;++pBegin,++pRet)
{
- aRet.getArray()[j] = pStatusArray[j] == SQL_ROW_SUCCESS;
+ try
+ {
+ if(moveToBookmark(*pBegin))
+ {
+ deleteRow();
+ *pRet = 1;
+ }
+ }
+ catch(SQLException&)
+ {
+ *pRet = 0;
+ }
}
- delete pStatusArray;
- delete pArray;
return aRet;
}
//------------------------------------------------------------------------------
@@ -1206,6 +1197,11 @@ sal_Int32 OResultSet::getResultSetConcurrency() const
{
sal_uInt32 nValue = 0;
N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CONCURRENCY,&nValue,SQL_IS_UINTEGER,0);
+ if(SQL_CONCUR_READ_ONLY == nValue)
+ nValue = ResultSetConcurrency::READ_ONLY;
+ else
+ nValue = ResultSetConcurrency::UPDATABLE;
+
return nValue;
}
//------------------------------------------------------------------------------
@@ -1213,14 +1209,18 @@ sal_Int32 OResultSet::getResultSetType() const
{
sal_uInt32 nValue = 0;
N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0);
+ if(SQL_SENSITIVE == nValue)
+ nValue = ResultSetType::SCROLL_SENSITIVE;
+ else if(SQL_INSENSITIVE == nValue)
+ nValue = ResultSetType::SCROLL_INSENSITIVE;
+ else
+ nValue = ResultSetType::FORWARD_ONLY;
return nValue;
}
//------------------------------------------------------------------------------
sal_Int32 OResultSet::getFetchDirection() const
{
- sal_uInt32 nValue = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0);
- return nValue;
+ return FetchDirection::FORWARD;
}
//------------------------------------------------------------------------------
sal_Int32 OResultSet::getFetchSize() const
@@ -1481,6 +1481,69 @@ void SAL_CALL OResultSet::release() throw()
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
// -----------------------------------------------------------------------------
+sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
+{
+ sal_Bool bRet = sal_False;
+ SQLSMALLINT nFetchOrientation = SQL_FETCH_NEXT;
+ switch(_eCursorPosition)
+ {
+ case IResultSetHelper::NEXT:
+ nFetchOrientation = SQL_FETCH_NEXT;
+ break;
+ case IResultSetHelper::PRIOR:
+ nFetchOrientation = SQL_FETCH_PRIOR;
+ break;
+ case IResultSetHelper::FIRST:
+ nFetchOrientation = SQL_FETCH_FIRST;
+ break;
+ case IResultSetHelper::LAST:
+ nFetchOrientation = SQL_FETCH_LAST;
+ break;
+ case IResultSetHelper::RELATIVE:
+ nFetchOrientation = SQL_FETCH_RELATIVE;
+ break;
+ case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers
+ nFetchOrientation = SQL_FETCH_ABSOLUTE;
+ break;
+ }
+ m_nLastColumnPos = 0;
+ m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
+
+ OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+ if(m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO)
+ ++m_nRowPos;
+ return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OResultSet::getDriverPos() const
+{
+ sal_Int32 nValue = 0;
+ N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_NUMBER,&nValue,SQL_IS_UINTEGER,0);
+ return nValue;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::deletedVisible() const
+{
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::isRowDeleted() const
+{
+ return m_pRowStatusArray[0] == SQL_ROW_DELETED;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ return (m_pSkipDeletedSet != NULL)
+ ?
+ m_pSkipDeletedSet->skipDeleted(_eCursorPosition,_nOffset,_bRetrieveData)
+ :
+ move(_eCursorPosition,_nOffset,_bRetrieveData);
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/inc/TResultSetHelper.hxx b/connectivity/source/inc/TResultSetHelper.hxx
new file mode 100644
index 000000000000..2dbcdc474d22
--- /dev/null
+++ b/connectivity/source/inc/TResultSetHelper.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: TResultSetHelper.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_TRESULTSETHELPER_HXX
+#define CONNECTIVITY_TRESULTSETHELPER_HXX
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+namespace connectivity
+{
+ class SAL_NO_VTABLE IResultSetHelper
+ {
+ public:
+ enum Movement
+ {
+ NEXT = 0,
+ PRIOR,
+ FIRST,
+ LAST,
+ RELATIVE,
+ ABSOLUTE,
+ BOOKMARK
+ };
+ public:
+ virtual sal_Bool move(Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData) = 0;
+ virtual sal_Int32 getDriverPos() const = 0;
+ virtual sal_Bool deletedVisible() const = 0;
+ virtual sal_Bool isRowDeleted() const = 0;
+ };
+}
+
+#endif // CONNECTIVITY_TRESULTSETHELPER_HXX
+
diff --git a/connectivity/source/inc/TSkipDeletedSet.hxx b/connectivity/source/inc/TSkipDeletedSet.hxx
new file mode 100644
index 000000000000..259cd28347d2
--- /dev/null
+++ b/connectivity/source/inc/TSkipDeletedSet.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: TSkipDeletedSet.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-10-26 07:40:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
+#define CONNECTIVITY_SKIPDELETEDSSET_HXX
+
+#ifndef CONNECTIVITY_TRESULTSETHELPER_HXX
+#include "TResultSetHelper.hxx"
+#endif
+
+#include <map>
+#include <vector>
+
+namespace connectivity
+{
+ /**
+ the class OSkipDeletedSet supports a general method to skip deleted rows
+ */
+ class OSkipDeletedSet
+ {
+ typedef ::std::map<sal_Int32,sal_Int32> TInt2IntMap;
+ TInt2IntMap m_aBookmarks; // map from postion to logical position
+ ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to position map, the order is the logical position
+ IResultSetHelper* m_pHelper; // used for moving in the resultset
+
+ sal_Bool moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData);
+ public:
+ OSkipDeletedSet(IResultSetHelper* _pHelper);
+
+ /**
+ skipDeleted moves the resultset to the position defined by the parameters
+ it garantees that the row isn't deleted
+ @param
+ IResultSetHelper::Movement _eCursorPosition in which direction the resultset should be moved
+ sal_Int32 _nOffset the position relativ to the movement
+ sal_Bool _bRetrieveData is true when the current row should be filled which data
+ @return
+ true when the movement was successful otherwise false
+ */
+ sal_Bool skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
+ /**
+ clear the map and the vector used in this class
+ */
+ void clear();
+ /**
+ getMappedPosition returns the mapped position of a logical position
+ @param
+ sal_Int32 _nPos the logical position
+
+ @return the mapped position
+ */
+ sal_Int32 getMappedPosition(sal_Int32 _nPos) const;
+ /**
+ insertNewPosition adds a new position to the map
+ @param
+ sal_Int32 _nPos the logical position
+ */
+ void insertNewPosition(sal_Int32 _nPos);
+ /**
+ deletePosition deletes this position from the map and decrement all following positions
+ @param
+ sal_Int32 _nPos the logical position
+ */
+ void deletePosition(sal_Int32 _nPos);
+ };
+}
+#endif // CONNECTIVITY_SKIPDELETEDSSET_HXX
+
diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx
index 73f5e33a6645..2a9228c9d971 100644
--- a/connectivity/source/inc/calc/CTable.hxx
+++ b/connectivity/source/inc/calc/CTable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CTable.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:12:50 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -127,7 +127,7 @@ namespace connectivity
);
virtual sal_Int32 getCurrentLastPos() const;
- virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 409d1b30e13b..1f45f7da3670 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DTable.hxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:54:43 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -181,7 +181,7 @@ namespace connectivity
void construct(); // can throw any exception
virtual sal_Int32 getCurrentLastPos() const;
- virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index 625e9fd1efaa..8c5e68cc5d8d 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FResultSet.hxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 16:36:33 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -119,6 +119,9 @@
#ifndef CONNECTIVITY_TSORTINDEX_HXX
#include "TSortIndex.hxx"
#endif
+#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
+#include "TSkipDeletedSet.hxx"
+#endif
namespace connectivity
{
@@ -140,6 +143,7 @@ namespace connectivity
::com::sun::star::lang::XUnoTunnel> OResultSet_BASE;
class OResultSet : public comphelper::OBaseMutex,
+ public ::connectivity::IResultSetHelper,
public OResultSet_BASE,
public ::comphelper::OPropertyContainer,
public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
@@ -162,8 +166,9 @@ namespace connectivity
TIntVector::iterator m_aEvaluateIter;
- TInt2IntMap m_aBookmarks; // map from bookmarks to logical position
- ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position
+// TInt2IntMap m_aBookmarks; // map from bookmarks to logical position
+// ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position
+ OSkipDeletedSet m_aSkipDeletedSet;
::vos::ORef<OKeySet> m_pFileSet;
OKeySet::iterator m_aFileSetIter;
@@ -213,7 +218,7 @@ namespace connectivity
void construct();
sal_Bool evaluate();
- BOOL ExecuteRow(OFileTable::FilePosition eFirstCursorPosition,
+ BOOL ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
INT32 nOffset = 1,
BOOL bRebind = TRUE,
BOOL bEvaluate = TRUE,
@@ -222,7 +227,6 @@ namespace connectivity
OKeyValue* GetOrderbyKeyValue(OValueRow _rRow);
BOOL IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;}
- sal_Bool moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData);
// return true when the select statement is "select count(*) from table"
sal_Bool isCount() const;
void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
@@ -235,8 +239,7 @@ namespace connectivity
using OResultSet_BASE::rBHelper;
- BOOL Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData);
- BOOL SkipDeleted(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData);
+ BOOL Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData);
virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex);
// OPropertyArrayUsageHelper
@@ -371,6 +374,12 @@ namespace connectivity
sal_Bool _bSetColumnMapping,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
::std::vector<sal_Int32>& _rColMapping);
+
+ // IResultSetHelper
+ virtual sal_Bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
+ virtual sal_Int32 getDriverPos() const;
+ virtual sal_Bool deletedVisible() const;
+ virtual sal_Bool isRowDeleted() const;
};
// -------------------------------------------------------------------------
inline sal_Int32 OResultSet::mapColumn(sal_Int32 column)
diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx
index b1d624feee8e..1ad8a6185a7b 100644
--- a/connectivity/source/inc/file/FTable.hxx
+++ b/connectivity/source/inc/file/FTable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FTable.hxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:12:51 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,9 @@
#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
#include "connectivity/FValue.hxx"
#endif
+#ifndef CONNECTIVITY_TRESULTSETHELPER_HXX
+#include "TResultSetHelper.hxx"
+#endif
namespace connectivity
{
@@ -94,7 +97,7 @@ namespace connectivity
OConnection* m_pConnection;
SvStream* m_pFileStream;
::vos::ORef<OSQLColumns> m_aColumns;
- sal_Int32 m_nFilePos; // aktuelle FilePosition
+ sal_Int32 m_nFilePos; // aktuelle IResultSetHelper::Movement
sal_uInt8* m_pBuffer;
sal_uInt16 m_nBufferSize; // Groesse des ReadBuffer, wenn pBuffer != NULL
sal_Bool m_bWriteable; // svstream cann't say if we are writeable
@@ -105,18 +108,6 @@ namespace connectivity
virtual void refreshColumns();
virtual void refreshKeys();
virtual void refreshIndexes();
-
- enum FilePosition
- {
- FILE_NEXT = 0,
- FILE_PRIOR,
- FILE_FIRST,
- FILE_LAST,
- FILE_RELATIVE,
- FILE_ABSOLUTE,
- FILE_BOOKMARK
- };
-
public:
OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection);
OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection,
@@ -137,7 +128,7 @@ namespace connectivity
OConnection* getConnection() const { return m_pConnection;}
virtual sal_Int32 getCurrentLastPos() const {return -1;}
- virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0;
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0;
virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) = 0;
::vos::ORef<OSQLColumns> getTableColumns() const {return m_aColumns;}
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index e0f976ede963..7b864aeef396 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ETable.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:12:51 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,7 +138,7 @@ namespace connectivity
const ::rtl::OUString& _CatalogName = ::rtl::OUString()
);
- virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/inc/mozaddressbook/MABTable.hxx b/connectivity/source/inc/mozaddressbook/MABTable.hxx
index e287afd86dfd..0a63cb962f31 100644
--- a/connectivity/source/inc/mozaddressbook/MABTable.hxx
+++ b/connectivity/source/inc/mozaddressbook/MABTable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MABTable.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:12:51 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,7 +146,7 @@ namespace connectivity
~OMozabTable( );
virtual sal_Int32 getCurrentLastPos() const;
- virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
+ virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
virtual sal_Bool fetchRow(connectivity::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData);
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx
index 6e8b24125332..86400a32973c 100644
--- a/connectivity/source/inc/odbc/OResultSet.hxx
+++ b/connectivity/source/inc/odbc/OResultSet.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OResultSet.hxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: hr $ $Date: 2001-10-17 13:57:34 $
+ * last change: $Author: oj $ $Date: 2001-10-26 07:41:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,6 +113,9 @@
#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
#include "connectivity/FValue.hxx"
#endif
+#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
+#include "TSkipDeletedSet.hxx"
+#endif
namespace connectivity
{
@@ -142,6 +145,7 @@ namespace connectivity
// typedef ::com::sun::star::uno::Sequence<TVoidPtr> TVoidVector;
class OResultSet : public comphelper::OBaseMutex,
+ public ::connectivity::IResultSetHelper,
public OResultSet_BASE,
public ::cppu::OPropertySetHelper,
public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
@@ -153,11 +157,13 @@ namespace connectivity
TVoidVector m_aBindVector;
::std::vector<sal_Int32> m_aLengthVector;
::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
+
TDataRow m_aRow; // only used when SQLGetData can't be called in any order
ORowSetValue m_aEmptyValue; // needed for the getValue method when no prefetch is used
SQLHANDLE m_aStatementHandle;
SQLHANDLE m_aConnectionHandle;
OStatement_Base* m_pStatement;
+ OSkipDeletedSet* m_pSkipDeletedSet;
::com::sun::star::uno::WeakReferenceHelper m_aStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
SQLUSMALLINT* m_pRowStatusArray;
@@ -172,6 +178,8 @@ namespace connectivity
sal_Bool m_bFreeHandle;
sal_Bool m_bInserting;
sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow
+ sal_Bool m_bRowInserted;
+ sal_Bool m_bRowDeleted;
sal_Bool isBookmarkable() const;
sal_Int32 getResultSetConcurrency() const;
@@ -189,7 +197,7 @@ namespace connectivity
void releaseBuffer();
void updateValue(sal_Int32 columnIndex,SQLSMALLINT _nType,void* _pValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
const ORowSetValue& getValue(sal_Int32 _nColumnIndex,SQLSMALLINT _nType,void* _pValue,SQLINTEGER _rSize);
-
+ sal_Bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
// OPropertyArrayUsageHelper
@@ -328,6 +336,12 @@ namespace connectivity
// special methods
sal_Int32 mapColumn(sal_Int32 column);
+
+ // IResultSetHelper
+ virtual sal_Bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
+ virtual sal_Int32 getDriverPos() const;
+ virtual sal_Bool deletedVisible() const;
+ virtual sal_Bool isRowDeleted() const;
};
}
}