summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/dbase/DTable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/dbase/DTable.cxx')
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx220
1 files changed, 89 insertions, 131 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 590663488e..e8fba589ef 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,7 +40,6 @@
#include <tools/config.hxx>
#include "dbase/DIndex.hxx"
#include "dbase/DIndexes.hxx"
-//#include "file/FDriver.hxx"
#include <comphelper/sequence.hxx>
#include <svl/zforlist.hxx>
#include <unotools/syslocale.hxx>
@@ -51,7 +51,6 @@
#include <connectivity/dbconversion.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/property.hxx>
-//#include <unotools/calendarwrapper.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/types.hxx>
@@ -184,7 +183,7 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::u
_rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
else
_rDateTime.Year = static_cast<sal_uInt16>(kc - 4715);
- } // if ( _nJulianDate )
+ }
if ( _nJulianTime )
{
@@ -192,27 +191,7 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::u
double d_m = d_s / 60;
double d_h = d_m / 60;
_rDateTime.Hours = (sal_uInt16) (d_h);
- _rDateTime.Minutes = (sal_uInt16) d_m; // integer _aDateTime.Minutes
- //// weird: time fix
- // int test = (_rDateTime.Hours % 3) * 100 + _rDateTime.Minutes;
- //int test_tbl[] = {0, 1, 2, 11, 12, 13, 22, 23, 24, 25, 34, 35, 36,
- // 45, 46, 47, 56, 57, 58, 107, 108, 109, 110, 119, 120, 121,
- // 130, 131, 132, 141, 142, 143, 152, 153, 154, 155, 204, 205,
- // 206, 215, 216, 217, 226, 227, 228, 237, 238, 239, 240, 249,
- // 250, 251};
- // for (int i = 0; i < sizeof(test_tbl)/sizeof(test_tbl[0]); i++)
- //{
- // if (test == test_tbl[i])
- // {
- // // frac += 0.000012;
- // //d_hour = frac * 24.0;
- // _rDateTime.Hours = (sal_uInt16)d_hour;
- // d_minute = (d_hour - (double)_rDateTime.Hours) * 60.0;
- // _rDateTime.Minutes = (sal_uInt16)d_minute;
- // break;
- // }
- // }
-
+ _rDateTime.Minutes = (sal_uInt16) d_m;
_rDateTime.Seconds = static_cast<sal_uInt16>(( d_m - (double) _rDateTime.Minutes ) * 60.0);
}
}
@@ -318,7 +297,7 @@ void ODbaseTable::fillColumns()
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
m_pFileStream->Seek(32L);
- if(!m_aColumns.isValid())
+ if(!m_aColumns.is())
m_aColumns = new OSQLColumns();
else
m_aColumns->get().clear();
@@ -352,8 +331,6 @@ void ODbaseTable::fillColumns()
break;
sal_Bool bIsRowVersion = bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01;
- //if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01 ) // system column not visible to user
- // continue;
const String aColumnName((const char *)aDBFColumn.db_fnm,m_eEncoding);
m_aRealFieldLengths.push_back(aDBFColumn.db_flng);
@@ -549,7 +526,6 @@ void ODbaseTable::construct()
if (m_pMemoStream)
ReadMemoHeader();
}
- // if(!m_pColumns && (!m_aColumns.isValid() || !m_aColumns->size()))
fillColumns();
UINT32 nFileSize = lcl_getFileSize(*m_pFileStream);
@@ -725,7 +701,7 @@ void ODbaseTable::refreshIndexes()
aVector.push_back(aURL.getBase());
}
}
- catch(Exception&) // a execption is thrown when no file exists
+ catch(Exception&) // an exception is thrown when no file exists
{
}
}
@@ -758,7 +734,6 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException)
for(;pBegin != pEnd;++pBegin)
{
if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- // *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) ||
*pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)))
{
aOwnTypes.push_back(*pBegin);
@@ -817,7 +792,6 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
// only read the bookmark
// Satz als geloescht markieren
- // rRow.setState(bIsCurRecordDeleted ? ROW_DELETED : ROW_CLEAN );
_rRow->setDeleted(bIsCurRecordDeleted);
*(_rRow->get())[0] = m_nFilePos;
@@ -881,21 +855,25 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
char *pData = (char *) (m_pBuffer + nByteOffset);
- // (*_rRow)[i].setType(nType);
-
if (nType == DataType::CHAR || nType == DataType::VARCHAR)
{
- char cLast = pData[nLen];
- pData[nLen] = 0;
- String aStr(pData,(xub_StrLen)nLen,m_eEncoding);
- aStr.EraseTrailingChars();
-
- if ( aStr.Len() )
- *(_rRow->get())[i] = ::rtl::OUString(aStr);
- else// keine StringLaenge, dann NULL
+ sal_Int32 nLastPos = -1;
+ for (sal_Int32 k = 0; k < nLen; ++k)
+ {
+ if (pData[k] != ' ')
+ // Record last non-empty position.
+ nLastPos = k;
+ }
+ if (nLastPos < 0)
+ {
+ // Empty string. Skip it.
(_rRow->get())[i]->setNull();
-
- pData[nLen] = cLast;
+ }
+ else
+ {
+ // Commit the string. Use intern() to ref-count it.
+ *(_rRow->get())[i] = ::rtl::OUString::intern(pData, static_cast<sal_Int32>(nLastPos+1), m_eEncoding);
+ }
} // if (nType == DataType::CHAR || nType == DataType::VARCHAR)
else if ( DataType::TIMESTAMP == nType )
{
@@ -941,36 +919,46 @@ 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!
for (sal_Int32 k = 0; k < nLen; k++)
{
if (pData[k] == '\0')
pData[k] = ' ';
- }
- String aStr(pData, (xub_StrLen)nLen,m_eEncoding); // Spaces am Anfang und am Ende entfernen:
- aStr.EraseLeadingChars();
- aStr.EraseTrailingChars();
+ if (pData[k] != ' ')
+ {
+ if (nPos1 < 0)
+ // first non-empty char position.
+ nPos1 = k;
+
+ // last non-empty char position.
+ nPos2 = k;
+ }
+ }
- if (!aStr.Len())
+ if (nPos1 < 0)
{
+ // Empty string. Skip it.
nByteOffset += nLen;
(_rRow->get())[i]->setNull(); // keine Werte -> fertig
continue;
}
+ ::rtl::OUString aStr = ::rtl::OUString::intern(pData+nPos1, nPos2-nPos1+1, m_eEncoding);
+
switch (nType)
{
case DataType::DATE:
{
- if (aStr.Len() != nLen)
+ if (aStr.getLength() != nLen)
{
(_rRow->get())[i]->setNull();
break;
}
- const sal_uInt16 nYear = (sal_uInt16)aStr.Copy( 0, 4 ).ToInt32();
- const sal_uInt16 nMonth = (sal_uInt16)aStr.Copy( 4, 2 ).ToInt32();
- const sal_uInt16 nDay = (sal_uInt16)aStr.Copy( 6, 2 ).ToInt32();
+ const sal_uInt16 nYear = (sal_uInt16)aStr.copy( 0, 4 ).toInt32();
+ const sal_uInt16 nMonth = (sal_uInt16)aStr.copy( 4, 2 ).toInt32();
+ const sal_uInt16 nDay = (sal_uInt16)aStr.copy( 6, 2 ).toInt32();
const ::com::sun::star::util::Date aDate(nDay,nMonth,nYear);
*(_rRow->get())[i] = aDate;
@@ -978,7 +966,6 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
break;
case DataType::DECIMAL:
*(_rRow->get())[i] = ORowSetValue(aStr);
- // pVal->setDouble(SdbTools::ToDouble(aStr));
break;
case DataType::BIT:
{
@@ -991,14 +978,13 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
default: b = FALSE; break;
}
*(_rRow->get())[i] = b;
- // pVal->setDouble(b);
}
break;
case DataType::LONGVARBINARY:
case DataType::BINARY:
case DataType::LONGVARCHAR:
{
- const long nBlockNo = aStr.ToInt32(); // Blocknummer lesen
+ const long nBlockNo = aStr.toInt32(); // Blocknummer lesen
if (nBlockNo > 0 && m_pMemoStream) // Daten aus Memo-Datei lesen, nur wenn
{
if ( !ReadMemo(nBlockNo, (_rRow->get())[i]->get()) )
@@ -1055,7 +1041,7 @@ BOOL ODbaseTable::CreateImpl()
{
::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier();
if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString::createFromAscii("/");
+ aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
aIdent += m_Name;
aName = aIdent.getStr();
}
@@ -1074,13 +1060,12 @@ BOOL ODbaseTable::CreateImpl()
if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END))
{
- // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,TABLE,aFile.GetFull());
return sal_False;
}
delete pFileStream;
}
}
- catch(Exception&) // a execption is thrown when no file exists
+ catch(Exception&) // an exception is thrown when no file exists
{
}
@@ -1095,9 +1080,9 @@ BOOL ODbaseTable::CreateImpl()
try
{
Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) );
+ aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
}
- catch(Exception&) // a execption is thrown when no file exists
+ catch(Exception&) // an exception is thrown when no file exists
{
}
return sal_False;
@@ -1114,17 +1099,16 @@ BOOL ODbaseTable::CreateImpl()
{
bMemoAlreadyExists = aMemo1Content.isDocument();
}
- catch(Exception&) // a execption is thrown when no file exists
+ catch(Exception&) // an exception is thrown when no file exists
{
}
if (bMemoAlreadyExists)
{
- // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,MEMO,aFile.GetFull());
aURL.setExtension(aExt); // kill dbf file
try
{
Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) );
+ aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
}
catch(const Exception&)
{
@@ -1140,7 +1124,7 @@ BOOL ODbaseTable::CreateImpl()
{
aURL.setExtension(aExt); // kill dbf file
Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) );
+ aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
return sal_False;
}
m_aHeader.db_typ = dBaseIIIMemo;
@@ -1329,7 +1313,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
{
throwInvalidColumnType(STR_INVALID_COLUMN_PRECISION, aName);
}
- (*m_pFileStream) << (BYTE) Min((ULONG)nPrecision, 255UL); //Feldlaenge
+ (*m_pFileStream) << (BYTE) Min((unsigned)nPrecision, 255U); //Feldlaenge
nRecLength = nRecLength + (USHORT)::std::min((USHORT)nPrecision, (USHORT)255UL);
(*m_pFileStream) << (BYTE)0; //Nachkommastellen
break;
@@ -1476,7 +1460,6 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie
{
}
}
- // aFile.SetBase(m_Name);
aURL.setExtension(String::CreateFromAscii("inf"));
// as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill
@@ -1484,7 +1467,7 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie
try
{
::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () );
- aDeleteContent.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) );
+ aDeleteContent.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) );
}
catch(Exception&)
{
@@ -1524,14 +1507,14 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<X
// Gesamte neue Row uebernehmen:
// ... und am Ende als neuen Record hinzufuegen:
- UINT32 nTempPos = m_nFilePos,
- nFileSize = 0,
- nMemoFileSize = 0;
+ UINT32 nTempPos = m_nFilePos;
m_nFilePos = (ULONG)m_aHeader.db_anz + 1;
BOOL bInsertRow = UpdateBuffer( rRow, NULL, _xCols );
if ( bInsertRow )
{
+ UINT32 nFileSize = 0, nMemoFileSize = 0;
+
nFileSize = lcl_getFileSize(*m_pFileStream);
if (HasMemoFields() && m_pMemoStream)
@@ -1738,11 +1721,10 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
if (xIndex.is())
{
// first check if the value is different to the old one and when if it conform to the index
- if(pOrgRow.isValid() && (rRow.get()[nPos]->getValue().isNull() || rRow.get()[nPos] == (pOrgRow->get())[nPos]))
+ if(pOrgRow.is() && (rRow.get()[nPos]->getValue().isNull() || rRow.get()[nPos] == (pOrgRow->get())[nPos]))
continue;
else
{
- // ODbVariantRef xVar = (pVal == NULL) ? new ODbVariant() : pVal;
Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
@@ -1772,7 +1754,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
for (i = 0; i < nColumnCount && nByteOffset <= m_nBufferSize ; ++i)
{
- // Laengen je nach Datentyp:
+ // Lengths for each data type:
OSL_ENSURE(i < m_aPrecisions.size(),"Illegal index!");
sal_Int32 nLen = 0;
sal_Int32 nType = 0;
@@ -1809,7 +1791,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
break;
case DataType::DECIMAL:
nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,nScale);
- break; // das Vorzeichen und das Komma
+ break; // The sign and the comma
default:
break;
@@ -1838,10 +1820,10 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
++nPos; // the row values start at 1
- // Ist die Variable ueberhaupt gebunden?
+ // If the variable is bound at all?
if ( !rRow.get()[nPos]->isBound() )
{
- // Nein - naechstes Feld.
+ // No - the next field.
nByteOffset += nLen;
continue;
}
@@ -1852,7 +1834,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
// Update !!
- if (pOrgRow.isValid() && !rRow.get()[nPos]->getValue().isNull() )//&& pVal->isModified())
+ if (pOrgRow.is() && !rRow.get()[nPos]->getValue().isNull() )
pIndex->Update(m_nFilePos,*(pOrgRow->get())[nPos],*rRow.get()[nPos]);
else
pIndex->Insert(m_nFilePos,*rRow.get()[nPos]);
@@ -1862,15 +1844,14 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
if (rRow.get()[nPos]->getValue().isNull())
{
if ( bSetZero )
- memset(pData,0,nLen); // Zuruecksetzen auf NULL
+ memset(pData,0,nLen); // Clear to NULL
else
- memset(pData,' ',nLen); // Zuruecksetzen auf NULL
+ memset(pData,' ',nLen); // Clear to NULL
nByteOffset += nLen;
OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
continue;
}
- sal_Bool bHadError = sal_False;
try
{
switch (nType)
@@ -1879,7 +1860,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
{
sal_Int32 nJulianDate = 0, nJulianTime = 0;
lcl_CalcJulDate(nJulianDate,nJulianTime,rRow.get()[nPos]->getValue());
- // Genau 8 Byte kopieren:
+ // Exactly 8 bytes to copy:
memcpy(pData,&nJulianDate,4);
memcpy(pData+4,&nJulianTime,4);
}
@@ -1899,7 +1880,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
(int)aDate.Month,
(int)aDate.Day);
- // Genau 8 Byte kopieren:
+ // Exactly 8 bytes to copy:
strncpy(pData,s,sizeof s - 1);
} break;
case DataType::INTEGER:
@@ -1928,18 +1909,18 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
break;
case DataType::DECIMAL:
{
- memset(pData,' ',nLen); // Zuruecksetzen auf NULL
+ memset(pData,' ',nLen); // Clear to NULL
const double n = rRow.get()[nPos]->getValue();
- // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich
- // sein koennte und muesste
-
+ // one, because const_cast GetFormatPrecision on SvNumberFormat is not constant,
+ // even though it really could and should be
const ByteString aDefaultValue( ::rtl::math::doubleToString( n, rtl_math_StringFormat_F, nScale, '.', NULL, 0));
- BOOL bValidLength = aDefaultValue.Len() <= nLen;
- if ( bValidLength )
+ const sal_Int32 nValueLen = aDefaultValue.Len();
+ if ( nValueLen <= nLen )
{
- strncpy(pData,aDefaultValue.GetBuffer(),nLen);
+ // Write value right-justified, padded with blanks to the left.
+ memcpy(pData+nLen-nValueLen,aDefaultValue.GetBuffer(),nValueLen);
// write the resulting double back
*rRow.get()[nPos] = toDouble(aDefaultValue);
}
@@ -1967,12 +1948,12 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
case DataType::LONGVARBINARY:
case DataType::LONGVARCHAR:
{
- char cNext = pData[nLen]; // merken und temporaer durch 0 ersetzen
- pData[nLen] = '\0'; // das geht, da der Puffer immer ein Zeichen groesser ist ...
+ char cNext = pData[nLen]; // Mark's scratch and replaced by 0
+ pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ...
- ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Blocknummer lesen
+ ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Block number read
- // Naechstes Anfangszeichen wieder restaurieren:
+ // Next initial character restore again:
pData[nLen] = cNext;
if (!m_pMemoStream || !WriteMemo(rRow.get()[nPos]->get(), nBlockNo))
break;
@@ -1981,13 +1962,13 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
ByteString aBlock(ByteString::CreateFromInt32(nBlockNo));
aStr.Expand(static_cast<sal_uInt16>(nLen - aBlock.Len()), '0' );
aStr += aBlock;
- // Zeichen kopieren:
- memset(pData,' ',nLen); // Zuruecksetzen auf NULL
+ // Copy characters:
+ memset(pData,' ',nLen); // Clear to NULL
memcpy(pData, aStr.GetBuffer(), nLen);
} break;
default:
{
- memset(pData,' ',nLen); // Zuruecksetzen auf NULL
+ memset(pData,' ',nLen); // Clear to NULL
::rtl::OUString sStringToWrite( rRow.get()[nPos]->getValue().getString() );
@@ -2005,9 +1986,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
{
throw;
}
- catch ( Exception& ) { bHadError = sal_True; }
-
- if ( bHadError )
+ catch ( Exception& )
{
m_pColumns->getByIndex(i) >>= xCol;
OSL_ENSURE( xCol.is(), "ODbaseTable::UpdateBuffer column is null!" );
@@ -2020,7 +1999,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
) );
::dbtools::throwGenericSQLException( sError, *this );
}
- // Und weiter ...
+ // And more ...
nByteOffset += nLen;
OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
}
@@ -2294,7 +2273,7 @@ void ODbaseTable::alterColumn(sal_Int32 index,
}
catch(const Exception&)
{
- OSL_ENSURE(0,"ODbaseTable::alterColumn: Exception occured!");
+ OSL_ENSURE(0,"ODbaseTable::alterColumn: Exception occurred!");
throw;
}
}
@@ -2332,7 +2311,7 @@ namespace
{
::rtl::OUString aIdent = _pConenction->getContent()->getIdentifier()->getContentIdentifier();
if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString::createFromAscii("/");
+ aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
aIdent += oldName;
aName = aIdent;
}
@@ -2349,11 +2328,11 @@ namespace
Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
Sequence< PropertyValue > aProps( 1 );
- aProps[0].Name = ::rtl::OUString::createFromAscii("Title");
+ aProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title"));
aProps[0].Handle = -1; // n/a
aProps[0].Value = makeAny( ::rtl::OUString(sNewName) );
Sequence< Any > aValues;
- aContent.executeCommand( rtl::OUString::createFromAscii( "setPropertyValues" ),makeAny(aProps) ) >>= aValues;
+ aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setPropertyValues")),makeAny(aProps) ) >>= aValues;
if(aValues.getLength() && aValues[0].hasValue())
throw Exception();
}
@@ -2514,7 +2493,7 @@ String ODbaseTable::createTempFile()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::createTempFile" );
::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier();
if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString::createFromAscii("/");
+ aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
String sTempName(aIdent);
String sExt;
sExt.AssignAscii(".");
@@ -2562,7 +2541,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
bOk = seekRow( IResultSetHelper::BOOKMARK, nRowPos+1, nCurPos );
if ( bOk )
{
- bOk = fetchRow( aRow, m_aColumns.getBody(), sal_True, sal_True);
+ bOk = fetchRow( aRow, *m_aColumns, sal_True, sal_True);
if ( bOk && !aRow->isDeleted() ) // copy only not deleted rows
{
// special handling when pos == 0 then we don't have to distinguish between the two rows
@@ -2660,11 +2639,11 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen;
- ULONG nLen = m_pFileStream->Seek(nPos);
+ m_pFileStream->Seek(nPos);
if (m_pFileStream->GetError() != ERRCODE_NONE)
goto Error;
- nLen = m_pFileStream->Read((char*)m_pBuffer, nEntryLen);
+ m_pFileStream->Read((char*)m_pBuffer, nEntryLen);
if (m_pFileStream->GetError() != ERRCODE_NONE)
goto Error;
}
@@ -2689,7 +2668,6 @@ Error:
case IResultSetHelper::BOOKMARK:
m_nFilePos = nTempPos; // vorherige Position
}
- // aStatus.Set(SDB_STAT_NO_DATA_FOUND);
return sal_False;
End:
@@ -2701,7 +2679,6 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" );
BOOL bIsText = TRUE;
- // SdbConnection* pConnection = GetConnection();
m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size);
switch (m_aMemoHeader.db_typ)
@@ -2740,29 +2717,10 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
// Foxpro stores text and binary data
if (m_aMemoHeader.db_typ == MemoFoxPro)
{
-// if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0)
-// {
-//// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
-//// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
-//// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
-//// aStatus.Set(SDB_STAT_ERROR,
-//// String::CreateFromAscii("01000"),
-//// aStatus.CreateErrorMessage(aText),
-//// 0, String() );
-// return sal_False;
-// }
-//
bIsText = sHeader[3] != 0;
}
else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08)
{
-// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
-// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
-// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
-// aStatus.Set(SDB_STAT_ERROR,
-// String::CreateFromAscii("01000"),
-// aStatus.CreateErrorMessage(aText),
-// 0, String() );
return sal_False;
}
@@ -2776,7 +2734,6 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
{
if ( bIsText )
{
- // char cChar;
::rtl::OUStringBuffer aStr;
while ( nLength > STRING_MAXLEN )
{
@@ -2791,7 +2748,6 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
ByteString aBStr;
aBStr.Expand(static_cast<xub_StrLen>(nLength));
m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
- // aBStr.ReleaseBufferAccess();
aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
}
if ( aStr.getLength() )
@@ -2845,3 +2801,5 @@ sal_Int32 ODbaseTable::getCurrentLastPos() const
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getCurrentLastPos" );
return m_aHeader.db_anz;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */