From 38ac913facdec2a71462604eb71ca8c88efee43e Mon Sep 17 00:00:00 2001 From: Rob Snelders Date: Mon, 14 Feb 2011 22:54:01 +0100 Subject: translated comments (10-16/54) --- connectivity/source/drivers/calc/Cservices.cxx | 9 +- connectivity/source/drivers/dbase/DIndex.cxx | 54 +++--- connectivity/source/drivers/dbase/DIndexIter.cxx | 23 ++- connectivity/source/drivers/dbase/DNoException.cxx | 31 ++-- connectivity/source/drivers/dbase/DTable.cxx | 185 ++++++++++---------- connectivity/source/drivers/dbase/Dservices.cxx | 9 +- connectivity/source/drivers/dbase/dindexnode.cxx | 191 ++++++++++----------- 7 files changed, 237 insertions(+), 265 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/calc/Cservices.cxx b/connectivity/source/drivers/calc/Cservices.cxx index 8dd5a5a9029e..97936db1a376 100644 --- a/connectivity/source/drivers/calc/Cservices.cxx +++ b/connectivity/source/drivers/calc/Cservices.cxx @@ -50,11 +50,8 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) ); //*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - +// The prescribed C-Api must be met! +// It consists of three functions, which must be exported by the module. //--------------------------------------------------------------------------------------- void REGISTER_PROVIDER( const OUString& aServiceImplName, @@ -73,7 +70,6 @@ void REGISTER_PROVIDER( xNewKey->createKey(Services[i]); } - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +109,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 20f079369ff2..8a3c319c7ed9 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -189,8 +189,8 @@ OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp, BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue) { OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Sucht ein bestimmten Wert im Index - // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + // Search a specific value in Index + // If the Index is unique, the key doesn't matter try { if (m_aHeader.db_keytype == 0) @@ -218,8 +218,8 @@ BOOL ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Sucht ein bestimmten Wert im Index - // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + // Search a specific value in Index + // If the Index is unique, the key doesn't matter ONDXKey aKey; return ConvertToKey(&aKey, nRec, rValue) && getRoot()->Find(aKey); } @@ -231,14 +231,14 @@ BOOL ODbaseIndex::Insert(sal_uInt32 nRec, const ORowSetValue& rValue) OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); ONDXKey aKey; - // Existiert der Wert bereits - // Find immer verwenden um das aktuelle Blatt zu bestimmen + // Does the value already exist + // Use Find() always to determine the actual leaf if (!ConvertToKey(&aKey, nRec, rValue) || (getRoot()->Find(aKey) && isUnique())) return FALSE; ONDXNode aNewNode(aKey); - // einfuegen in das aktuelle Blatt + // insert in the current leaf if (!m_aCurLeaf.Is()) return FALSE; @@ -266,15 +266,15 @@ BOOL ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Existiert der Wert bereits - // Find immer verwenden um das aktuelle Blatt zu bestimmen + // Does the value already exist + // Always use Find() to determine the actual leaf ONDXKey aKey; if (!ConvertToKey(&aKey, nRec, rValue) || !getRoot()->Find(aKey)) return FALSE; ONDXNode aNewNode(aKey); - // einfuegen in das aktuelle Blatt + // insert in the current leaf if (!m_aCurLeaf.Is()) return FALSE; #if OSL_DEBUG_LEVEL > 1 @@ -292,7 +292,7 @@ void ODbaseIndex::Collect(ONDXPage* pPage) //------------------------------------------------------------------ void ODbaseIndex::Release(BOOL bSave) { - // Freigeben der Indexressourcen + // Release the Index-recources m_bUseCollector = FALSE; if (m_aCurLeaf.Is()) @@ -301,19 +301,19 @@ void ODbaseIndex::Release(BOOL bSave) m_aCurLeaf.Clear(); } - // Wurzel freigeben + // Release the root if (m_aRoot.Is()) { m_aRoot->Release(bSave); m_aRoot.Clear(); } - // alle Referenzen freigeben, bevor der FileStream geschlossen wird + // Release all references, before the FileStream will be closed for (ULONG i = 0; i < m_aCollector.size(); i++) m_aCollector[i]->QueryDelete(); m_aCollector.clear(); - // Header modifiziert ? + // Header modified? if (bSave && (m_aHeader.db_rootpage != m_nRootPage || m_aHeader.db_pagecount != m_nPageCount)) { @@ -386,7 +386,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rInd //------------------------------------------------------------------ void ODbaseIndex::createINFEntry() { - // inf Datei abgleichen + // synchronize inf-file String sEntry = m_Name; sEntry += String::CreateFromAscii(".ndx"); @@ -432,8 +432,7 @@ BOOL ODbaseIndex::DropImpl() m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_DELETE_INDEX,*m_pTable); } - // InfDatei abgleichen - + // synchronize inf-file ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL()); sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sCfgFile += m_pTable->getName(); @@ -453,7 +452,7 @@ BOOL ODbaseIndex::DropImpl() // delete entries from the inf file for (USHORT nKey = 0; nKey < nKeyCnt; nKey++) { - // Verweist der Key auf ein Indexfile?... + // References the Key to an Index-file? aKeyName = aInfFile.GetKeyName( nKey ); if (aKeyName.Copy(0,3) == "NDX") { @@ -477,7 +476,7 @@ void ODbaseIndex::impl_killFileAndthrowError_throw(sal_uInt16 _nErrorId,const :: //------------------------------------------------------------------ BOOL ODbaseIndex::CreateImpl() { - // Anlegen des Index + // Create the Index const ::rtl::OUString sFile = getCompletePath(); if(UCBContentHelper::Exists(sFile)) { @@ -487,13 +486,13 @@ BOOL ODbaseIndex::CreateImpl() ) ); ::dbtools::throwGenericSQLException( sError, *this ); } - // Index ist nur einstufig + // Index comprises only one column if (m_pColumns->getCount() > 1) m_pTable->getConnection()->throwGenericSQLException(STR_ONL_ONE_COLUMN_PER_INDEX,*this); Reference xCol(m_pColumns->getByIndex(0),UNO_QUERY); - // ist die Spalte schon indiziert ? + // Is the column already indexed? if ( !xCol.is() ) ::dbtools::throwFunctionSequenceException(*this); @@ -512,7 +511,7 @@ BOOL ODbaseIndex::CreateImpl() m_pFileStream->SetBufferSize(PAGE_SIZE); m_pFileStream->SetFiller('\0'); - // Zunaechst muss das Ergebnis sortiert sein + // firstly the result must be sorted utl::SharedUNOComponent xStmt; utl::SharedUNOComponent xSet; String aName; @@ -548,7 +547,7 @@ BOOL ODbaseIndex::CreateImpl() impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX,sFile); } - // Setzen der Headerinfo + // Set the header info memset(&m_aHeader,0,sizeof(m_aHeader)); sal_Int32 nType = 0; ::rtl::Reference aCols = m_pTable->getTableColumns(); @@ -572,9 +571,8 @@ BOOL ODbaseIndex::CreateImpl() m_aHeader.db_unique = m_IsUnique ? 1: 0; m_aHeader.db_keyrec = m_aHeader.db_keylen + 8; - // modifizierung am Header werden ueber Unterschiede zw. HeaderInfo und nRootPage - // bzw. nPageCout erkannt - + // modifications of the header are detected by differences between + // the HeaderInfo and nRootPage or nPageCount respectively m_nRootPage = 1; m_nPageCount = 2; @@ -600,11 +598,11 @@ BOOL ODbaseIndex::CreateImpl() ORowSetValue atmpValue=ORowSetValue(); ONDXKey aKey(atmpValue, nType, 0); ONDXKey aInsertKey(atmpValue, nType, 0); - // Erzeugen der Indexstruktur + // Create the index structure while (xSet->next()) { ORowSetValue aValue(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1))); - // ueberpruefen auf doppelten eintrag + // checking for duplicate entries if (m_IsUnique && m_nCurNode != NODE_NOTFOUND) { aKey.setValue(aValue); diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx index 83297aa4fca5..f1335c7c0531 100644 --- a/connectivity/source/drivers/dbase/DIndexIter.cxx +++ b/connectivity/source/drivers/dbase/DIndexIter.cxx @@ -69,7 +69,7 @@ ULONG OIndexIterator::Find(BOOL bFirst) if (!m_pOperator) { - // Vorbereitung , auf kleinstes Element positionieren + // Preparation, position on the smallest element if (bFirst) { ONDXPage* pPage = m_aRoot; @@ -97,18 +97,17 @@ ULONG OIndexIterator::Find(BOOL bFirst) //------------------------------------------------------------------ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) { - // sucht den vorgegeben key - // Besonderheit: gelangt der Algorithmus ans Ende - // wird immer die aktuelle Seite und die Knotenposition vermerkt - // auf die die Bedingung <= zutrifft - // dieses findet beim Insert besondere Beachtung + // searches a given key + // Speciality: At the end of the algorithm + // the actual page and the position of the node which fulfil the + // '<='-condition are saved. this is considered for inserts. // ONDXIndex* m_pIndex = GetNDXIndex(); OOp_COMPARE aTempOp(SQLFilterOperator::GREATER); USHORT i = 0; if (pPage->IsLeaf()) { - // im blatt wird die eigentliche Operation ausgefuehrt, sonst die temp. (>) + // in the leaf the actual operation is run, otherwise temp. (>) while (i < pPage->Count() && !m_pOperator->operate(&((*pPage)[i]).GetKey(),&rKey)) i++; } @@ -120,7 +119,7 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) ONDXKey* pFoundKey = NULL; if (!pPage->IsLeaf()) { - // weiter absteigen + // descend further ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex) : ((*pPage)[i-1]).GetChild(m_pIndex, pPage); pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : NULL; @@ -149,7 +148,7 @@ ULONG OIndexIterator::GetCompare(BOOL bFirst) if (bFirst) { - // Vorbereitung , auf kleinstes Element positionieren + // Preparation, position on the smallest element ONDXPage* pPage = m_aRoot; switch (ePredicateType) { @@ -278,7 +277,7 @@ ONDXKey* OIndexIterator::GetNextKey() if (m_aCurLeaf.Is() && ((++m_nCurNode) >= m_aCurLeaf->Count())) { ONDXPage* pPage = m_aCurLeaf; - // naechste Seite suchen + // search next page while (pPage) { ONDXPage* pParentPage = pPage->GetParent(); @@ -286,7 +285,7 @@ ONDXKey* OIndexIterator::GetNextKey() { USHORT nPos = pParentPage->Search(pPage); if (nPos != pParentPage->Count() - 1) - { // Seite gefunden + { // page found pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage); break; } @@ -294,7 +293,7 @@ ONDXKey* OIndexIterator::GetNextKey() pPage = pParentPage; } - // jetzt wieder zum Blatt + // now go on with leaf while (pPage && !pPage->IsLeaf()) pPage = pPage->GetChild(m_pIndex); diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx index 165fe5be3b6a..8e1058b6e7a8 100644 --- a/connectivity/source/drivers/dbase/DNoException.cxx +++ b/connectivity/source/drivers/dbase/DNoException.cxx @@ -47,7 +47,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- - // Positionierung vorbereiten: + // Prepare positioning: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; @@ -118,7 +118,7 @@ Error: m_nFilePos = 0; break; case IResultSetHelper::BOOKMARK: - m_nFilePos = nTempPos; // vorherige Position + m_nFilePos = nTempPos; // last position } return sal_False; @@ -135,12 +135,12 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size); switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofeld, ends with Ctrl-Z { const char cEOF = (char) 0x1a; ByteString aBStr; static char aBuf[514]; - aBuf[512] = 0; // sonst kann der Zufall uebel mitspielen + aBuf[512] = 0; // to prevent a random value BOOL bReady = sal_False; do @@ -162,7 +162,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofeld with the length specification { char sHeader[4]; m_pMemoStream->Read(sHeader,4); @@ -224,7 +224,7 @@ void ODbaseTable::AllocBuffer() m_pBuffer = NULL; } - // Falls noch kein Puffer vorhanden: allozieren: + // If no buffer available: allocate if (m_pBuffer == NULL && nSize) { m_nBufferSize = nSize; @@ -237,7 +237,7 @@ BOOL ODbaseTable::WriteBuffer() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); - // Auf gewuenschten Record positionieren: + // Position on the desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; @@ -257,7 +257,7 @@ sal_Int32 ODbaseTable::getCurrentLastPos() const void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Read" ); - rStream >> aKey.nRecord; // schluessel + rStream >> aKey.nRecord; // key if (rIndex.getHeader().db_keytype) { @@ -292,9 +292,9 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Write" ); const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) - rStream << (sal_uInt32)aKey.nRecord; // schluessel + rStream << (sal_uInt32)aKey.nRecord; // key else - rStream << (sal_uInt32)0; // schluessel + rStream << (sal_uInt32)0; // key if (rIndex.getHeader().db_keytype) // double { @@ -373,7 +373,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; } - // Record vergleich, wenn Index !Unique + // Record comparison, if index !Unique if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; @@ -457,7 +457,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) //------------------------------------------------------------------ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) { - // Seite existiert noch nicht + // Page does not yet exist ULONG nSize = (rPage.GetPagePos() + 1) * 512; if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) { @@ -547,7 +547,7 @@ BOOL ONDXPage::IsFull() const USHORT ONDXPage::Search(const ONDXKey& rSearch) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" ); - // binare Suche spaeter + // binary search afterwards USHORT i = 0xFFFF; while (++i < Count()) if ((*this)[i].GetKey() == rSearch) @@ -565,12 +565,11 @@ USHORT ONDXPage::Search(const ONDXPage* pPage) if (((*this)[i]).GetChild() == pPage) break; - // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst - // auf die Page zeigt + // if not found, then we assume, that the page points to the page (???) return (i < Count()) ? i : NODE_NOTFOUND; } // ----------------------------------------------------------------------------- -// laeuft rekursiv +// runs recursively void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 327f00bf9c9d..c45224c3cb83 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -205,7 +205,7 @@ void ODbaseTable::readHeader() OSL_ENSURE(m_pFileStream,"No Stream available!"); if(!m_pFileStream) return; - m_pFileStream->RefreshBuffer(); // sicherstellen, dass die Kopfinformationen tatsaechlich neu gelesen werden + m_pFileStream->RefreshBuffer(); // Make sure, that the header information actually is read again m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); BYTE nType=0; @@ -229,14 +229,14 @@ void ODbaseTable::readHeader() if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); - if ( ( ( m_aHeader.db_kopf - 1 ) / 32 - 1 ) <= 0 ) // anzahl felder + if ( ( ( m_aHeader.db_kopf - 1 ) / 32 - 1 ) <= 0 ) // number of fields { // no dbase file throwInvalidDbaseFormat(); } else { - // Konsistenzpruefung des Header: + // Consistency check of the header: m_aHeader.db_typ = (DBFType)nType; switch (m_aHeader.db_typ) { @@ -306,7 +306,7 @@ void ODbaseTable::fillColumns() m_aPrecisions.clear(); m_aScales.clear(); - // Anzahl Felder: + // Number of fields: const sal_Int32 nFieldCount = (m_aHeader.db_kopf - 1) / 32 - 1; OSL_ENSURE(nFieldCount,"No columns in table!"); @@ -357,10 +357,10 @@ OSL_TRACE("column type: %c",aDBFColumn.db_typ); aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC")); eType = DataType::DECIMAL; - // Bei numerischen Feldern werden zwei Zeichen mehr geschrieben, als die Precision der Spaltenbeschreibung eigentlich - // angibt, um Platz fuer das eventuelle Vorzeichen und das Komma zu haben. Das muss ich jetzt aber wieder rausrechnen. + // for numeric fields two characters more are written, than the precision of the column description predescribes, + // to keep room for the possible sign and the comma. This has to be considered... nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez); - // leider gilt das eben Gesagte nicht fuer aeltere Versionen .... + // This is not true for older versions .... break; case 'L': eType = DataType::BIT; @@ -506,17 +506,17 @@ void ODbaseTable::construct() readHeader(); if (HasMemoFields()) { - // Memo-Dateinamen bilden (.DBT): - // nyi: Unschoen fuer Unix und Mac! + // Create Memo-Filename (.DBT): + // nyi: Ugly for Unix and Mac! if ( m_aHeader.db_typ == FoxProMemo || VisualFoxPro == m_aHeader.db_typ || VisualFoxProAuto == m_aHeader.db_typ ) // foxpro uses another extension aURL.SetExtension(String::CreateFromAscii("fpt")); else aURL.SetExtension(String::CreateFromAscii("dbt")); - // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt - // allerdings koennen keine Updates durchgefuehrt werden - // jedoch die Operation wird ausgefuehrt + // If the memo file isn't found, the data will be displayed anyhow. + // However, updates can't be done + // but the operation is executed m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); if ( !m_pMemoStream ) { @@ -533,19 +533,19 @@ void ODbaseTable::construct() if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng); - // Buffersize abhaengig von der Filegroesse + // Buffersize dependent on the file size m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 : nFileSize > 100000 ? 16384 : nFileSize > 10000 ? 4096 : 1024); if (m_pMemoStream) { - // Puffer genau auf Laenge eines Satzes stellen + // set the buffer extactly to the length of a record m_pMemoStream->Seek(STREAM_SEEK_TO_END); nFileSize = m_pMemoStream->Tell(); m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN); - // Buffersize abhaengig von der Filegroesse + // Buffersize dependent on the file size m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 : nFileSize > 100000 ? 16384 : nFileSize > 10000 ? 4096 : @@ -560,23 +560,22 @@ BOOL ODbaseTable::ReadMemoHeader() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemoHeader" ); m_pMemoStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); - m_pMemoStream->RefreshBuffer(); // sicherstellen das die Kopfinformationen tatsaechlich neu gelesen werden + m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again m_pMemoStream->Seek(0L); (*m_pMemoStream) >> m_aMemoHeader.db_next; switch (m_aHeader.db_typ) { - case dBaseIIIMemo: // dBase III: feste Blockgroesse + case dBaseIIIMemo: // dBase III: fixed block size case dBaseIVMemo: - // manchmal wird aber auch dBase3 dBase4 Memo zugeordnet + // sometimes dBase3 is attached to dBase4 memo m_pMemoStream->Seek(20L); (*m_pMemoStream) >> m_aMemoHeader.db_size; - if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 steht auch fuer dBase 3 + if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 is also for dBase 3 m_aMemoHeader.db_typ = MemodBaseIV; else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512) { - // nun gibt es noch manche Dateien, die verwenden eine Groessenangabe, - // sind aber dennoch dBase Dateien + // There are files using size specification, though they are dBase-files char sHeader[4]; m_pMemoStream->Seek(m_aMemoHeader.db_size); m_pMemoStream->Read(sHeader,4); @@ -686,9 +685,9 @@ void ODbaseTable::refreshIndexes() for (USHORT nKey = 0; nKey < nKeyCnt; nKey++) { - // Verweist der Key auf ein Indexfile?... + // Refences the key an index-file? aKeyName = aInfFile.GetKeyName( nKey ); - //...wenn ja, Indexliste der Tabelle hinzufuegen + //...if yes, add the index list of the table if (aKeyName.Copy(0,3) == ByteString("NDX") ) { aIndexName = aInfFile.ReadKey(aKeyName); @@ -786,12 +785,12 @@ sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (R sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fetchRow" ); - // Einlesen der Daten + // Read the data BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : sal_False; // only read the bookmark - // Satz als geloescht markieren + // Mark record as deleted _rRow->setDeleted(bIsCurRecordDeleted); *(_rRow->get())[0] = m_nFilePos; @@ -799,13 +798,13 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s return TRUE; sal_Size nByteOffset = 1; - // Felder: + // Fields: OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); const sal_Size nCount = _rRow->get().size(); for (sal_Size i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++) { - // Laengen je nach Datentyp: + // Lengths depending on data type: sal_Int32 nLen = 0; sal_Int32 nType = 0; if(_bUseTableDefs) @@ -834,7 +833,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i-1]); else nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - break; // das Vorzeichen und das Komma + break; // the sign and the comma case DataType::BINARY: case DataType::OTHER: @@ -842,10 +841,10 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s continue; } - // Ist die Variable ueberhaupt gebunden? + // Is the variable bound? if ( !(_rRow->get())[i]->isBound() ) { - // Nein - naechstes Feld. + // No - next field. nByteOffset += nLen; OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!"); continue; @@ -900,7 +899,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s else if ( DataType::DOUBLE == nType ) { double d = 0.0; - if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately { sal_Int64 nValue = 0; memcpy(&nValue, pData, nLen); @@ -920,7 +919,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s else { sal_Int32 nPos1 = -1, nPos2 = -1; - // Falls Nul-Zeichen im String enthalten sind, in Blanks umwandeln! + // If the string contains Nul-characters, then convert them to blanks! for (sal_Int32 k = 0; k < nLen; k++) { if (pData[k] == '\0') @@ -941,7 +940,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s { // Empty string. Skip it. nByteOffset += nLen; - (_rRow->get())[i]->setNull(); // keine Werte -> fertig + (_rRow->get())[i]->setNull(); // no values -> done continue; } @@ -984,8 +983,8 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s case DataType::BINARY: case DataType::LONGVARCHAR: { - const long nBlockNo = aStr.toInt32(); // Blocknummer lesen - if (nBlockNo > 0 && m_pMemoStream) // Daten aus Memo-Datei lesen, nur wenn + const long nBlockNo = aStr.toInt32(); // read blocknumber + if (nBlockNo > 0 && m_pMemoStream) // Read data from memo-file, only if { if ( !ReadMemo(nBlockNo, (_rRow->get())[i]->get()) ) break; @@ -1010,7 +1009,7 @@ void ODbaseTable::FileClose() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::FileClose" ); ::osl::MutexGuard aGuard(m_aMutex); - // falls noch nicht alles geschrieben wurde + // if not everything has been written yet if (m_pMemoStream && m_pMemoStream->IsWritable()) m_pMemoStream->Flush(); @@ -1055,7 +1054,7 @@ BOOL ODbaseTable::CreateImpl() Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference()); if (aContent.isDocument()) { - // Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler + // Only if the file exists with length > 0 raise an error SvStream* pFileStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE),STREAM_READ); if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END)) @@ -1154,12 +1153,12 @@ void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl: ::dbtools::throwGenericSQLException( sError, *this ); } //------------------------------------------------------------------ -// erzeugt grundsaetzlich dBase IV Datei Format +// creates in principle dBase IV file format BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateFile" ); bCreateMemo = sal_False; - Date aDate; // aktuelles Datum + Date aDate; // current date m_pFileStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC ); @@ -1209,18 +1208,18 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) m_pFileStream->Seek(0L); (*m_pFileStream) << (BYTE) nDbaseType; // dBase format - (*m_pFileStream) << (BYTE) (aDate.GetYear() % 100); // aktuelles Datum + (*m_pFileStream) << (BYTE) (aDate.GetYear() % 100); // current date (*m_pFileStream) << (BYTE) aDate.GetMonth(); (*m_pFileStream) << (BYTE) aDate.GetDay(); - (*m_pFileStream) << 0L; // Anzahl der Datensaetze - (*m_pFileStream) << (USHORT)((m_pColumns->getCount()+1) * 32 + 1); // Kopfinformationen, - // pColumns erhaelt immer eine Spalte mehr - (*m_pFileStream) << (USHORT) 0; // Satzlaenge wird spaeter bestimmt + (*m_pFileStream) << 0L; // number of data records + (*m_pFileStream) << (USHORT)((m_pColumns->getCount()+1) * 32 + 1); // header information, + // pColumns contains always an additional column + (*m_pFileStream) << (USHORT) 0; // record length will be determined later m_pFileStream->Write(aBuffer, 20); - USHORT nRecLength = 1; // Laenge 1 fuer deleted flag + USHORT nRecLength = 1; // Length 1 for deleted flag sal_Int32 nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength(); ::rtl::OUString aName; const ::rtl::OUString sPropName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); @@ -1262,7 +1261,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) cTyp = 'C'; break; case DataType::DOUBLE: - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately cTyp = 'Y'; else cTyp = 'B'; @@ -1276,7 +1275,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) case DataType::DECIMAL: case DataType::NUMERIC: case DataType::REAL: - cTyp = 'N'; // nur dBase 3 format + cTyp = 'N'; // only dBase 3 format break; case DataType::TIMESTAMP: cTyp = 'T'; @@ -1313,9 +1312,9 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { throwInvalidColumnType(STR_INVALID_COLUMN_PRECISION, aName); } - (*m_pFileStream) << (BYTE) Min((unsigned)nPrecision, 255U); //Feldlaenge + (*m_pFileStream) << (BYTE) Min((unsigned)nPrecision, 255U); // field length nRecLength = nRecLength + (USHORT)::std::min((USHORT)nPrecision, (USHORT)255UL); - (*m_pFileStream) << (BYTE)0; //Nachkommastellen + (*m_pFileStream) << (BYTE)0; // decimals break; case 'F': case 'N': @@ -1325,9 +1324,9 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { throwInvalidColumnType(STR_INVALID_PRECISION_SCALE, aName); } - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately { - (*m_pFileStream) << (BYTE)10; // Standard Laenge + (*m_pFileStream) << (BYTE)10; // standard length (*m_pFileStream) << (BYTE)4; nRecLength += 10; } @@ -1373,10 +1372,10 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) aBuffer[0] = 0x00; } - (*m_pFileStream) << (BYTE)FIELD_DESCRIPTOR_TERMINATOR; // kopf ende + (*m_pFileStream) << (BYTE)FIELD_DESCRIPTOR_TERMINATOR; // end of header (*m_pFileStream) << (char)DBF_EOL; m_pFileStream->Seek(10L); - (*m_pFileStream) << nRecLength; // Satzlaenge nachtraeglich eintragen + (*m_pFileStream) << nRecLength; // set record length afterwards if (bCreateMemo) { @@ -1403,11 +1402,11 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) } //------------------------------------------------------------------ -// erzeugt grundsaetzlich dBase III Datei Format +// creates in principle dBase III file format BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateMemoFile" ); - // Makro zum Filehandling fuers Erzeugen von Tabellen + // filehandling macro for table creation m_pMemoStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE); if (!m_pMemoStream) @@ -1428,7 +1427,7 @@ BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) #endif m_pMemoStream->Seek(0L); - (*m_pMemoStream) << long(1); // Zeiger auf ersten freien Block + (*m_pMemoStream) << long(1); // pointer to the first free block m_pMemoStream->Flush(); delete m_pMemoStream; @@ -1471,7 +1470,6 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie aURL.setExtension(String::CreateFromAscii("inf")); // as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill - // 89711 - 16.07.2001 - frank.schoenheit@sun.com try { ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () ); @@ -1508,13 +1506,13 @@ BOOL ODbaseTable::DropImpl() BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference& _xCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::InsertRow" ); - // Buffer mit Leerzeichen fuellen + // fill buffer with blanks AllocBuffer(); memset(m_pBuffer, 0, m_aHeader.db_slng); m_pBuffer[0] = ' '; - // Gesamte neue Row uebernehmen: - // ... und am Ende als neuen Record hinzufuegen: + // Copy new row completely: + // ... and add at the end as new Record: UINT32 nTempPos = m_nFilePos; m_nFilePos = (ULONG)m_aHeader.db_anz + 1; @@ -1533,26 +1531,26 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const ReferenceSetStreamSize(nFileSize); // alte Groesse restaurieren + m_pFileStream->SetStreamSize(nFileSize); // restore old size if (HasMemoFields() && m_pMemoStream) - m_pMemoStream->SetStreamSize(nMemoFileSize); // alte Groesse restaurieren - m_nFilePos = nTempPos; // Fileposition restaurieren + m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size + m_nFilePos = nTempPos; // restore file position } else { (*m_pFileStream) << (char)DBF_EOL; // write EOL - // Anzahl Datensaetze im Header erhoehen: + // raise number of datasets in the header: m_pFileStream->Seek( 4L ); (*m_pFileStream) << (m_aHeader.db_anz + 1); - // beim AppendOnly kein Flush! + // if AppendOnly no flush! if (bFlush) m_pFileStream->Flush(); - // bei Erfolg # erhoehen + // raise number if successfully m_aHeader.db_anz++; - *rRow.get()[0] = m_nFilePos; // BOOKmark setzen + *rRow.get()[0] = m_nFilePos; // set bookmark m_nFilePos = nTempPos; } } @@ -1566,10 +1564,10 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference& _xCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateRow" ); - // Buffer mit Leerzeichen fuellen + // fill buffer with blanks AllocBuffer(); - // Auf gewuenschten Record positionieren: + // position on desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); m_pFileStream->Read((char*)m_pBuffer, m_aHeader.db_slng); @@ -1583,7 +1581,7 @@ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const R if (!UpdateBuffer(rRow, pOrgRow,_xCols) || !WriteBuffer()) { if (HasMemoFields() && m_pMemoStream) - m_pMemoStream->SetStreamSize(nMemoFileSize); // alte Groesse restaurieren + m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size } else { @@ -1596,9 +1594,8 @@ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const R BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DeleteRow" ); - // Einfach das Loesch-Flag setzen (egal, ob es schon gesetzt war - // oder nicht): - // Auf gewuenschten Record positionieren: + // Set the Delete-Flag (be it set or not): + // Position on desired record: long nFilePos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nFilePos); @@ -1690,7 +1687,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const return FALSE; sal_Int32 nByteOffset = 1; - // Felder aktualisieren: + // Update fields: Reference xCol; Reference xIndex; USHORT i; @@ -1740,7 +1737,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const if (pIndex->Find(0,*rRow.get()[nPos])) { - // es existiert kein eindeutiger Wert + // There is no unique value if ( !aColName.getLength() ) { m_pColumns->getByIndex(i) >>= xCol; @@ -1902,7 +1899,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const const double d = rRow.get()[nPos]->getValue(); m_pColumns->getByIndex(i) >>= xCol; - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately { sal_Int64 nValue = 0; if ( m_aScales[i] ) @@ -1910,7 +1907,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const else nValue = (sal_Int64)(d); memcpy(pData,&nValue,nLen); - } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately else memcpy(pData,&d,nLen); } @@ -2018,7 +2015,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteMemo" ); - // wird die BlockNr 0 vorgegeben, wird der block ans Ende gehaengt + // if the BlockNo 0 is given, the block will be appended at the end ULONG nSize = 0; ::rtl::OString aStr; ::com::sun::star::uno::Sequence aValue; @@ -2034,18 +2031,18 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) nSize = DBTypeConversion::convertUnicodeString( aVariable.getString(), aStr, m_eEncoding ); } - // Anhaengen oder ueberschreiben + // append or overwrite BOOL bAppend = rBlockNr == 0; if (!bAppend) { switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit 2 * Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with 2 * Ctrl-Z bAppend = nSize > (512 - 2); break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofield with length { char sHeader[4]; m_pMemoStream->Seek(rBlockNr * m_aMemoHeader.db_size); @@ -2064,7 +2061,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) (unsigned char)sHeader[1]) * 256 + (unsigned char)sHeader[0] - 8; - // passt die neue Laenge in die belegten Bloecke + // fits the new length in the used blocks ULONG nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0), nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0); bAppend = nUsedBlocks > nOldUsedBlocks; @@ -2075,7 +2072,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) if (bAppend) { ULONG nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); - // letzten block auffuellen + // fill last block rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); m_pMemoStream->SetStreamSize(rBlockNr * m_aMemoHeader.db_size); @@ -2088,7 +2085,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z { const char cEOF = (char) DBF_EOL; nSize++; @@ -2096,7 +2093,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) (*m_pMemoStream) << cEOF << cEOF; } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofeld with length { if ( MemodBaseIV == m_aMemoHeader.db_typ ) (*m_pMemoStream) << (BYTE)0xFF @@ -2135,13 +2132,13 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) } - // Schreiben der neuen Blocknummer + // Write the new block number if (bAppend) { ULONG nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); - // Schreiben der neuen Blocknummer + // Write the new block number m_pMemoStream->Seek(0L); (*m_pMemoStream) << m_aMemoHeader.db_next; m_pMemoStream->Flush(); @@ -2603,7 +2600,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- - // Positionierung vorbereiten: + // prepare positioning: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; @@ -2674,7 +2671,7 @@ Error: m_nFilePos = 0; break; case IResultSetHelper::BOOKMARK: - m_nFilePos = nTempPos; // vorherige Position + m_nFilePos = nTempPos; // last position } return sal_False; @@ -2691,12 +2688,12 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size); switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z { const char cEOF = (char) DBF_EOL; ByteString aBStr; static char aBuf[514]; - aBuf[512] = 0; // sonst kann der Zufall uebel mitspielen + aBuf[512] = 0; // avoid random value BOOL bReady = sal_False; do @@ -2718,7 +2715,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofield with length { char sHeader[4]; m_pMemoStream->Read(sHeader,4); @@ -2785,7 +2782,7 @@ void ODbaseTable::AllocBuffer() m_pBuffer = NULL; } - // Falls noch kein Puffer vorhanden: allozieren: + // if there is no buffer available: allocate: if (m_pBuffer == NULL && nSize) { m_nBufferSize = nSize; @@ -2798,7 +2795,7 @@ BOOL ODbaseTable::WriteBuffer() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); - // Auf gewuenschten Record positionieren: + // postion on desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx index f573f895b6cd..ad840d666989 100644 --- a/connectivity/source/drivers/dbase/Dservices.cxx +++ b/connectivity/source/drivers/dbase/Dservices.cxx @@ -50,11 +50,8 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) ); //*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - +// The prescribed C-Api must be met! +// It consists of three functions, which must be exported by the module. //--------------------------------------------------------------------------------------- void REGISTER_PROVIDER( const OUString& aServiceImplName, @@ -73,7 +70,6 @@ void REGISTER_PROVIDER( xNewKey->createKey(Services[i]); } - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +109,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 719f5b0d1cbc..8cb76a33fb66 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -66,7 +66,6 @@ ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) } } // ----------------------------------------------------------------------------- - ONDXKey::ONDXKey(double aVal, UINT32 nRec) : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) ,nRecord(nRec) @@ -98,7 +97,7 @@ ONDXPage::~ONDXPage() //------------------------------------------------------------------ void ONDXPage::QueryDelete() { - // Ablegen im GarbageCollector + // Store in GarbageCollector if (IsModified() && rIndex.m_pFileStream) (*rIndex.m_pFileStream) << *this; @@ -137,7 +136,7 @@ ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex) //------------------------------------------------------------------ USHORT ONDXPage::FindPos(const ONDXKey& rKey) const { - // sucht nach Platz fuer den vorgegeben key auf einer Seite + // searches the position for the given key in a page USHORT i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; @@ -148,11 +147,10 @@ USHORT ONDXPage::FindPos(const ONDXKey& rKey) const //------------------------------------------------------------------ BOOL ONDXPage::Find(const ONDXKey& rKey) { - // sucht den vorgegeben key - // Besonderheit: gelangt der Algorithmus ans Ende - // wird immer die aktuelle Seite und die Knotenposition vermerkt - // auf die die Bedingung <= zutrifft - // dieses findet beim Insert besondere Beachtung + // searches the given key + // Speciality: At the end of the method + // the actual page and the position of the node, fulfilling the '<=' condition, are saved + // This is considered at insert. USHORT i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; @@ -161,7 +159,7 @@ BOOL ONDXPage::Find(const ONDXKey& rKey) if (!IsLeaf()) { - // weiter absteigen + // descend further ONDXPagePtr aPage = (i==0) ? GetChild(&rIndex) : ((*this)[i-1]).GetChild(&rIndex, this); bResult = aPage.Is() && aPage->Find(rKey); } @@ -183,8 +181,8 @@ BOOL ONDXPage::Find(const ONDXKey& rKey) //------------------------------------------------------------------ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) { - // beim Erzeugen eines Index koennen auch mehrere Knoten eingefuegt werden - // diese sin dann aufsteigend sortiert + // When creating an index there can be multiple nodes added, + // these are sorted ascending BOOL bAppend = nRowsLeft > 0; if (IsFull()) { @@ -194,17 +192,16 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) aSplitNode = rNode; else { - // merken des letzten Knotens + // Save the last node aSplitNode = (*this)[nCount-1]; if(rNode.GetKey() <= aSplitNode.GetKey()) { - // und damit habe ich im folgenden praktisch eine Node weniger + // this practically reduces the number of nodes by 1 if (IsLeaf() && this == &rIndex.m_aCurLeaf) { - // geht davon aus, dass der Knoten, auf dem die Bedingung (<=) - // zutrifft, als m_nCurNode gesetzt ist - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + // assumes, that the node, for which the condition (<=) holds, is stored in m_nCurNode + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(rIndex.m_nCurNode + 1, rNode); } else // Position unbekannt @@ -212,11 +209,11 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) USHORT nPos = NODE_NOTFOUND; while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()) ; - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(nPos, rNode); } - // konnte der neue Knoten eingefuegt werden + // can the new node be inserted if (!bResult) { nCount++; @@ -230,10 +227,10 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) sal_uInt32 nNewPagePos = rIndex.GetPageCount(); sal_uInt32 nNewPageCount = nNewPagePos + 1; - // Herausgeloesten Knoten beim Vater einfuegen + // insert extracted node into parent node if (!HasParent()) { - // Kein Vater, dann neue Wurzel + // No parent, then new root ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1); aNewRoot->SetChild(this); @@ -242,13 +239,12 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.SetPageCount(++nNewPageCount); } - // neues blatt erzeugen und Seite aufteilen + // create new leaf and divide page ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,aParent); rIndex.SetPageCount(nNewPageCount); - // wieviele Knoten weren noch eingefuegt - // kommen noch ausreichend, dann koennen die Seiten bis zum Rand vollgestopft werden - + // How many nodes are being inserted? + // Enough, then we can fill the page to the brim ONDXNode aInnerNode; if (!IsLeaf() || nRowsLeft < (sal_uInt32)(rIndex.GetMaxNodes() / 2)) aInnerNode = Split(*aNewPage); @@ -256,14 +252,14 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) { aInnerNode = (*this)[nCount - 1]; - // Knoten zeigt auf neue Seite + // Node points to the new page aInnerNode.SetChild(aNewPage); - // innere Knoten haben keine Recordnummer + // Inner nodes have no record number if (rIndex.isUnique()) aInnerNode.GetKey().ResetRecord(); - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to the page of the extracted node if (!IsLeaf()) aNewPage->SetChild(aInnerNode.GetChild()); } @@ -275,15 +271,15 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.m_aCurLeaf = aNewPage; rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1; - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + // free not needed pages, there are no references to those on the page + // afterwards 'this' can't be valid anymore!!! ReleaseFull(); } - // Einfuegen des herausgeloesten Knotens + // Insert extracted node return aTempParent->Insert(aInnerNode); } - else // Seite einfach weiter auffuellen + else // Fill the page up { if (bAppend) { @@ -312,7 +308,7 @@ BOOL ONDXPage::Insert(USHORT nPos, ONDXNode& rNode) if (nCount) { ++nCount; - // nach rechts verschieben + // shift right for (USHORT i = std::min((USHORT)(nMaxCount-1), (USHORT)(nCount-1)); nPos < i; --i) (*this)[i] = (*this)[i-1]; } @@ -320,7 +316,7 @@ BOOL ONDXPage::Insert(USHORT nPos, ONDXNode& rNode) if (nCount < nMaxCount) nCount++; - // einfuegen an der Position + // insert at the position ONDXNode& rInsertNode = (*this)[nPos]; rInsertNode = rNode; if (rInsertNode.GetChild().Is()) @@ -343,11 +339,11 @@ BOOL ONDXPage::Append(ONDXNode& rNode) //------------------------------------------------------------------ void ONDXPage::Release(BOOL bSave) { - // freigeben der Pages + // free pages if (aChild.Is()) aChild->Release(bSave); - // Pointer freigeben + // free pointer aChild.Clear(); for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++) @@ -367,8 +363,8 @@ void ONDXPage::ReleaseFull(BOOL bSave) if (aTempParent.Is()) { - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + // Free pages not needed, there will be no reference anymore to the pages + // afterwards 'this' can't be valid anymore!!! USHORT nParentPos = aTempParent->Search(this); if (nParentPos != NODE_NOTFOUND) (*aTempParent)[nParentPos].GetChild().Clear(); @@ -381,40 +377,39 @@ BOOL ONDXPage::Delete(USHORT nNodePos) { if (IsLeaf()) { - // Letztes Element wird geloescht + // The last element will not be deleted if (nNodePos == (nCount - 1)) { ONDXNode aNode = (*this)[nNodePos]; - // beim Parent muss nun der KeyValue ausgetauscht werden + // parent's KeyValue has to be replaced if (HasParent()) aParent->SearchAndReplace(aNode.GetKey(), (*this)[nNodePos-1].GetKey()); } } - // Loeschen des Knoten + // Delete the node Remove(nNodePos); - // Unterlauf + // Underflow if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2)) { - // Feststellen, welcher Knoten auf die Seite zeigt + // determine, which node points to the page USHORT nParentNodePos = aParent->Search(this); - // letzte Element auf Vaterseite - // -> zusammenlegen mit vorletzter Seite + // last element on parent-page -> merge with secondlast page if (nParentNodePos == (aParent->Count() - 1)) { if (!nParentNodePos) - // zusammenlegen mit linken nachbarn + // merge with left neighbour Merge(nParentNodePos,aParent->GetChild(&rIndex)); else Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent)); } - // sonst Seite mit naechster Seite zusammenlegen + // otherwise merge page with next page else { - // zusammenlegen mit rechten nachbarn + // merge with right neighbour Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent))); nParentNodePos++; } @@ -422,7 +417,7 @@ BOOL ONDXPage::Delete(USHORT nNodePos) aParent->Delete(nParentNodePos); } else if (IsRoot()) - // Sicherstellen das die Position der Wurzel festgehalten wird + // make sure that the position of the root is kept rIndex.SetRootPos(nPagePos); return TRUE; } @@ -432,15 +427,15 @@ BOOL ONDXPage::Delete(USHORT nNodePos) ONDXNode ONDXPage::Split(ONDXPage& rPage) { DBG_ASSERT(IsFull(), "Falsches Splitting"); - /* Aufteilen einer Seite auf zwei - Blatt: - Seite 1 behaelt (n - (n/2)) - Seite 2 erhaelt (n/2) - Knoten n/2 wird dupliziert - Innerer Knoten: - Seite 1 behaelt (n+1)/2 - Seite 2 erhaelt (n/2-1) - Knoten ((n+1)/2 + 1) : wird herausgenommen + /* devide one page into two + leaf: + Page 1 is (n - (n/2)) + Page 2 is (n/2) + Node n/2 will be duplicated + inner node: + Page 1 is (n+1)/2 + Page 2 is (n/2-1) + Node ((n+1)/2 + 1) : will be taken out */ ONDXNode aResultNode; if (IsLeaf()) @@ -448,8 +443,7 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage) for (USHORT i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++) rPage.Insert(j++,(*this)[i]); - // dieser Knoten enthaelt einen Schluessel der noch einmal im Tree vorkommt - // und ersetzt werden muss + // this node contains a key that already exists in the tree and must be replaced ONDXNode aLastNode = (*this)[nCount - 1]; nCount = nCount - (nCount / 2); aResultNode = (*this)[nCount - 1]; @@ -466,13 +460,13 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage) aResultNode = (*this)[(nCount + 1) / 2]; nCount = (nCount + 1) / 2; - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to page with extraced node rPage.SetChild(aResultNode.GetChild()); } - // Knoten zeigt auf neue Seite + // node points to new page aResultNode.SetChild(&rPage); - // innere Knoten haben keine Recordnummer + // inner nodes have no record number if (rIndex.isUnique()) aResultNode.GetKey().ResetRecord(); bModified = TRUE; @@ -485,25 +479,25 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) DBG_ASSERT(HasParent(), "kein Vater vorhanden"); DBG_ASSERT(nParentNodePos != NODE_NOTFOUND, "Falscher Indexaufbau"); - /* Zusammenlegen zweier Seiten */ + /* Merge 2 pages */ ONDXNode aResultNode; USHORT nMaxNodes = rIndex.GetMaxNodes(), nMaxNodes_2 = nMaxNodes / 2; - // Feststellen ob Seite rechter oder linker Nachbar - BOOL bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // TRUE, wenn xPage die rechte Seite ist + // Determine if page is right or left neighbour + BOOL bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // TRUE, if xPage is the right page USHORT nNewCount = (*xPage).Count() + Count(); if (IsLeaf()) { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < (nMaxNodes_2 * 2)) { USHORT nLastNode = bRight ? Count() - 1 : xPage->Count() - 1; if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) while (xPage->Count()) { Append((*xPage)[0]); @@ -513,26 +507,24 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // xPage ist die linke Page und THIS die rechte + // xPage is the left page and THIS the right one while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); xPage->Remove(xPage->Count()-1); } - // alte Position von xPage beim Parent mit this ersetzen + // replace old position of xPage in parent with this if (nParentNodePos) (*aParent)[nParentNodePos-1].SetChild(this,aParent); - else // oder als rechten Knoten setzen + else // or set as right node aParent->SetChild(this); aParent->SetModified(TRUE); } - // Child beziehung beim Vaterknoten aufheben + // cancel Child-relationship at parent node (*aParent)[nParentNodePos].SetChild(); - // Austauschen des KnotenWertes, nur wenn geaenderte Page - // die linke ist, ansonsten werde - + // replace the Node-value, only if changed page is the left one, otherwise become if(aParent->IsRoot() && aParent->Count() == 1) { (*aParent)[0].SetChild(); @@ -546,47 +538,46 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) aParent->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey()); xPage->SetModified(FALSE); - xPage->ReleaseFull(); // wird nicht mehr benoetigt + xPage->ReleaseFull(); // is not needed anymore } - // Ausgleichen der Elemente nNewCount >= (nMaxNodes_2 * 2) + // balance the elements nNewCount >= (nMaxNodes_2 * 2) else { if (bRight) { - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) ONDXNode aReplaceNode = (*this)[nCount - 1]; while (nCount < nMaxNodes_2) { Append((*xPage)[0]); xPage->Remove(0); } - // Austauschen des KnotenWertes: Setzt alten letzten Wert durch den letzten von xPage + // Replace the node values: replace old last value by the last of xPage aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey()); } else { - // alle Knoten aus this vor die xPage Knoten einfuegen + // insert all nodes from this in front of the xPage nodes ONDXNode aReplaceNode = (*this)[nCount - 1]; while (xPage->Count() < nMaxNodes_2) { xPage->Insert(0,(*this)[nCount-1]); Remove(nCount-1); } - // Austauschen des KnotenWertes + // Replace the node value aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey()); } } } else // !IsLeaf() { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < nMaxNodes_2 * 2) { if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child von xPage + // Parent node will be integrated; is initialized with Child from xPage (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent); Append((*aParent)[nParentNodePos]); for (USHORT i = 0 ; i < xPage->Count(); i++) @@ -595,10 +586,9 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child - (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent merkt sich mein Child - Insert(0,(*aParent)[nParentNodePos]); // Node vom Parent bei mir einfuegen + // Parent-node will be integrated; is initialized with child + (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent memorizes my child + Insert(0,(*aParent)[nParentNodePos]); // insert parent node into myself while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); @@ -612,7 +602,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) aParent->SetChild(this); } - // danach wird der Vaterknoten zurueckgesetzt + // afterwards parent node will be reset (*aParent)[nParentNodePos].SetChild(); aParent->SetModified(TRUE); @@ -626,15 +616,15 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) SetModified(TRUE); } else if(nParentNodePos) - // Austauschen des KnotenWertes - // beim Append wird der Bereich erweitert, beim INsert verweist der alte Knoten von xPage auf this - // deshalb muss der Knoten auch hier aktualisiert werden + // replace the node value + // for Append the range will be enlarged, for Insert the old node from xPage will reference to this + // thats why the node must be updated here aParent->SearchAndReplace((*aParent)[nParentNodePos-1].GetKey(),(*aParent)[nParentNodePos].GetKey()); xPage->SetModified(FALSE); xPage->ReleaseFull(); } - // Ausgleichen der Elemente + // balance the elements else { if (bRight) @@ -673,7 +663,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) //------------------------------------------------------------------ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { - rStream >> aKey.nRecord; // schluessel + rStream >> aKey.nRecord; // key if (rIndex.getHeader().db_keytype) { @@ -707,9 +697,9 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const { const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) - rStream << (sal_uInt32)aKey.nRecord; // schluessel + rStream << (sal_uInt32)aKey.nRecord; // key else - rStream << (sal_uInt32)0; // schluessel + rStream << (sal_uInt32)0; // key if (rIndex.getHeader().db_keytype) // double { @@ -785,7 +775,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; } - // Record vergleich, wenn Index !Unique + // compare record, if index !Unique if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; @@ -865,7 +855,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) //------------------------------------------------------------------ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) { - // Seite existiert noch nicht + // Page doesn't exist yet ULONG nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE; if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) { @@ -952,7 +942,7 @@ BOOL ONDXPage::IsFull() const //------------------------------------------------------------------ USHORT ONDXPage::Search(const ONDXKey& rSearch) { - // binare Suche spaeter + // binary search later USHORT i = NODE_NOTFOUND; while (++i < Count()) if ((*this)[i].GetKey() == rSearch) @@ -969,12 +959,11 @@ USHORT ONDXPage::Search(const ONDXPage* pPage) if (((*this)[i]).GetChild() == pPage) break; - // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst - // auf die Page zeigt + // if not found, then we assume, that the page itself points to the page return (i < Count()) ? i : NODE_NOTFOUND; } // ----------------------------------------------------------------------------- -// laeuft rekursiv +// runs recursively void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { -- cgit