summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-05-08 12:26:37 +0000
committerOcke Janssen <oj@openoffice.org>2001-05-08 12:26:37 +0000
commit1072a9f5c7b848bc6f36dd2263a25c9dbd3820c9 (patch)
tree2f7dc8b66d32fd1440bd5bf45d5b84f4a0a6e6f6 /connectivity
parent785a24acc6b2ae993c8829c88a9db84f0ddf8265 (diff)
#86202# correct the index impl
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx38
-rw-r--r--connectivity/source/drivers/dbase/DIndexColumns.cxx10
-rw-r--r--connectivity/source/drivers/dbase/DIndexIter.cxx34
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx264
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx24
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx14
-rw-r--r--connectivity/source/inc/dbase/DIndex.hxx7
-rw-r--r--connectivity/source/inc/dbase/dindexnode.hxx98
8 files changed, 279 insertions, 210 deletions
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 255e8519e76b..20a63a25364a 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndex.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2001-05-07 12:22:11 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,6 +96,9 @@
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#endif
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
#endif
@@ -140,6 +143,7 @@ using namespace connectivity::file;
using namespace connectivity::sdbcx;
using namespace connectivity::dbase;
using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
using namespace com::sun::star::ucb;
@@ -150,10 +154,9 @@ IMPLEMENT_SERVICE_INFO(ODbaseIndex,"com.sun.star.sdbcx.driver.dbase.Index","com.
ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers())
, m_pTable(_pTable)
,m_pFileStream(NULL)
- ,m_bUnique(sal_False)
,m_nCurNode(NODE_NOTFOUND)
{
- m_aHeader.db_maxkeys = m_aHeader.db_maxkeys = m_aHeader.db_keylen = m_aHeader.db_pagecount = m_aHeader.db_rootpage = 0;
+ m_aHeader.db_pagecount = m_aHeader.db_rootpage = m_aHeader.db_keytype = m_aHeader.db_maxkeys = m_aHeader.db_keylen = 0;
m_aHeader.db_name[0] = '\0';
construct();
}
@@ -165,7 +168,6 @@ ODbaseIndex::ODbaseIndex( ODbaseTable* _pTable,
, m_aHeader(_rHeader)
, m_pTable(_pTable)
,m_pFileStream(NULL)
- ,m_bUnique(sal_False)
,m_nCurNode(NODE_NOTFOUND)
{
construct();
@@ -369,7 +371,7 @@ void ODbaseIndex::Collect(ONDXPage* pPage)
OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
if (pPage)
{
- pPage->acquire();
+ // pPage->acquire();
m_aCollector.push_back(pPage);
}
}
@@ -598,6 +600,7 @@ BOOL ODbaseIndex::CreateImpl()
m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
m_pFileStream->SetBufferSize(512);
+ m_pFileStream->SetFiller('\0');
// Zunchst mu das Ergebnis sortiert sein
Reference<XStatement> xStmt;
@@ -684,14 +687,15 @@ BOOL ODbaseIndex::CreateImpl()
m_bUseCollector = TRUE;
// ULONG nRowsLeft = pCursor->RowCount();
+ sal_Int32 nRowsLeft = 0;
Reference<XRow> xRow(xSet,UNO_QUERY);
if(xSet->last())
{
- sal_Int32 nRowsLeft = xSet->getRow();
- xSet->beforeFirst();
- sal_Int32 nPos = 0;
+ Reference<XRowLocate> xRowLocate(xSet,UNO_QUERY);
+ nRowsLeft = xSet->getRow();
+ xSet->beforeFirst();
ONDXKey aKey(ORowSetValue(), nType, 0);
ONDXKey aInsertKey(ORowSetValue(), nType, 0);
// Erzeugen der Indexstruktur
@@ -705,6 +709,8 @@ BOOL ODbaseIndex::CreateImpl()
aKey.setValue(aValue);
if (aKey == (*m_aCurLeaf)[m_nCurNode].GetKey())
{
+ ::comphelper::disposeComponent(xSet);
+ ::comphelper::disposeComponent(xStmt);
closeImpl();
if(UCBContentHelper::Exists(sFile))
UCBContentHelper::Kill(sFile);
@@ -712,22 +718,24 @@ BOOL ODbaseIndex::CreateImpl()
}
}
aInsertKey.setValue(aValue);
- aInsertKey.setRecord(++nPos);
+ aInsertKey.setRecord(::comphelper::getINT32(xRowLocate->getBookmark()));
ONDXNode aNewNode(aInsertKey);
if (!m_aCurLeaf->Insert(aNewNode, --nRowsLeft))
break;
-
- #ifdef DEBUG
- //DBG_TRACE1("SDB: %s", (const char*)pCursor->Variable(1)->GetString());
- // PrintTree();
- #endif
}
}
xRow = NULL;
::comphelper::disposeComponent(xSet);
::comphelper::disposeComponent(xStmt);
+ if(nRowsLeft)
+ {
+ closeImpl();
+ if(UCBContentHelper::Exists(sFile))
+ UCBContentHelper::Kill(sFile);
+ throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,Any());
+ }
Release();
createINFEntry();
return sal_True;
diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx
index f94ca468b45b..dbb4c36ce9c5 100644
--- a/connectivity/source/drivers/dbase/DIndexColumns.cxx
+++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndexColumns.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:17:57 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,8 +87,12 @@ Reference< XNamed > ODbaseIndexColumns::createObject(const ::rtl::OUString& _rNa
const ODbaseTable* pTable = m_pIndex->getTable();
::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns();
+ OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
+
+ Reference< XPropertySet > xCol;
+ if(aIter != aCols->end())
+ xCol = *aIter;
- Reference< XPropertySet > xCol(*find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())));
if(!xCol.is())
return Reference< XNamed >();
diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx
index 83f73bec3f42..09c1d962f8c8 100644
--- a/connectivity/source/drivers/dbase/DIndexIter.cxx
+++ b/connectivity/source/drivers/dbase/DIndexIter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndexIter.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-04-30 10:11:27 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,9 +106,9 @@ ULONG OIndexIterator::Find(BOOL bFirst)
// Vorbereitung , auf kleinstes Element positionieren
if (bFirst)
{
- ONDXPage* pPage = m_aRoot.getBodyPtr();
+ ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex).getBodyPtr();
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -157,7 +157,7 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey)
// weiter absteigen
ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex)
: ((*pPage)[i-1]).GetChild(m_pIndex, pPage);
- pFoundKey = aPage.Is() ? GetFirstKey(aPage.getBodyPtr(), rKey) : NULL;
+ pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : NULL;
}
else if (i == pPage->Count())
{
@@ -185,14 +185,14 @@ ULONG OIndexIterator::GetCompare(BOOL bFirst)
if (bFirst)
{
// Vorbereitung , auf kleinstes Element positionieren
- ONDXPage* pPage = m_aRoot.getBodyPtr();
+ ONDXPage* pPage = m_aRoot;
switch (ePredicateType)
{
case SQL_PRED_NOTEQUAL:
case SQL_PRED_LESS:
case SQL_PRED_LESSOREQUAL:
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex).getBodyPtr();
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -212,10 +212,10 @@ ULONG OIndexIterator::GetCompare(BOOL bFirst)
break;
case SQL_PRED_GREATEROREQUAL:
case SQL_PRED_EQUAL:
- pKey = GetFirstKey(m_aRoot.getBodyPtr(),*m_pOperand);
+ pKey = GetFirstKey(m_aRoot,*m_pOperand);
break;
case SQL_PRED_GREATER:
- if (!(pKey = GetFirstKey(m_aRoot.getBodyPtr(),*m_pOperand)))
+ if (!(pKey = GetFirstKey(m_aRoot,*m_pOperand)))
while ((pKey = GetNextKey()) && !m_pOperator->operate(pKey,m_pOperand));
}
}
@@ -251,10 +251,10 @@ ULONG OIndexIterator::GetLike(BOOL bFirst)
// ONDXIndex* m_pIndex = GetNDXIndex();
if (bFirst)
{
- ONDXPage* pPage = m_aRoot.getBodyPtr();
+ ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex).getBodyPtr();
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -272,9 +272,9 @@ ULONG OIndexIterator::GetNull(BOOL bFirst)
// ONDXIndex* m_pIndex = GetNDXIndex();
if (bFirst)
{
- ONDXPage* pPage = m_aRoot.getBodyPtr();
+ ONDXPage* pPage = m_aRoot;
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex).getBodyPtr();
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = NODE_NOTFOUND;
@@ -315,17 +315,17 @@ ONDXKey* OIndexIterator::GetNextKey()
// ONDXIndex* m_pIndex = GetNDXIndex();
if (m_aCurLeaf.Is() && ((++m_nCurNode) >= m_aCurLeaf->Count()))
{
- ONDXPage* pPage = m_aCurLeaf.getBodyPtr();
+ ONDXPage* pPage = m_aCurLeaf;
// naechste Seite suchen
while (pPage)
{
- ONDXPage* pParentPage = pPage->GetParent().getBodyPtr();
+ ONDXPage* pParentPage = pPage->GetParent();
if (pParentPage)
{
USHORT nPos = pParentPage->Search(pPage);
if (nPos != pParentPage->Count() - 1)
{ // Seite gefunden
- pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage).getBodyPtr();
+ pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage);
break;
}
}
@@ -334,7 +334,7 @@ ONDXKey* OIndexIterator::GetNextKey()
// jetzt wieder zum Blatt
while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex).getBodyPtr();
+ pPage = pPage->GetChild(m_pIndex);
m_aCurLeaf = pPage;
m_nCurNode = 0;
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index f7fd60cb11b6..2e65d6a1bde9 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dindexnode.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: oj $ $Date: 2001-05-07 12:22:11 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -122,26 +122,18 @@ ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent)
,nCount(0)
,bModified(FALSE)
,ppNodes(NULL)
- ,m_refCount(0)
+ ,aParent(pParent)
{
sal_uInt16 nT = rIndex.getHeader().db_maxkeys;
ppNodes = new ONDXNode[nT];
- aParent = new ONDXPagePtr(pParent);
- aChild = new ONDXPagePtr();
}
//------------------------------------------------------------------
ONDXPage::~ONDXPage()
{
delete[] ppNodes;
- delete aParent;
- delete aChild;
-}
-// -------------------------------------------------------------------------
-void ONDXPage::release()
-{
- if (! osl_decrementInterlockedCount( &m_refCount ))
- QueryDelete();
+ // delete aParent;
+ // delete aChild;
}
//------------------------------------------------------------------
void ONDXPage::QueryDelete()
@@ -153,8 +145,8 @@ void ONDXPage::QueryDelete()
bModified = FALSE;
if (rIndex.UseCollector())
{
- if ((*aChild).Is())
- (*aChild)->Release(FALSE);
+ if (aChild.Is())
+ aChild->Release(FALSE);
for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++)
{
@@ -163,25 +155,23 @@ void ONDXPage::QueryDelete()
ppNodes[i] = ONDXNode();
}
- // RestoreNoDelete();
+ RestoreNoDelete();
nCount = 0;
- (*aParent).Clear();
+ aParent.Clear();
rIndex.Collect(this);
}
else
- delete this;
-// else
-// SvRefBase::QueryDelete();
+ SvRefBase::QueryDelete();
}
//------------------------------------------------------------------
ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex)
{
- if (!(*aChild).Is() && pIndex)
+ if (!aChild.Is() && pIndex)
{
- (*aChild) = rIndex.CreatePage((*aChild).GetPagePos(),this,(*aChild).HasPage());
+ aChild = rIndex.CreatePage(aChild.GetPagePos(),this,aChild.HasPage());
}
- return (*aChild);
+ return aChild;
}
//------------------------------------------------------------------
@@ -250,7 +240,7 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
{
// und damit habe ich im folgenden praktisch eine Node weniger
- if (IsLeaf() && this == rIndex.m_aCurLeaf.getBodyPtr())
+ if (IsLeaf() && this == &rIndex.m_aCurLeaf)
{
// geht davon aus, dass der Knoten, auf dem die Bedingung (<=)
// zutrifft, als m_nCurNode gesetzt ist
@@ -293,7 +283,7 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
}
// neues blatt erzeugen und Seite aufteilen
- ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,(*aParent).getBodyPtr());
+ ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,aParent);
rIndex.SetPageCount(nNewPageCount);
// wieviele Knoten weren noch eingefuegt
@@ -320,7 +310,7 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
}
aNewPage->Append(aSplitNode);
- ONDXPagePtr aTempParent = (*aParent);
+ ONDXPagePtr aTempParent = aParent;
if (IsLeaf())
{
rIndex.m_aCurLeaf = aNewPage;
@@ -408,25 +398,25 @@ void ONDXPage::Remove(USHORT nPos)
void ONDXPage::Release(BOOL bSave)
{
// freigeben der Pages
- if ((*aChild).Is())
- (*aChild)->Release(bSave);
+ if (aChild.Is())
+ aChild->Release(bSave);
// Pointer freigeben
- (*aChild).Clear();
+ aChild.Clear();
for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++)
{
- if (ppNodes[i].GetChild().isValid())
+ if (ppNodes[i].GetChild())
ppNodes[i].GetChild()->Release(bSave);
ppNodes[i].GetChild().Clear();
}
- (*aParent) = NULL;
+ aParent = NULL;
}
//------------------------------------------------------------------
void ONDXPage::ReleaseFull(BOOL bSave)
{
- ONDXPagePtr aTempParent = (*aParent);
+ ONDXPagePtr aTempParent = aParent;
Release(bSave);
if (aTempParent.Is())
@@ -468,7 +458,7 @@ void ONDXPage::SearchAndReplace(const ONDXKey& rSearch,
ONDXPage* pPage = this;
while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND)
- pPage = pPage->aParent->getBodyPtr();
+ pPage = pPage->aParent;
if (pPage)
{
@@ -494,7 +484,7 @@ USHORT ONDXPage::Search(const ONDXPage* pPage)
{
USHORT i = 0xFFFF;
while (++i < Count())
- if (((*this)[i]).GetChild().getBodyPtr() == pPage)
+ if (((*this)[i]).GetChild() == pPage)
break;
// wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst
@@ -514,7 +504,7 @@ BOOL ONDXPage::Delete(USHORT nNodePos)
// beim Parent muss nun der KeyValue ausgetauscht werden
if (HasParent())
- (*aParent)->SearchAndReplace(aNode.GetKey(),
+ aParent->SearchAndReplace(aNode.GetKey(),
(*this)[nNodePos-1].GetKey());
}
}
@@ -526,53 +516,53 @@ BOOL ONDXPage::Delete(USHORT nNodePos)
if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2))
{
// Feststellen, welcher Knoten auf die Seite zeigt
- USHORT nParentNodePos = (*aParent)->Search(this);
+ USHORT nParentNodePos = aParent->Search(this);
// letzte Element auf Vaterseite
// -> zusammenlegen mit vorletzter Seite
- if (nParentNodePos == ((*aParent)->Count() - 1))
+ if (nParentNodePos == (aParent->Count() - 1))
{
if (!nParentNodePos)
// zusammenlegen mit linken nachbarn
- Merge(nParentNodePos,(*aParent)->GetChild(&rIndex));
+ Merge(nParentNodePos,aParent->GetChild(&rIndex));
else
- Merge(nParentNodePos,(*(*aParent))[nParentNodePos-1].GetChild(&rIndex,(*aParent).getBodyPtr()));
+ Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent));
}
// sonst Seite mit naechster Seite zusammenlegen
else
{
// zusammenlegen mit rechten nachbarn
- Merge(nParentNodePos + 1,((*(*aParent))[nParentNodePos + 1].GetChild(&rIndex,(*aParent).getBodyPtr())));
+ Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent)));
nParentNodePos++;
}
- if (HasParent() && !(*(*aParent))[nParentNodePos].HasChild())
- (*aParent)->Delete(nParentNodePos);
+ if (HasParent() && !(*aParent)[nParentNodePos].HasChild())
+ aParent->Delete(nParentNodePos);
/*
// letzte Element auf Vaterseite
// -> zusammenlegen mit vorletzter Seite
- if (nParentNodePos == ((*aParent)->Count() - 1))
+ if (nParentNodePos == (aParent->Count() - 1))
{
if (!nParentNodePos)
// zusammenlegen mit linken nachbarn
- Merge(nParentNodePos,(*aParent)->GetChild(&rIndex));
+ Merge(nParentNodePos,aParent->GetChild(&rIndex));
else
- Merge(nParentNodePos,(*(*aParent))[nParentNodePos-1].GetChild(&rIndex,(*aParent)));
+ Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent));
}
// sonst Seite mit naechster Seite zusammenlegen
else if(nParentNodePos != NODE_NOTFOUND)
{
// zusammenlegen mit rechten nachbarn
- Merge(nParentNodePos + 1,((*(*aParent))[nParentNodePos + 1].GetChild(&rIndex,(*aParent))));
+ Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent)));
nParentNodePos++;
}
else // Sonderbehandlung
{
- // Page ist (*aChild) Page vom Parent => erste Page aus ppNodes an (*aChild) anhngen
- Merge(0,(*(*aParent))[0].GetChild(&rIndex,(*aParent)));
+ // Page ist aChild Page vom Parent => erste Page aus ppNodes an aChild anhngen
+ Merge(0,(*aParent)[0].GetChild(&rIndex,aParent));
nParentNodePos = 0;
}
- if (HasParent() && !(*(*aParent))[nParentNodePos].HasChild())
- (*aParent)->Delete(nParentNodePos);
+ if (HasParent() && !(*aParent)[nParentNodePos].HasChild())
+ aParent->Delete(nParentNodePos);
*/
}
@@ -610,7 +600,7 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage)
aResultNode = (*this)[nCount - 1];
if (HasParent())
- (*aParent)->SearchAndReplace(aLastNode.GetKey(),
+ aParent->SearchAndReplace(aLastNode.GetKey(),
aResultNode.GetKey());
}
else
@@ -657,7 +647,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
USHORT nLastNode = bRight ? Count() - 1 : xPage->Count() - 1;
if (bRight)
{
- DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
+ DBG_ASSERT(&xPage != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
// alle Knoten aus xPage auf den linken Knoten verschieben (anhngen)
while (xPage->Count())
{
@@ -667,7 +657,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
}
else
{
- DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
+ DBG_ASSERT(&xPage != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
// xPage ist die linke Page und THIS die rechte
while (xPage->Count())
{
@@ -676,29 +666,29 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
}
// alte Position von xPage beim Parent mit this ersetzen
if (nParentNodePos)
- (*(*aParent))[nParentNodePos-1].SetChild(this,(*aParent).getBodyPtr());
+ (*aParent)[nParentNodePos-1].SetChild(this,aParent);
else // oder als rechten Knoten setzen
- (*aParent)->SetChild(this);
- (*aParent)->SetModified(TRUE);
+ aParent->SetChild(this);
+ aParent->SetModified(TRUE);
}
// Child beziehung beim Vaterknoten aufheben
- (*(*aParent))[nParentNodePos].SetChild();
+ (*aParent)[nParentNodePos].SetChild();
// Austauschen des KnotenWertes, nur wenn geaenderte Page
// die linke ist, ansonsten werde
- if((*aParent)->IsRoot() && (*aParent)->Count() == 1)
+ if(aParent->IsRoot() && aParent->Count() == 1)
{
- (*(*aParent))[0].SetChild();
- (*aParent)->ReleaseFull();
- (*aParent) = NULL;
+ (*aParent)[0].SetChild();
+ aParent->ReleaseFull();
+ aParent = NULL;
rIndex.SetRootPos(nPagePos);
rIndex.m_aRoot = this;
SetModified(TRUE);
}
else
- (*aParent)->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey());
+ aParent->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey());
xPage->SetModified(FALSE);
xPage->ReleaseFull(); // wird nicht mehr benoetigt
@@ -716,7 +706,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
xPage->Remove(0);
}
// Austauschen des KnotenWertes: Setzt alten letzten Wert durch den letzten von xPage
- (*aParent)->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey());
+ aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey());
}
else
{
@@ -728,7 +718,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
Remove(nCount-1);
}
// Austauschen des KnotenWertes
- (*aParent)->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey());
+ aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey());
}
}
}
@@ -739,21 +729,21 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
{
if (bRight)
{
- DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
+ DBG_ASSERT(&xPage != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
// Vaterknoten wird mit integriert
// erhaelt zunaechst Child von xPage
- (*(*aParent))[nParentNodePos].SetChild(xPage->GetChild(),(*aParent).getBodyPtr());
- Append((*(*aParent))[nParentNodePos]);
+ (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent);
+ Append((*aParent)[nParentNodePos]);
for (USHORT i = 0 ; i < xPage->Count(); i++)
Append((*xPage)[i]);
}
else
{
- DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
+ DBG_ASSERT(&xPage != this,"xPage und THIS drfen nicht gleich sein: Endlosschleife");
// Vaterknoten wird mit integriert
// erhaelt zunaechst Child
- (*(*aParent))[nParentNodePos].SetChild(GetChild(),(*aParent).getBodyPtr()); // Parent merkt sich mein Child
- Insert(0,(*(*aParent))[nParentNodePos]); // Node vom Parent bei mir einfgen
+ (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent merkt sich mein Child
+ Insert(0,(*aParent)[nParentNodePos]); // Node vom Parent bei mir einfgen
while (xPage->Count())
{
Insert(0,(*xPage)[xPage->Count()-1]);
@@ -762,20 +752,20 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
SetChild(xPage->GetChild());
if (nParentNodePos)
- (*(*aParent))[nParentNodePos-1].SetChild(this,(*aParent).getBodyPtr());
+ (*aParent)[nParentNodePos-1].SetChild(this,aParent);
else
- (*aParent)->SetChild(this);
+ aParent->SetChild(this);
}
// danach wird der Vaterknoten zurueckgesetzt
- (*(*aParent))[nParentNodePos].SetChild();
- (*aParent)->SetModified(TRUE);
+ (*aParent)[nParentNodePos].SetChild();
+ aParent->SetModified(TRUE);
- if((*aParent)->IsRoot() && (*aParent)->Count() == 1)
+ if(aParent->IsRoot() && aParent->Count() == 1)
{
- (*(*aParent)).SetChild();
- (*aParent)->ReleaseFull();
- (*aParent) = NULL;
+ (*aParent).SetChild();
+ aParent->ReleaseFull();
+ aParent = NULL;
rIndex.SetRootPos(nPagePos);
rIndex.m_aRoot = this;
SetModified(TRUE);
@@ -784,7 +774,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
// Austauschen des KnotenWertes
// beim Append wird der Bereich erweitert, beim INsert verweist der alte Knoten von xPage auf this
// deshalb mu der Knoten auch hier aktualisiert werden
- (*aParent)->SearchAndReplace((*(*aParent))[nParentNodePos-1].GetKey(),(*(*aParent))[nParentNodePos].GetKey());
+ aParent->SearchAndReplace((*aParent)[nParentNodePos-1].GetKey(),(*aParent)[nParentNodePos].GetKey());
xPage->SetModified(FALSE);
xPage->ReleaseFull();
@@ -796,28 +786,28 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage)
{
while (nCount < nMaxNodes_2)
{
- (*(*aParent))[nParentNodePos].SetChild(xPage->GetChild(),(*aParent).getBodyPtr());
- Append((*(*aParent))[nParentNodePos]);
- (*(*aParent))[nParentNodePos] = (*xPage)[0];
+ (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent);
+ Append((*aParent)[nParentNodePos]);
+ (*aParent)[nParentNodePos] = (*xPage)[0];
xPage->Remove(0);
}
- xPage->SetChild((*(*aParent))[nParentNodePos].GetChild());
- (*(*aParent))[nParentNodePos].SetChild(xPage,(*aParent).getBodyPtr());
+ xPage->SetChild((*aParent)[nParentNodePos].GetChild());
+ (*aParent)[nParentNodePos].SetChild(xPage,aParent);
}
else
{
while (nCount < nMaxNodes_2)
{
- (*(*aParent))[nParentNodePos].SetChild(GetChild(),(*aParent).getBodyPtr());
- Insert(0,(*(*aParent))[nParentNodePos]);
- (*(*aParent))[nParentNodePos] = (*xPage)[xPage->Count()-1];
+ (*aParent)[nParentNodePos].SetChild(GetChild(),aParent);
+ Insert(0,(*aParent)[nParentNodePos]);
+ (*aParent)[nParentNodePos] = (*xPage)[xPage->Count()-1];
xPage->Remove(xPage->Count()-1);
}
- SetChild((*(*aParent))[nParentNodePos].GetChild());
- (*(*aParent))[nParentNodePos].SetChild(this,(*aParent).getBodyPtr());
+ SetChild((*aParent)[nParentNodePos].GetChild());
+ (*aParent)[nParentNodePos].SetChild(this,aParent);
}
- (*aParent)->SetModified(TRUE);
+ aParent->SetModified(TRUE);
}
}
}
@@ -832,7 +822,7 @@ BOOL ONDXPage::IsFull() const
void ONDXPage::PrintPage()
{
DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----",
- nPagePos, HasParent() ? (*aParent)->GetPagePos() : 0 ,nCount, (*aChild).GetPagePos());
+ nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos());
for (USHORT i = 0; i < nCount; i++)
{
@@ -874,7 +864,7 @@ static UINT32 nValue;
SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
{
rStream.Seek(rPage.GetPagePos() * 512);
- rStream >> nValue >> (*rPage.aChild);
+ rStream >> nValue >> rPage.aChild;
rPage.nCount = USHORT(nValue);
// DBG_ASSERT(rPage.nCount && rPage.nCount < rPage.GetIndex().GetMaxNodes(), "Falscher Count");
@@ -887,15 +877,37 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage)
{
// Seite existiert noch nicht
- if ((rPage.GetPagePos() + 1) * 512 > rStream.Seek(STREAM_SEEK_TO_END))
- rStream.SetStreamSize((rPage.GetPagePos() + 1) * 512);
- rStream.Seek(rPage.GetPagePos() * 512);
+ ULONG nSize = (rPage.GetPagePos() + 1) * 512;
+ if (nSize > rStream.Seek(STREAM_SEEK_TO_END))
+ {
+ rStream.SetStreamSize(nSize);
+ rStream.Seek(rPage.GetPagePos() * 512);
+
+ char aEmptyData[512];
+ memset(aEmptyData,0x00,512);
+ rStream.Write((BYTE*)aEmptyData,512);
+ }
+ ULONG nCurrentPos = rStream.Seek(rPage.GetPagePos() * 512);
nValue = rPage.nCount;
- rStream << nValue << (*rPage.aChild);
+ rStream << nValue << rPage.aChild;
- for (USHORT i = 0; i < rPage.nCount; i++)
+ USHORT i = 0;
+ for (; i < rPage.nCount; i++)
rPage[i].Write(rStream, rPage);
+
+ // check if we have to fill the stream with '\0'
+ if(i < rPage.rIndex.getHeader().db_maxkeys)
+ {
+ ULONG nTell = rStream.Tell() % 512;
+ USHORT nBufferSize = rStream.GetBufferSize();
+ ULONG nSize = nBufferSize - nTell;
+ char* pEmptyData = new char[nSize];
+ memset(pEmptyData,0x00,nSize);
+ rStream.Write((BYTE*)pEmptyData,nSize);
+ rStream.Seek(nTell);
+ delete pEmptyData;
+ }
return rStream;
}
@@ -906,7 +918,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
//------------------------------------------------------------------
void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
{
- rStream >> aKey.nRecord; // schluessel
+ rStream >> (sal_uInt32)aKey.nRecord; // schluessel
if (rIndex.getHeader().db_keytype)
{
double aDbl;
@@ -940,7 +952,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
{
const ODbaseIndex& rIndex = rPage.GetIndex();
if (!rIndex.isUnique() || rPage.IsLeaf())
- rStream << aKey.nRecord; // schluessel
+ rStream << (sal_uInt32)aKey.nRecord; // schluessel
else
rStream << (sal_uInt32)0; // schluessel
@@ -1037,5 +1049,59 @@ const ORowSetValue& ONDXKey::getValue() const
return xValue;
}
// -----------------------------------------------------------------------------
+//namespace connectivity
+//{
+// namespace dbase
+// {
+// SV_IMPL_REF(ONDXPage);
+// }
+//}
+//==================================================================
+// ONDXPagePtr
+//==================================================================
+//------------------------------------------------------------------
+SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPagePtr& rPage)
+{
+ rStream >> rPage.nPagePos;
+ return rStream;
+}
+
+//------------------------------------------------------------------
+SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPagePtr& rPage)
+{
+ rStream << rPage.nPagePos;
+ return rStream;
+}
+//------------------------------------------------------------------
+ONDXPagePtr::ONDXPagePtr(const ONDXPagePtr& rRef)
+ :ONDXPageRef(rRef)
+ ,nPagePos(rRef.nPagePos)
+{
+}
+
+//------------------------------------------------------------------
+ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage)
+ :ONDXPageRef(pRefPage)
+ ,nPagePos(0)
+{
+ if (pRefPage)
+ nPagePos = pRefPage->GetPagePos();
+}
+//------------------------------------------------------------------
+ONDXPagePtr& ONDXPagePtr::operator=(const ONDXPagePtr& rRef)
+{
+ ONDXPageRef::operator=(rRef);
+ nPagePos = rRef.nPagePos;
+ return *this;
+}
+
+//------------------------------------------------------------------
+ONDXPagePtr& ONDXPagePtr::operator= (ONDXPage* pRef)
+{
+ ONDXPageRef::operator=(pRef);
+ nPagePos = (pRef) ? pRef->GetPagePos() : 0;
+ return *this;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index a4877e4d198f..9fdd0e26ab23 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.48 $
+ * $Revision: 1.49 $
*
- * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:26:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -422,11 +422,11 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
sal_Int32 nPos = (sal_Int32)(*m_aRow)[0];
::std::map<sal_Int32,sal_Int32>::const_iterator aFind = m_aBookmarkToPos.find(nPos);
OSL_ENSURE(aFind != m_aBookmarkToPos.end(),"OResultSet::getRow() invalid bookmark!");
- sal_Int32 nRowPos = 1;
- ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aBookmarkToPos.begin();
- for(;aIter != aFind;++aIter,++nRowPos)
- ;
- return nRowPos;
+ return aFind->second;
+// ::std::map<sal_Int32,sal_Int32>::const_iterator aIter = m_aBookmarkToPos.begin();
+// for(;aIter != aFind;++aIter,++nRowPos)
+// ;
+// return nRowPos;
}
// -------------------------------------------------------------------------
@@ -1216,10 +1216,6 @@ again:
!m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen
{ // naechsten Satz auswerten
// aktuelle Zeile loeschen im Keyset
- OSL_ENSURE(!m_pFileSet ||
- // !m_pFileSet->IsFrozen() ||
- eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!");
-
if (m_pEvaluationKeySet)
{
++m_aEvaluateIter;
@@ -1334,7 +1330,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
ExecuteRow(eCursorPosition,nOffset,TRUE,FALSE,bRetrieveData);
// now set the bookmark for outside
- (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1);
+ // (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1);
}
else
{
@@ -1382,7 +1378,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B
ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_pFileSet)[m_nRowPos],TRUE,FALSE,bRetrieveData);
// now set the bookmark for outside
- (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1);
+ // (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1);
}
else // Index mu weiter aufgebaut werden
{
@@ -1565,6 +1561,8 @@ BOOL OResultSet::SkipDeleted(OFileTable::FilePosition eCursorPosition, INT32 nOf
if(m_aBookmarkToPos.empty())
{
bDataFound = Move(OFileTable::FILE_FIRST, 1, bRetrieveData);
+ if(bDataFound && !m_aRow->isDeleted())
+ m_aBookmarkToPos[(sal_Int32)(*m_aRow)[0]] = nCurPos;
}
else
{
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
index dc82271c06bd..71fc7d90ef46 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fanalyzer.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: oj $ $Date: 2001-05-07 10:37:52 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:26:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -193,13 +193,12 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode1));
}
- pAttr->bindValue(_pRow);
-
if (pEvaluateSet)
{
aEvaluateSetList.push_back(pEvaluateSet);
pEvaluateSet = NULL;
}
+ pAttr->bindValue(_pRow);
}
}
@@ -260,13 +259,14 @@ void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns)
// Anlegen von Columns, die eine genauere Beschreibung fr die enthalten
::vos::ORef<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns);
- // Anlegen einer Testzeile, wird bentigt um die Parameter zu beschreiben
- OValueRow aTestRow = new OValueVector(Reference< XIndexAccess>(m_aCompiler.getOrigColumns(),UNO_QUERY)->getCount());
- bindResultRow(aTestRow); // Binden der Attribute an die Values
+ // Anlegen einer Testzeile, wird bentigt um die Parameter zu beschreiben
OValueRow aParameterRow = new OValueVector(rParameterColumns->size());
bindParameterRow(aParameterRow);
+ OValueRow aTestRow = new OValueVector(Reference< XIndexAccess>(m_aCompiler.getOrigColumns(),UNO_QUERY)->getCount());
+ delete bindResultRow(aTestRow); // Binden der Attribute an die Values
+
for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
{
OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx
index 17061b5d7353..8ca152641a6e 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndex.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-04-30 10:09:03 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -132,7 +132,6 @@ namespace connectivity
ODbaseTable* m_pTable;
BOOL m_bUseCollector : 1; // Verwenden des GarbageCollectors
- sal_Bool m_bUnique;
::rtl::OUString getCompletePath();
void closeImpl();
@@ -183,7 +182,7 @@ namespace connectivity
void Collect(ONDXPage*);
ONDXPagePtr getRoot();
- sal_Bool isUnique() const { return m_bUnique; }
+ sal_Bool isUnique() const { return m_IsUnique; }
BOOL UseCollector() const {return m_bUseCollector;}
// Tree operationen
void Insert(ONDXPagePtr aCurPage, ONDXNode& rNode);
diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx
index 9201ca7636af..17527f480d0b 100644
--- a/connectivity/source/inc/dbase/dindexnode.hxx
+++ b/connectivity/source/inc/dbase/dindexnode.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dindexnode.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2001-05-07 12:23:42 $
+ * last change: $Author: oj $ $Date: 2001-05-08 13:23:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,9 @@
#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
#include "FValue.hxx"
#endif
+#ifndef _REF_HXX
+#include <tools/ref.hxx>
+#endif
namespace connectivity
{
@@ -126,11 +129,36 @@ namespace connectivity
#define NODE_NOTFOUND 0xFFFF
- class ONDXPagePtr;
+
+ //==================================================================
+ // Index Seitenverweis
+ //==================================================================
+ SV_DECL_REF(ONDXPage); // Basisklasse da weitere Informationen gehalten werden muessen
+
+
+ class ONDXPagePtr : public ONDXPageRef
+ {
+ friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&);
+ friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&);
+
+ UINT32 nPagePos; // Position in der Indexdatei
+
+ public:
+ ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){}
+ ONDXPagePtr(const ONDXPagePtr& rRef);
+ ONDXPagePtr(ONDXPage* pRefPage);
+
+ ONDXPagePtr& operator=(const ONDXPagePtr& rRef);
+ ONDXPagePtr& operator=(ONDXPage* pPageRef);
+
+ UINT32 GetPagePos() const {return nPagePos;}
+ BOOL HasPage() const {return nPagePos != 0;}
+ // sal_Bool Is() const { return isValid(); }
+ };
//==================================================================
// Index Seite
//==================================================================
- class ONDXPage //: public SvRefBase
+ class ONDXPage : public SvRefBase
{
friend class ODbaseIndex;
@@ -141,20 +169,12 @@ namespace connectivity
BOOL bModified : 1;
USHORT nCount;
- ONDXPagePtr *aParent, // VaterSeite
- *aChild; // Zeiger auf rechte ChildPage
+ ONDXPagePtr aParent, // VaterSeite
+ aChild; // Zeiger auf rechte ChildPage
ODbaseIndex& rIndex;
ONDXNode* ppNodes; // array von Knoten
- oslInterlockedCount m_refCount;
-
public:
- void acquire()
- {
- osl_incrementInterlockedCount( &m_refCount );
- }
- void release();
-
// Knoten Operationen
USHORT Count() const {return nCount;}
@@ -215,54 +235,28 @@ namespace connectivity
#endif
};
- //==================================================================
- // Index Seitenverweis
- //==================================================================
- // SV_DECL_REF(ONDXPage); // Basisklasse da weitere Informationen gehalten werden muessen
- typedef vos::ORef<ONDXPage> ONDXPagePtr_BASE;
-
- class ONDXPagePtr : public ONDXPagePtr_BASE //ONDXPageRef
- {
- friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&);
- friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&);
-
- UINT32 nPagePos; // Position in der Indexdatei
-
- public:
- ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){}
- ONDXPagePtr(const ONDXPagePtr& rRef);
- ONDXPagePtr(ONDXPage* pRefPage);
-
- ONDXPagePtr& operator=(const ONDXPagePtr& rRef);
- ONDXPagePtr& operator=(ONDXPage* pPageRef);
-
- UINT32 GetPagePos() const {return nPagePos;}
- BOOL HasPage() const {return nPagePos != 0;}
- sal_Bool Is() const { return isValid(); }
- void Clear()
- {
- unbind();
- }
- };
+ SV_IMPL_REF(ONDXPage);
SvStream& operator << (SvStream &rStream, const ONDXPagePtr&);
SvStream& operator >> (SvStream &rStream, ONDXPagePtr&);
- inline BOOL ONDXPage::IsRoot() const {return !aParent->Is();}
- inline BOOL ONDXPage::IsLeaf() const {return !aChild->HasPage();}
+ inline BOOL ONDXPage::IsRoot() const {return !aParent.Is();}
+ inline BOOL ONDXPage::IsLeaf() const {return !aChild.HasPage();}
inline BOOL ONDXPage::IsModified() const {return bModified;}
- inline BOOL ONDXPage::HasParent() {return aParent->Is();}
- inline BOOL ONDXPage::HasChild() const {return aChild->HasPage();}
- inline ONDXPagePtr ONDXPage::GetParent() {return *aParent;}
+ inline BOOL ONDXPage::HasParent() {return aParent.Is();}
+ inline BOOL ONDXPage::HasChild() const {return aChild.HasPage();}
+ inline ONDXPagePtr ONDXPage::GetParent() {return aParent;}
inline void ONDXPage::SetParent(ONDXPagePtr aPa = ONDXPagePtr())
- { *aParent = aPa;}
+ {
+ aParent = aPa;
+ }
inline void ONDXPage::SetChild(ONDXPagePtr aCh = ONDXPagePtr())
{
- *aChild = aCh;
- if (aChild->Is())
- (*aChild)->SetParent(this);
+ aChild = aCh;
+ if (aChild.Is())
+ aChild->SetParent(this);
}
SvStream& operator >> (SvStream &rStream, ONDXPage& rPage);
SvStream& operator << (SvStream &rStream, const ONDXPage& rPage);