diff options
Diffstat (limited to 'connectivity/source/drivers/file')
21 files changed, 307 insertions, 353 deletions
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index 7ef176353082..df810c291704 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.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. @@ -71,7 +72,7 @@ void OFileCatalog::refreshTables() TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); fillNames(xResult,aVector); if(m_pTables) @@ -119,3 +120,4 @@ Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) throw(RuntimeException) // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index e92855db23fa..9c67f48bd6a6 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.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. @@ -92,3 +93,4 @@ void OColumns::impl_refresh() throw(RuntimeException) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index de145407188a..aa5a5108c7d5 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.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. @@ -177,7 +178,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV // set fields to fetch Sequence< OUString > aProps(1); OUString* pProps = aProps.getArray(); - pProps[ 0 ] = OUString::createFromAscii( "Title" ); + pProps[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); try { @@ -197,7 +198,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV } else { - OSL_ENSURE(0,"OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!"); + OSL_FAIL("OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!"); throw SQLException(); } } @@ -404,7 +405,7 @@ Reference< XDynamicResultSet > OConnection::getDir() const Reference<XDynamicResultSet> xContent; Sequence< ::rtl::OUString > aProps(1); ::rtl::OUString* pProps = aProps.getArray(); - pProps[ 0 ] = ::rtl::OUString::createFromAscii( "Title" ); + pProps[ 0 ] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); try { Reference<XContentIdentifier> xIdent = getContent()->getIdentifier(); @@ -459,3 +460,4 @@ void OConnection::throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::O +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 24fcb06833fa..f1ad57ceb0c4 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.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. @@ -88,7 +89,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getColumns" ); - OSL_ENSURE(0,"Should be overloaded!"); + OSL_FAIL("Should be overloaded!"); return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); } @@ -174,7 +175,7 @@ namespace } catch( const Exception& ) { - OSL_ENSURE( sal_False, "isCaseSensitiveParentFolder: caught an unexpected exception!" ); + OSL_FAIL( "isCaseSensitiveParentFolder: caught an unexpected exception!" ); } return nIsCS; @@ -196,7 +197,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); @@ -220,7 +221,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( Reference<XDynamicResultSet> xContent = m_pConnection->getDir(); Reference < XSortedDynamicResultSetFactory > xSRSFac( - m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY ); + m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), UNO_QUERY ); Sequence< NumberedSortingInfo > aSortInfo( 1 ); NumberedSortingInfo* pInfo = aSortInfo.getArray(); @@ -290,7 +291,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( { aName = aName.replaceAt(aName.getLength()-(aFilenameExtension.Len()+1),aFilenameExtension.Len()+1,::rtl::OUString()); sal_Unicode nChar = aName.toChar(); - if ( match(tableNamePattern,aName.getStr(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { aRow.push_back(new ORowSetValueDecorator(aName)); bNewRow = sal_True; @@ -305,7 +306,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( if (!aURL.getExtension().getLength()) { sal_Unicode nChar = aURL.getBase().getStr()[0]; - if(match(tableNamePattern,aURL.getBase().getStr(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(aURL.getBase()))); bNewRow = sal_True; @@ -425,13 +426,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); for(;pBegin != pEnd;++pBegin) { - if(match(tableNamePattern,pBegin->getStr(),'\0')) + if(match(tableNamePattern,*pBegin,'\0')) { static ODatabaseMetaDataResultSet::ORow aRow(8); aRow[2] = new ORowSetValueDecorator(*pBegin); aRow[6] = ODatabaseMetaDataResultSet::getSelectValue(); - aRow[7] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[7] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); aRows.push_back(aRow); Reference< XPropertySet> xTable; @@ -550,7 +551,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLExc ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getIdentifierQuoteString_throw" ); - static const ::rtl::OUString sQuote = ::rtl::OUString::createFromAscii("\""); + static const ::rtl::OUString sQuote(RTL_CONSTASCII_USTRINGPARAM("\"")); return sQuote; } // ------------------------------------------------------------------------- @@ -710,7 +711,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE { ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TABLE"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")))); aRows.push_back(aRow); } pResult->setRows(aRows); @@ -972,7 +973,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQL ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getURL" ); - static const ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); + static const ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:file:" )); return aValue; } // ------------------------------------------------------------------------- @@ -1221,3 +1222,4 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalo } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx index 69330bf0c168..a6be589f5328 100644 --- a/connectivity/source/drivers/file/FDateFunctions.cxx +++ b/connectivity/source/drivers/file/FDateFunctions.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. @@ -69,7 +70,7 @@ ORowSetValue OOp_DayOfWeek::operate(const ORowSetValue& lhs) const nRet = 1; break; default: - OSL_ENSURE(0,"Error in enum values for date"); + OSL_FAIL("Error in enum values for date"); } return nRet; } @@ -135,7 +136,7 @@ ORowSetValue OOp_DayName::operate(const ORowSetValue& lhs) const sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sunday")); break; default: - OSL_ENSURE(0,"Error in enum values for date"); + OSL_FAIL("Error in enum values for date"); } return sRet; } @@ -287,3 +288,5 @@ ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const aCurTime.GetDay(),aCurTime.GetMonth(),aCurTime.GetYear()); } //------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index d0d952e9bab6..708a85ce1b56 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.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. @@ -74,14 +75,14 @@ void OFileDriver::disposing() //------------------------------------------------------------------------------ rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdbc.driver.file.Driver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.driver.file.Driver")); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); - aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); + aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); return aSNS; } @@ -128,7 +129,7 @@ sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" ); - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:file:")),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) @@ -248,7 +249,7 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const return getDataDefinitionByConnection(connect(url,info)); } // ----------------------------------------------------------------------------- -void OOperandParam::describe(const Reference< XPropertySet>& rColumn, ::vos::ORef<connectivity::OSQLColumns> rParameterColumns) +void OOperandParam::describe(const Reference< XPropertySet>& rColumn, ::rtl::Reference<connectivity::OSQLColumns> rParameterColumns) { // den alten namen beibehalten @@ -283,3 +284,4 @@ OOperandAttr::OOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xCo +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index ac04fc9dff86..b06cda7c5a49 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.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. @@ -88,18 +89,18 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" ); DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode"); - // Parameter Name-Regel gefunden? + // found parameter Name-Rule? if (SQL_ISRULE(pParseNode,parameter)) { DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); _rParaNodes.push_back(pParseNode); - // Weiterer Abstieg nicht erforderlich + // Further descend not nessesary return; } - // Weiter absteigen im Parse Tree + // Further descend in Parse Tree for (sal_uInt32 i = 0; i < pParseNode->count(); i++) scanParameter(pParseNode->getChild(i),_rParaNodes); } @@ -122,10 +123,4 @@ OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) } // ----------------------------------------------------------------------------- - - - - - - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx index ea5848132ecb..031905a01999 100644 --- a/connectivity/source/drivers/file/FNumericFunctions.cxx +++ b/connectivity/source/drivers/file/FNumericFunctions.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. @@ -247,3 +248,5 @@ ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const return nLhs*3.141592653589793116*(1.0/180.0); } // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 386a601a3b7c..170dc1c5494c 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.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. @@ -96,7 +97,7 @@ void OPreparedStatement::disposing() m_xParamColumns = NULL; m_xMetaData.clear(); - if(m_aParameterRow.isValid()) + if(m_aParameterRow.is()) { m_aParameterRow->get().clear(); m_aParameterRow = NULL; @@ -298,7 +299,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 / ::osl::MutexGuard aGuard( m_aMutex ); checkAndResizeParameters(parameterIndex); - if ( m_aAssignValues.isValid() ) + if ( m_aAssignValues.is() ) (m_aAssignValues->get())[m_aParameterIndexes[parameterIndex]]->setNull(); else (m_aParameterRow->get())[parameterIndex]->setNull(); @@ -428,8 +429,8 @@ Reference<XResultSet> OPreparedStatement::initResultSet() Reference<XResultSet> xRs(m_pResultSet); // check if we got enough paramters - if ( (m_aParameterRow.isValid() && ( m_aParameterRow->get().size() -1 ) < m_xParamColumns->get().size()) || - (m_xParamColumns.isValid() && !m_aParameterRow.isValid() && !m_aParameterRow->get().empty()) ) + if ( (m_aParameterRow.is() && ( m_aParameterRow->get().size() -1 ) < m_xParamColumns->get().size()) || + (m_xParamColumns.is() && !m_aParameterRow.is() && !m_aParameterRow->get().empty()) ) m_pConnection->throwGenericSQLException(STR_INVALID_PARA_COUNT,*this); m_pResultSet->OpenImpl(); @@ -452,7 +453,7 @@ void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::checkAndResizeParameters" ); ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed); - if ( m_aAssignValues.isValid() && (parameterIndex < 1 || parameterIndex >= static_cast<sal_Int32>(m_aParameterIndexes.size())) ) + if ( m_aAssignValues.is() && (parameterIndex < 1 || parameterIndex >= static_cast<sal_Int32>(m_aParameterIndexes.size())) ) throwInvalidIndexException(*this); else if ( static_cast<sal_Int32>((m_aParameterRow->get()).size()) <= parameterIndex ) { @@ -460,7 +461,7 @@ void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex) (m_aParameterRow->get()).resize(parameterIndex+1); for ( ;i <= parameterIndex+1; ++i ) { - if ( !(m_aParameterRow->get())[i].isValid() ) + if ( !(m_aParameterRow->get())[i].is() ) (m_aParameterRow->get())[i] = new ORowSetValueDecorator; } } @@ -472,7 +473,7 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const ORowSetVal ::osl::MutexGuard aGuard( m_aMutex ); checkAndResizeParameters(parameterIndex); - if(m_aAssignValues.isValid()) + if(m_aAssignValues.is()) *(m_aAssignValues->get())[m_aParameterIndexes[parameterIndex]] = x; else *((m_aParameterRow->get())[parameterIndex]) = x; @@ -490,7 +491,7 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re #endif ::rtl::OUString sParameterName; - // Parameter-Column aufsetzen: + // set up Parameter-Column: sal_Int32 eType = DataType::VARCHAR; sal_uInt32 nPrecision = 255; sal_Int32 nScale = 0; @@ -498,9 +499,9 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re if (_xCol.is()) { - // Typ, Precision, Scale ... der angegebenen Column verwenden, - // denn dieser Column wird der Wert zugewiesen bzw. mit dieser - // Column wird der Wert verglichen. + // Use type, precision, scale ... from the given column, + // because this Column will get a value assigned or + // with this Column the value will be compared. _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= eType; _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nPrecision; _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale; @@ -572,39 +573,38 @@ void OPreparedStatement::initializeResultSet(OResultSet* _pResult) m_pResultSet->setParameterColumns(m_xParamColumns); m_pResultSet->setParameterRow(m_aParameterRow); - // Parameter substituieren (AssignValues und Kriterien): + // Substitute parameter (AssignValues and criteria): if (!m_xParamColumns->get().empty()) { - // Zunaechst AssignValues - sal_uInt16 nParaCount=0; // gibt die aktuelle Anzahl der bisher gesetzen Parameter an + // begin with AssignValues + sal_uInt16 nParaCount=0; // gives the current number of previously set Parameters - // Nach zu substituierenden Parametern suchen: - size_t nCount = m_aAssignValues.isValid() ? m_aAssignValues->get().size() : 1; // 1 ist wichtig fuer die Kriterien + // search for parameters to be substituted: + size_t nCount = m_aAssignValues.is() ? m_aAssignValues->get().size() : 1; // 1 is important for the Criteria for (size_t j = 1; j < nCount; j++) { sal_uInt32 nParameter = (*m_aAssignValues).getParameterIndex(j); if (nParameter == SQL_NO_PARAMETER) - continue; // dieser AssignValue ist kein Parameter + continue; // this AssignValue is no Parameter - ++nParaCount; // ab hier ist der Parameter gueltig - // Parameter ersetzen. Wenn Parameter nicht verfuegbar, - // Value auf NULL setzen. - // (*m_aAssignValues)[j] = (*m_aParameterRow)[(sal_uInt16)nParameter]; + ++nParaCount; // now the Parameter is valid + // Replace Parameter. If the Parameter isn't available, set value to NULL + // (*m_aAssignValues)[j] = (*m_aParameterRow)[(UINT16)nParameter]; } - if (m_aParameterRow.isValid() && (m_xParamColumns->get().size()+1) != m_aParameterRow->get().size() ) + if (m_aParameterRow.is() && (m_xParamColumns->get().size()+1) != m_aParameterRow->get().size() ) { sal_Int32 i = m_aParameterRow->get().size(); sal_Int32 nParamColumns = m_xParamColumns->get().size()+1; m_aParameterRow->get().resize(nParamColumns); for ( ;i < nParamColumns; ++i ) { - if ( !(m_aParameterRow->get())[i].isValid() ) + if ( !(m_aParameterRow->get())[i].is() ) (m_aParameterRow->get())[i] = new ORowSetValueDecorator; } //m_aParameterRow->resize(m_xParamColumns->size()+1); } - if (m_aParameterRow.isValid() && nParaCount < m_aParameterRow->get().size() ) + if (m_aParameterRow.is() && nParaCount < m_aParameterRow->get().size() ) { m_pSQLAnalyzer->bindParameterRow(m_aParameterRow); @@ -618,7 +618,7 @@ void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseN Reference<XPropertySet> xCol; m_xColNames->getByName(_sColumnName) >>= xCol; sal_Int32 nParameter = -1; - if(m_xParamColumns.isValid()) + if(m_xParamColumns.is()) { OSQLColumns::Vector::const_iterator aIter = find(m_xParamColumns->get().begin(),m_xParamColumns->get().end(),_sColumnName,::comphelper::UStringMixEqual(m_pTable->isCaseSensitive())); if(aIter != m_xParamColumns->get().end()) @@ -626,9 +626,10 @@ void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseN } if(nParameter == -1) nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol); - // Nr. des Parameters in der Variablen merken: + // Save number of parameter in the variable: SetAssignValue(_sColumnName, String(), sal_True, nParameter); } // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index b9b7180eb65e..b0e774d9f9a5 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.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. @@ -27,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" -#include <limits> // included here to prevent problems if compiling with C52 #ifdef GCC #include <iostream> @@ -74,7 +74,7 @@ using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; -// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen: +// Maximal number of Rows, that can be processed being sorted with ORDER BY: #define MAX_KEYSET_SIZE 0x40000 // 256K namespace @@ -191,7 +191,7 @@ void OResultSet::clear() m_pFileSet = NULL; DELETEZ(m_pSortIndex); - if(m_aInsertRow.isValid()) + if(m_aInsertRow.is()) m_aInsertRow->get().clear(); m_aSkipDeletedSet.clear(); @@ -240,7 +240,6 @@ const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::su ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - //columnIndex = mapColumn(columnIndex); checkIndex(columnIndex ); @@ -252,8 +251,7 @@ void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" ); if ( columnIndex <= 0 - // || columnIndex > (sal_Int32)m_xColumns->size() - || columnIndex >= m_nColumnCount ) + || columnIndex >= m_nColumnCount ) ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -583,12 +581,12 @@ sal_Bool OResultSet::evaluate() { if(m_pEvaluationKeySet) { - bRet = m_pTable->fetchRow(m_aEvaluateRow,m_pTable->getTableColumns().getBody(),sal_True,sal_True); + bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True); evaluate(); } else - bRet = m_pTable->fetchRow(m_aRow,m_xColumns.getBody(),sal_False,sal_True); + bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True); } } @@ -645,8 +643,8 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) // we know that we append new rows at the end // so we have to know where the end is m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False); - m_bRowInserted = m_pTable->InsertRow(m_aInsertRow.getBody(), sal_True,m_xColsIdx); - if(m_bRowInserted && m_pFileSet.isValid()) + m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, sal_True, m_xColsIdx); + if(m_bRowInserted && m_pFileSet.is()) { sal_Int32 nPos = (m_aInsertRow->get())[0]->getValue(); m_pFileSet->get().push_back(nPos); @@ -666,7 +664,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) if(!m_pTable || m_pTable->isReadOnly()) lcl_throwError(STR_TABLE_READONLY,*this); - m_bRowUpdated = m_pTable->UpdateRow(m_aInsertRow.getBody(), m_aRow,m_xColsIdx); + m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx); *(m_aInsertRow->get())[0] = (sal_Int32)(m_aRow->get())[0]->getValue(); clearInsertRow(); @@ -687,8 +685,8 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) lcl_throwError(STR_ROW_ALREADY_DELETED,*this); sal_Int32 nPos = (sal_Int32)(m_aRow->get())[0]->getValue(); - m_bRowDeleted = m_pTable->DeleteRow(m_xColumns.getBody()); - if(m_bRowDeleted && m_pFileSet.isValid()) + m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns); + if(m_bRowDeleted && m_pFileSet.is()) { m_aRow->setDeleted(sal_True); // don't touch the m_pFileSet member here @@ -708,7 +706,7 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept m_bRowInserted = sal_False; m_bRowDeleted = sal_False; - if(m_aInsertRow.isValid()) + if(m_aInsertRow.is()) { OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1; for(;aIter != m_aInsertRow->get().end();++aIter) @@ -909,11 +907,11 @@ sal_Bool OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" ); OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!"); - // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... + // For further Fetch-Operations this information may possibly be changed ... IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition; sal_Int32 nOffset = nFirstOffset; - const OSQLColumns & rTableCols = m_pTable->getTableColumns().getBody(); + const OSQLColumns & rTableCols = *(m_pTable->getTableColumns()); sal_Bool bHasRestriction = m_pSQLAnalyzer->hasRestriction(); again: @@ -929,7 +927,7 @@ again: return sal_False; } - if (!bEvaluate) // Laeuft keine Auswertung, dann nur Ergebniszeile fuellen + if (!bEvaluate) // If no evaluation runs, then just fill the results-row { m_pTable->fetchRow(m_aRow,rTableCols, sal_True,bRetrieveData); } @@ -944,8 +942,8 @@ again: && !m_pSQLAnalyzer->evaluateRestriction() ) ) - { // naechsten Satz auswerten - // aktuelle Zeile loeschen im Keyset + { // Evaluate the next record + // delete current row in Keyset if (m_pEvaluationKeySet) { ++m_aEvaluateIter; @@ -956,10 +954,9 @@ again: return sal_False; } } - else if (m_pFileSet.isValid()) + else if (m_pFileSet.is()) { - OSL_ENSURE(//!m_pFileSet->IsFrozen() && - eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!"); + OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!"); eCursorPosition = IResultSetHelper::NEXT; nOffset = 1; } @@ -982,16 +979,15 @@ again: } else { - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); return sal_False; } - // Nochmal probieren ... + // Try again ... goto again; } } - // Evaluate darf nur gesetzt sein, - // wenn der Keyset weiter aufgebaut werden soll + // Evaluate may only be set, + // if the Keyset will be constructed further if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT ) && !isCount() && bEvaluate @@ -1002,9 +998,8 @@ again: OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow ); m_pSortIndex->AddKeyValue(pKeyValue); } - else if (m_pFileSet.isValid()) + else if (m_pFileSet.is()) { - // OSL_ENSURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!"); sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue()); m_pFileSet->get().push_back(nBookmarkValue); } @@ -1014,14 +1009,14 @@ again: sal_Bool bOK = sal_True; if (bEvaluate) { - // jetzt die eigentliche Ergebniszeile Lesen - bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), sal_True,sal_True); + // read the actual result-row + bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True); } if (bOK) { - // Nur die zu aendernden Werte uebergeben: - if(!m_pTable->UpdateRow(m_aAssignValues.getBody(),m_aEvaluateRow,m_xColsIdx)) + // just give the values to be changed: + if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx)) return sal_False; } } @@ -1030,11 +1025,11 @@ again: sal_Bool bOK = sal_True; if (bEvaluate) { - bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), sal_True,sal_True); + bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True); } if (bOK) { - if(!m_pTable->DeleteRow(m_xColumns.getBody())) + if(!m_pTable->DeleteRow(*m_xColumns)) return sal_False; } } @@ -1049,15 +1044,13 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 //IgnoreDeletedRows: // sal_Int32 nTempPos = m_nRowPos; - // exclusiver zugriff auf die Tabelle - // vos::OGuard* pGuard = m_pTable->Lock(); if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount()) { - if (!m_pFileSet.isValid()) // kein Index verfuegbar + if (!m_pFileSet.is()) //no Index available { - // Normales FETCH + // Normal FETCH ExecuteRow(eCursorPosition,nOffset,sal_False,bRetrieveData); // now set the bookmark for outside this is the logical pos and not the file pos @@ -1078,7 +1071,6 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 m_nRowPos = 0; break; case IResultSetHelper::LAST: - // OSL_ENSURE(IsRowCountFinal(), "Fehler im Keyset!"); // muss eingefroren sein, sonst Fehler beim SQLCursor m_nRowPos = m_pFileSet->get().size() - 1; break; case IResultSetHelper::RELATIVE: @@ -1093,19 +1085,18 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 } // OffRange? - // Der FileCursor ist ausserhalb des gueltigen Bereichs, wenn + // The FileCursor is outside of the valid range, if: // a.) m_nRowPos < 1 - // b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size() + // b.) a KeySet exists and m_nRowPos > m_pFileSet->size() if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen() { - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); goto Error; } else { if (m_nRowPos < (sal_Int32)m_pFileSet->get().size()) { - // Fetch ueber Index + // Fetch via Index ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],sal_False,bRetrieveData); // now set the bookmark for outside @@ -1115,24 +1106,22 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); } } - else // Index muss weiter aufgebaut werden + else // Index must be further constructed { - // Zunaechst auf die letzte bekannte Zeile setzen + // set first on the last known row if (!m_pFileSet->get().empty()) { m_aFileSetIter = m_pFileSet->get().end()-1; - // m_pFileSet->SeekPos(m_pFileSet->size()-1); m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos); } sal_Bool bOK = sal_True; - // Ermitteln der Anzahl weiterer Fetches + // Determine the number of further Fetches while (bOK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size()) { if (m_pEvaluationKeySet) { if (m_nRowPos >= (sal_Int32)m_pEvaluationKeySet->size()) return sal_False; - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); else if (m_nRowPos == 0) { m_aEvaluateIter = m_pEvaluationKeySet->begin(); @@ -1150,8 +1139,8 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 if (bOK) { - // jetzt nochmal die Ergebnisse lesen - m_pTable->fetchRow(m_aRow, m_pTable->getTableColumns().getBody(), sal_True,bRetrieveData); + // read the results again + m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), sal_True,bRetrieveData); // now set the bookmark for outside *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1); @@ -1161,14 +1150,10 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); } } - else if (!m_pFileSet->isFrozen()) // keinen gueltigen Satz gefunden + else if (!m_pFileSet->isFrozen()) // no valid record found { - //m_pFileSet->Freeze(); m_pFileSet->setFrozen(); - - // DELETEZ(m_pEvaluationKeySet); m_pEvaluationKeySet = NULL; - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); goto Error; } } @@ -1177,7 +1162,7 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 } else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && isCount()) { - // Fetch des COUNT(*) + // Fetch the COUNT(*) switch (eCursorPosition) { case IResultSetHelper::NEXT: @@ -1205,8 +1190,8 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 goto Error; else if (m_nRowPos == 0) { - // COUNT(*) in Ergebnisrow packen - // (muss die erste und einzige Variable in der Row sein) + // put COUNT(*) in result-row + // (must be the first and only variable in the row) if (m_aRow->get().size() >= 2) { *(m_aRow->get())[1] = m_nRowCountResult; @@ -1223,14 +1208,14 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 } } else - // Fetch nur bei SELECT moeglich! + // Fetch only possible at SELECT! return sal_False; return sal_True; Error: - // steht der Cursor vor dem ersten Satz - // dann wird die position beibehalten + // is the Cursor positioned before the first row + // then the position will be maintained if (nTempPos == -1) m_nRowPos = nTempPos; else @@ -1246,17 +1231,14 @@ Error: case IResultSetHelper::ABSOLUTE: case IResultSetHelper::RELATIVE: if (nOffset > 0) - m_nRowPos = m_pFileSet.isValid() ? (sal_Int32)m_pFileSet->get().size() : -1; + m_nRowPos = m_pFileSet.is() ? (sal_Int32)m_pFileSet->get().size() : -1; else if (nOffset < 0) m_nRowPos = -1; break; case IResultSetHelper::BOOKMARK: - m_nRowPos = nTempPos; // vorherige Position + m_nRowPos = nTempPos; // last Position } } - // delete pGuard; - // rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ? // keine Anzeige von geloeschten Saetzen - // OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE; return sal_False; } // ------------------------------------------------------------------------- @@ -1265,11 +1247,11 @@ void OResultSet::sortRows() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" ); if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1) { - // Ist nur ein Feld fuer die Sortierung angegeben - // Und diese Feld ist indiziert, dann den Index ausnutzen + // is just one field given for sorting + // and this field is indexed, then the Index will be used Reference<XIndexesSupplier> xIndexSup; m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= xIndexSup; - // Reference<XIndexesSupplier> xIndexSup(m_pTable,UNO_QUERY); + Reference<XIndexAccess> xIndexes; if(xIndexSup.is()) { @@ -1324,10 +1306,10 @@ void OResultSet::sortRows() eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; break; - // Andere Typen sind nicht implementiert (und damit immer sal_False) + // Other types aren't implemented (so they are always FALSE) default: eKeyType[i] = SQL_ORDERBYKEY_NONE; - OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); + OSL_FAIL("OFILECursor::Execute: Datentyp nicht implementiert"); break; } (m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True); @@ -1357,15 +1339,12 @@ void OResultSet::sortRows() } } - // Sortiertes Keyset erzeugen - // DELETEZ(m_pEvaluationKeySet); + // create sorted Keyset m_pEvaluationKeySet = NULL; m_pFileSet = NULL; m_pFileSet = m_pSortIndex->CreateKeySet(); - // if(!bDistinct) - // SetRowCount(pFileSet->count()); DELETEZ(m_pSortIndex); - // Nun kann ueber den Index sortiert zugegriffen werden. + // now access to a sorted set is possible via Index } @@ -1405,17 +1384,14 @@ sal_Bool OResultSet::OpenImpl() m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; - // Neuen Index aufbauen: + // create new Index: m_pFileSet = NULL; - // DELETEZ(m_pEvaluationKeySet); - // An den Anfang positionieren + // position at the beginning m_nRowPos = -1; m_nFilePos = 0; m_nRowCountResult = -1; - // exclusiver zugriff auf die Tabelle - // vos::OGuard* pGuard = pTable->Lock(); m_nLastVisitedPos = m_pTable->getCurrentLastPos(); switch(m_aSQLIterator.getStatementType()) @@ -1428,8 +1404,8 @@ sal_Bool OResultSet::OpenImpl() lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this); m_nRowCountResult = 0; - // Vorlaeufig einfach ueber alle Datensaetze iterieren und - // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + // for now simply iterate over all rows and + // do all actions (or just count) { sal_Bool bOK = sal_True; if (m_pEvaluationKeySet) @@ -1456,11 +1432,9 @@ sal_Bool OResultSet::OpenImpl() } } - // Ergebnis von COUNT(*) in m_nRowCountResult merken. - // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser - // Anfrage = 1! + // save result of COUNT(*) in m_nRowCountResult. + // nRowCount (number of Rows in the result) = 1 for this request! m_pEvaluationKeySet = NULL; - // DELETEZ(m_pEvaluationKeySet); } } else @@ -1476,7 +1450,7 @@ sal_Bool OResultSet::OpenImpl() // Sort on all columns, saving original order for later if(IsSorted()) { - aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end()); + aOrderbyColumnNumberSave = m_aOrderbyColumnNumber; m_aOrderbyColumnNumber.clear(); aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end()); bWasSorted = sal_True; @@ -1485,7 +1459,6 @@ sal_Bool OResultSet::OpenImpl() // the first column is the bookmark column ::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1); ::std::copy(aColStart, m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber)); -// m_aOrderbyColumnNumber.assign(aColStart, m_aColMapping.end()); m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC); bDistinct = sal_True; } @@ -1493,14 +1466,13 @@ sal_Bool OResultSet::OpenImpl() if (IsSorted()) sortRows(); - if (!m_pFileSet.isValid()) + if (!m_pFileSet.is()) { m_pFileSet = new OKeySet(); if (!m_pSQLAnalyzer->hasRestriction()) - // jetzt kann das Keyset schon gefuellt werden! - // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n - // abgelegt werden! + // now the Keyset can be filled! + // But be careful: It is assumed, that the FilePositions will be stored as sequence 1..n { if ( m_nLastVisitedPos > 0) m_pFileSet->get().reserve( m_nLastVisitedPos ); @@ -1508,9 +1480,9 @@ sal_Bool OResultSet::OpenImpl() m_pFileSet->get().push_back(i + 1); } } - OSL_ENSURE(m_pFileSet.isValid(),"Kein KeySet vorhanden! :-("); + OSL_ENSURE(m_pFileSet.is(),"Kein KeySet vorhanden! :-("); - if(bDistinct && m_pFileSet.isValid()) // sicher ist sicher + if(bDistinct && m_pFileSet.is()) { OValueRow aSearchRow = new OValueVector(m_aRow->get().size()); OValueRefVector::Vector::iterator aRowIter = m_aRow->get().begin(); @@ -1542,7 +1514,6 @@ sal_Bool OResultSet::OpenImpl() copyFrom != m_aSelectRow->get().end(); ++copyFrom,++copyTo) *copyTo = *(*copyFrom); - // *aSearchRow = *m_aRow; } // compare with next row @@ -1588,17 +1559,16 @@ sal_Bool OResultSet::OpenImpl() ::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end()); } } - // SetRowCount(m_pFileSet->count()); } } } break; case SQL_STATEMENT_UPDATE: case SQL_STATEMENT_DELETE: - // waehrend der Bearbeitung die Anzahl der bearbeiteten Rows zaehlen: + // during processing count the number of processed Rows m_nRowCountResult = 0; - // Vorlaeufig einfach ueber alle Datensaetze iterieren und - // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + // for now simply iterate over all rows and + // run the actions (or simply count): { sal_Bool bOK = sal_True; @@ -1626,19 +1596,16 @@ sal_Bool OResultSet::OpenImpl() } } - // Ergebnis von COUNT(*) in nRowCountResult merken. - // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser - // Anfrage = 1! - // DELETEZ(m_pEvaluationKeySet); + // save result of COUNT(*) in nRowCountResult. + // nRowCount (number of rows in the result-set) = 1 for this request! m_pEvaluationKeySet = NULL; } - // SetRowCount(1); break; case SQL_STATEMENT_INSERT: m_nRowCountResult = 0; - OSL_ENSURE(m_aAssignValues.isValid(),"No assign values set!"); - if(!m_pTable->InsertRow(m_aAssignValues.getBody(), sal_True,m_xColsIdx)) + OSL_ENSURE(m_aAssignValues.is(),"No assign values set!"); + if(!m_pTable->InsertRow(*m_aAssignValues, sal_True,m_xColsIdx)) { m_nFilePos = 0; return sal_False; @@ -1647,11 +1614,11 @@ sal_Bool OResultSet::OpenImpl() m_nRowCountResult = 1; break; default: - OSL_ENSURE( false, "OResultSet::OpenImpl: unsupported statement type!" ); + OSL_FAIL( "OResultSet::OpenImpl: unsupported statement type!" ); break; } - // FilePos zuruecksetzen + // reset FilePos m_nFilePos = 0; return sal_True; @@ -1685,7 +1652,7 @@ sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru // ----------------------------------------------------------------------------- void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, const OValueRefRow& _rSelectRow, - const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, + const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns, const Reference<XIndexAccess>& _xNames, sal_Bool _bSetColumnMapping, const Reference<XDatabaseMetaData>& _xMetaData, @@ -1757,7 +1724,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, } catch (Exception&) { - OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!"); + OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!"); } } // in this case we got more select columns as columns exist in the table @@ -1852,7 +1819,7 @@ void OResultSet::clearInsertRow() void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::initializeRow" ); - if(!_rRow.isValid()) + if(!_rRow.is()) { _rRow = new OValueRefVector(_nColumnCount); (_rRow->get())[0]->setBound(sal_True); @@ -1893,7 +1860,6 @@ sal_Bool OResultSet::isRowDeleted() const void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" ); - // Reference<XInterface> xInt = m_pTable; Reference<XPropertySet> xProp = m_pTable; if(m_pTable && Source.Source == xProp) { @@ -1902,3 +1868,5 @@ void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeE } } // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx index 3e3befaa2430..6d75d6f67357 100644 --- a/connectivity/source/drivers/file/FResultSetMetaData.cxx +++ b/connectivity/source/drivers/file/FResultSetMetaData.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. @@ -46,7 +47,7 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; // ------------------------------------------------------------------------- -OResultSetMetaData::OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,const ::rtl::OUString& _aTableName,OFileTable* _pTable) +OResultSetMetaData::OResultSetMetaData(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,const ::rtl::OUString& _aTableName,OFileTable* _pTable) :m_aTableName(_aTableName) ,m_xColumns(_rxColumns) ,m_pTable(_pTable) @@ -217,3 +218,4 @@ sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLEx } // ------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 929fc1524337..63584d0a194b 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.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. @@ -134,7 +135,7 @@ void OStatement_BASE2::disposing() if(m_pSQLAnalyzer) m_pSQLAnalyzer->dispose(); - if(m_aRow.isValid()) + if(m_aRow.is()) { m_aRow->get().clear(); m_aRow = NULL; @@ -362,7 +363,7 @@ sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& sql ) throw void SAL_CALL OStatement_Base::disposing(void) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::disposing" ); - if(m_aEvaluateRow.isValid()) + if(m_aEvaluateRow.is()) { m_aEvaluateRow->get().clear(); m_aEvaluateRow = NULL; @@ -429,29 +430,19 @@ void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef, aColumnName = pColumnRef->getChild(0)->getTokenValue(); else if (pColumnRef->count() == 3) { - // Nur die Table Range-Variable darf hier vorkommen: -// if (!(pColumnRef->getChild(0)->getTokenValue() == aTableRange)) -// { -// aStatus.Set(SQL_STAT_ERROR, -// String::CreateFromAscii("S1000"), -// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_INVALID_RANGE_VAR))), -// 0, String() ); - // return; - // } pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False ); } else { - // aStatus.SetStatementTooComplex(); throw SQLException(); } Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY); if(!xColLocate.is()) return; - // Alles geprueft und wir haben den Namen der Column. - // Die wievielte Column ist das? - ::vos::ORef<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns(); + // Everything tested and we have the name of the Column. + // What number is the Column? + ::rtl::Reference<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns(); ::comphelper::UStringMixEqual aCase; OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase); if ( aFind == aSelectColumns->get().end() ) @@ -546,7 +537,7 @@ void OStatement_Base::createColumnMapping() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createColumnMapping" ); // initialize the column index map (mapping select columns to table columns) - ::vos::ORef<connectivity::OSQLColumns> xColumns = m_aSQLIterator.getSelectColumns(); + ::rtl::Reference<connectivity::OSQLColumns> xColumns = m_aSQLIterator.getSelectColumns(); m_aColMapping.resize(xColumns->get().size() + 1); for (sal_Int32 i=0; i<(sal_Int32)m_aColMapping.size(); ++i) m_aColMapping[i] = i; @@ -571,7 +562,7 @@ void OStatement_Base::initializeResultSet(OResultSet* _pResult) _pResult->setSelectRow(m_aSelectRow); m_pSQLAnalyzer->bindSelectRow(m_aRow); - m_pEvaluationKeySet = m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Werte im Code des Compilers setzen + m_pEvaluationKeySet = m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Set values in the code of the Compiler _pResult->setEvaluationKeySet(m_pEvaluationKeySet); } // ----------------------------------------------------------------------------- @@ -585,12 +576,12 @@ void OStatement_Base::GetAssignValues() } if (SQL_ISRULE(m_pParseTree,select_statement)) - // Keine zu setzenden Werte bei SELECT + // no values have to be set for SELECT return; else if (SQL_ISRULE(m_pParseTree,insert_statement)) { - // Row fuer die zu setzenden Werte anlegen (Referenz durch new) - if(m_aAssignValues.isValid()) + // Create Row for the values to be set (Reference trough new) + if(m_aAssignValues.is()) m_aAssignValues->get().clear(); sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount(); m_aAssignValues = new OAssignValues(nCount); @@ -599,7 +590,7 @@ void OStatement_Base::GetAssignValues() m_aParameterIndexes.resize(nCount+1,SQL_NO_PARAMETER); - // Liste der Columns-Namen, die in der column_commalist vorkommen (mit ; getrennt): + // List of Column-Names, that exist in the column_commalist (seperated by ;): ::std::vector<String> aColumnNameList; OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); @@ -624,7 +615,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Fehler im Parse Tree"); OSL_ENSURE(pColumnCommalist->count() > 0,"OResultSet: Fehler im Parse Tree"); - // Alle Columns in der column_commalist ... + // All Columns in the column_commalist ... for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) { OSQLParseNode * pCol = pColumnCommalist->getChild(i); @@ -635,19 +626,19 @@ void OStatement_Base::GetAssignValues() if ( aColumnNameList.empty() ) throwFunctionSequenceException(*this); - // Werte ... + // Values ... OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4); OSL_ENSURE(pValuesOrQuerySpec != NULL,"OResultSet: pValuesOrQuerySpec darf nicht NULL sein!"); OSL_ENSURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)"); OSL_ENSURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0"); - // nur "VALUES" ist erlaubt ... + // just "VALUES" is allowed ... if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES)) throwFunctionSequenceException(*this); OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4"); - // Liste von Werten + // List of values OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2); OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!"); OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0"); @@ -661,7 +652,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); if(SQL_ISRULE(pRow_Value_Const,parameter)) { - ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife + ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // only one Columnname allowed per loop } else if(pRow_Value_Const->isToken()) ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i)); @@ -679,7 +670,7 @@ void OStatement_Base::GetAssignValues() } else if (SQL_ISRULE(m_pParseTree,update_statement_searched)) { - if(m_aAssignValues.isValid()) + if(m_aAssignValues.is()) m_aAssignValues->get().clear(); sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount(); m_aAssignValues = new OAssignValues(nCount); @@ -695,7 +686,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Fehler im Parse Tree"); OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0"); - // Alle Zuweisungen (Kommaliste) bearbeiten ... + // work on all assignments (commalist) ... ::std::vector< String> aList(1); for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++) { @@ -712,7 +703,6 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != SQL_NODE_COMPARISON"); if (pComp->getTokenValue().toChar() != '=') { - // aStatus.SetInvalidStatement(); throwFunctionSequenceException(*this); } @@ -737,19 +727,18 @@ void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNam pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_INTNUM || pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_APPROXNUM) { - // Wert setzen: + // set value: SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue()); } else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL)) { - // NULL setzen + // set NULL SetAssignValue(aColumnName, String(), sal_True); } else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter)) parseParamterElem(aColumnName,pRow_Value_Constructor_Elem); else { - // aStatus.SetStatementTooComplex(); throwFunctionSequenceException(*this); } } @@ -763,35 +752,29 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, Reference<XPropertySet> xCol; m_xColNames->getByName(aColumnName) >>= xCol; sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName); - // Kommt diese Column ueberhaupt in der Datei vor? + // does this column actually exist in the file? if (!xCol.is()) { - // Diese Column gibt es nicht! -// aStatus.Set(SQL_STAT_ERROR, -// String::CreateFromAscii("S0022"), -// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_COLUMN_NOT_FOUND))), -// 0, String() ); + // This Column doesn't exist! throwFunctionSequenceException(*this); } - // Value an die Row mit den zuzuweisenden Werten binden: - // const ODbVariantRef& xValue = (*aAssignValues)[pFileColumn->GetId()]; - // Alles geprueft und wir haben den Namen der Column. - // Jetzt eine Value allozieren, den Wert setzen und die Value an die Row binden. + // Everything tested and we have the names of the Column. + // Now allocate one Value, set the value and tie the value to the Row. if (bSetNull) (m_aAssignValues->get())[nId]->setNull(); else { switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { - // Kriterium je nach Typ als String oder double in die Variable packen ... + // put criteria depending on the Type as String or double in the variable case DataType::CHAR: case DataType::VARCHAR: case DataType::LONGVARCHAR: *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); - // Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde + //Characterset is already converted, since the entire statement was converted break; case DataType::BIT: @@ -802,7 +785,6 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, *(m_aAssignValues->get())[nId] = sal_False; else { - // aStatus.Set(SQL_STAT_ERROR); // nyi: genauer! throwFunctionSequenceException(*this); } } @@ -818,24 +800,15 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, case DataType::TIME: case DataType::TIMESTAMP: { - *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); // .ToDouble -// try -// { -// double n = xValue->toDouble(); -// xValue->setDouble(n); -// } -// catch ( ... ) -// { -// aStatus.SetDriverNotCapableError(); -// } + *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); } break; default: throwFunctionSequenceException(*this); } } - // Parameter-Nr. merken (als User Data) - // SQL_NO_PARAMETER = kein Parameter. + // save Parameter-No. (as User Data) + // SQL_NO_PARAMETER = no Parameter. m_aAssignValues->setParameterIndex(nId,nParameter); if(nParameter != SQL_NO_PARAMETER) m_aParameterIndexes[nParameter] = nId; @@ -851,3 +824,5 @@ void OStatement_Base::parseParamterElem(const String& /*_sColumnName*/,OSQLParse // ============================================================================= }// namespace connectivity // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 0ef8fcb99b1d..d5a9eea0407b 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.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. @@ -265,3 +266,4 @@ ORowSetValue OOp_Right::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) return sRet.copy(sRet.getLength()-nCount,nCount); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 4d10d97b24b5..ddf70610939b 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.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. @@ -102,7 +103,7 @@ void OFileTable::refreshColumns() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshColumns" ); TStringVector aVector; Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), - m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); + m_SchemaName,m_Name,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"))); if(xResult.is()) { @@ -225,13 +226,13 @@ sal_Bool OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRo void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& /*descriptor*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::addColumn" ); - OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); + OSL_FAIL( "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- void OFileTable::dropColumn(sal_Int32 /*_nPos*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::dropColumn" ); - OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); + OSL_FAIL( "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- @@ -255,3 +256,4 @@ void OFileTable::refreshHeader() } // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx index 7ac21ef50668..b5d918f1f0d9 100644 --- a/connectivity/source/drivers/file/FTables.cxx +++ b/connectivity/source/drivers/file/FTables.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. @@ -35,12 +36,7 @@ #include <com/sun/star/sdbc/KeyRule.hpp> #include <com/sun/star/sdbcx/KeyType.hpp> #include "file/FCatalog.hxx" -#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ #include "file/FConnection.hxx" -#endif -//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ -//#include "file/FEmptyCollection.hxx" -//#endif using namespace connectivity; using namespace connectivity::file; @@ -81,3 +77,5 @@ Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeExceptio return OTables_BASE::queryInterface(rType); } // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 04df24ab379e..6cc7b6eaccb3 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.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. @@ -92,9 +93,9 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) || SQL_ISRULE(pColumnRef,factor) || SQL_ISRULE(pColumnRef,set_fct_spec) ) { - ::vos::ORef<OPredicateCompiler> pCompiler = new OPredicateCompiler(this); + ::rtl::Reference<OPredicateCompiler> pCompiler = new OPredicateCompiler(this); pCompiler->setOrigColumns(m_aCompiler->getOrigColumns()); - ::vos::ORef<OPredicateInterpreter> pInterpreter = new OPredicateInterpreter(pCompiler); + ::rtl::Reference<OPredicateInterpreter> pInterpreter = new OPredicateInterpreter(pCompiler); pCompiler->execute( pColumnRef ); m_aSelectionEvaluations.push_back( TPredicates(pCompiler,pInterpreter) ); } @@ -133,10 +134,9 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) //------------------------------------------------------------------ void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList) { - // Zaehlen, wieviele Kriterien - // wenn nur ein Kriterium, und das entsprechende Feld ist indiziert - // dann wird der Index verwendet - + // count criteria + // if only one criterion, and the corresponding field is indexed + // then the index will be used OEvaluateSet* pEvaluateSet = NULL; for (OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter) @@ -171,7 +171,7 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) OEvaluateSetList aEvaluateSetList; for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter) { - if ( aIter->first.isValid() ) + if ( aIter->first.is() ) bindRow( aIter->first->m_aCodeList,_pRow,aEvaluateSetList); } } @@ -184,10 +184,10 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) ::std::vector<sal_Int32>* pKeySet = NULL; OEvaluateSet* pEvaluateSet = NULL; - // Keyset erzeugen mit kleinster Liste + // create Keyset with smallest list if(!aEvaluateSetList.empty()) { - // welche Liste hat den kleinsten count ? + // which list has the smallest count? OEvaluateSetList::iterator i = aEvaluateSetList.begin(); pEvaluateSet = *(i); for(++i; i != aEvaluateSetList.end();++i) @@ -206,7 +206,7 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) (*pKeySet)[k] = j->second; } - // alle loeschen + // delete all for(i = aEvaluateSetList.begin(); i != aEvaluateSetList.end();++i) delete (*i); } @@ -215,26 +215,26 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) } //------------------------------------------------------------------ -void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns) +void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns) { OCodeList& rCodeList = m_aCompiler->m_aCodeList; OCodeStack aCodeStack; if (!rCodeList.size()) - return; // kein Praedikat + return; // no predicate if (!rParameterColumns->get().size()) - return; // keine Parameter + return; // no parameters - // Anlegen von Columns, die eine genauere Beschreibung fuer die enthalten - ::vos::ORef<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns); + // Create columns, that have a more precise description for the included + ::rtl::Reference<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns); - // Anlegen einer Testzeile, wird benoetigt um die Parameter zu beschreiben + // Create a Test-row, is needed to describe the parameters OValueRefRow aParameterRow = new OValueRefVector(rParameterColumns->get().size()); bindParameterRow(aParameterRow); OValueRefRow aTestRow = new OValueRefVector(Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getCount()); - delete bindEvaluationRow(aTestRow); // Binden der Attribute an die Values + delete bindEvaluationRow(aTestRow); // Bind the attributes to the values for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter) { @@ -244,10 +244,10 @@ void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns) aCodeStack.push(pOperand); else { - if (pOperator->getRequestedOperands() == 2) // bei zwei Operatoren ist es moeglich - { // einen Parameter weiter zu spezifizieren + if (pOperator->getRequestedOperands() == 2) // with two Operands it is possible + { // to specify one parameter better OOperandParam *pParam = PTR_CAST(OOperandParam,aCodeStack.top()); - if (pParam) // Anpassen des ParameterTyps, wenn der linke Operand ein Attribut ist + if (pParam) // adjust the Parameter-types, if the left Operand is an attribute { OOperandAttr *pLeft = PTR_CAST(OOperandAttr,*(rCodeList.end() - 2)); if (pLeft) @@ -270,10 +270,9 @@ void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns) if (IS_TYPE(OOperandResult,pOperand)) delete pOperand; else - OSL_ENSURE(0,"Illegal here!"); + OSL_FAIL("Illegal here!"); rParameterColumns = aNewParamColumns; - // m_aCompiler->setParameterColumns(rParameterColumns); } // ----------------------------------------------------------------------------- @@ -296,7 +295,7 @@ sal_Bool OSQLAnalyzer::hasFunctions() const m_bSelectionFirstTime = sal_False; for ( ::std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end() && !m_bHasSelectionCode ;++aIter) { - if ( aIter->first.isValid() ) + if ( aIter->first.is() ) m_bHasSelectionCode = aIter->first->hasCode(); } } @@ -308,7 +307,7 @@ void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std: sal_Int32 nPos = 1; for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter,++nPos) { - if ( aIter->second.isValid() ) + if ( aIter->second.is() ) { // the first column (index 0) is for convenience only. The first real select column is no 1. sal_Int32 map = nPos; @@ -325,7 +324,7 @@ void OSQLAnalyzer::dispose() m_aCompiler->dispose(); for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter) { - if ( aIter->first.isValid() ) + if ( aIter->first.is() ) aIter->first->dispose(); } } @@ -335,8 +334,10 @@ void OSQLAnalyzer::setOrigColumns(const OFileColumns& rCols) m_aCompiler->setOrigColumns(rCols); for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter) { - if ( aIter->first.isValid() ) + if ( aIter->first.is() ) aIter->first->setOrigColumns(rCols); } } // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 57b562664026..bd408cd28c29 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.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. @@ -42,13 +43,8 @@ using namespace ::comphelper; using namespace connectivity; using namespace connectivity::file; -//using namespace ::com::sun::star::uno; -//using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; -//using namespace ::com::sun::star::container; -//using namespace ::com::sun::star::beans; -//using namespace ::com::sun::star::sdbcx; TYPEINIT0(OCode); TYPEINIT1(OOperand, OCode); @@ -101,23 +97,23 @@ OOperandRow::OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType) void OOperandRow::bindValue(const OValueRefRow& _pRow) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::OOperandRow" ); - OSL_ENSURE(_pRow.isValid(),"NO EMPTY row allowed!"); + OSL_ENSURE(_pRow.is(),"NO EMPTY row allowed!"); m_pRow = _pRow; - OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); + OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); (m_pRow->get())[m_nRowPos]->setBound(sal_True); } // ----------------------------------------------------------------------------- void OOperandRow::setValue(const ORowSetValue& _rVal) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::setValue" ); - OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); + OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); (*(m_pRow->get())[m_nRowPos]) = _rVal; } //------------------------------------------------------------------ const ORowSetValue& OOperandRow::getValue() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::getValue" ); - OSL_ENSURE(m_pRow.isValid() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); + OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()"); return (m_pRow->get())[m_nRowPos]->getValue(); } @@ -134,7 +130,7 @@ sal_Bool OOperandAttr::isIndexed() const } //------------------------------------------------------------------ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) - : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Typ + : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Type { OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument ist kein Parameter"); OSL_ENSURE(pNode->count() > 0,"Fehler im Parse Tree"); @@ -147,20 +143,18 @@ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) aParameterName = pNode->getChild(1)->getTokenValue(); else { - OSL_ASSERT("Fehler im Parse Tree"); + OSL_FAIL("Fehler im Parse Tree"); } - // Parameter-Column aufsetzen mit defult typ, kann zu einem spaeteren Zeitpunkt ueber DescribeParameter - // genauer spezifiziert werden + // set up Parameter-Column with default type, can be specified more precisely later using Describe-Parameter - // Identitaet merken (hier eigentlich nicht erforderlich, aber aus - // Symmetriegruenden ...) + // save Identity (not escpecially necessary here, just for the sake of symmetry) // todo // OColumn* pColumn = new OFILEColumn(aParameterName,eDBType,255,0,SQL_FLAGS_NULLALLOWED); // rParamColumns->AddColumn(pColumn); - // der Wert wird erst kurz vor der Auswertung gesetzt + // the value will be set just before the evaluation } @@ -206,7 +200,7 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin } else { - OSL_ASSERT("Parse Error"); + OSL_FAIL("Parse Error"); } m_aValue.setBound(sal_True); } @@ -347,7 +341,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con sal_Bool bResult = sal_False; sal_Int32 eDBType = pLeft->getDBType(); - // Vergleich (je nach Datentyp): + // Comparison (depending on Data-type): switch (eDBType) { case DataType::CHAR: @@ -517,3 +511,4 @@ sal_uInt16 OUnaryOperator::getRequestedOperands() const {return 1;} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 28cdb41931d6..903fecd21524 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.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. @@ -57,7 +58,6 @@ using namespace ::com::sun::star::util; DBG_NAME(OPredicateCompiler) //------------------------------------------------------------------ OPredicateCompiler::OPredicateCompiler(OSQLAnalyzer* pAnalyzer)//,OCursor& rCurs) - // : m_rCursor(rCurs) : m_pAnalyzer(pAnalyzer) , m_nParamCounter(0) , m_bORCondition(sal_False) @@ -78,17 +78,15 @@ void OPredicateCompiler::dispose() m_orgColumns = NULL; m_xIndexes.clear(); } -//------------------------------------------------------------------ -// inline OCursor& OPredicateCompiler::Cursor() const {return m_rCursor;} -//------------------------------------------------------------------ + void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) { if (!pSQLParseNode) return; m_nParamCounter = 0; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf WHERE-Klausel setzen: + // analyse Parse Tree (depending on Statement-type) + // and set pointer on WHERE-clause: OSQLParseNode * pWhereClause = NULL; OSQLParseNode * pOrderbyClause = NULL; @@ -118,6 +116,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pTableExp->getChild(1); pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS); + (void)pOrderbyClause; } else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) { @@ -130,12 +129,12 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pSQLParseNode->getChild(3); } else - // Anderes Statement. Keine Selektionskriterien. + // Other Statement. no selection-criteria return; if (SQL_ISRULE(pWhereClause,where_clause)) { - // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: + // a where-clause is not allowed to be empty: DBG_ASSERT(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree"); OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); @@ -145,8 +144,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) } else { - // Die Where Clause ist meistens optional, d. h. es koennte sich auch - // um "optional_where_clause" handeln. + // The where-clause is optionally in the majority of cases, i.e. it might be an "optional-where-clause". DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OPredicateCompiler: Fehler im Parse Tree"); } } @@ -155,18 +153,18 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) { OOperand* pOperand = NULL; - if (pPredicateNode->count() == 3 && // Ausdruck is geklammert + if (pPredicateNode->count() == 3 && // Expression is bracketed SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"(") && SQL_ISPUNCTUATION(pPredicateNode->getChild(2),")")) { execute(pPredicateNode->getChild(1)); } else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term))) - && // AND/OR-Verknuepfung: + && // AND/OR-linkage: pPredicateNode->count() == 3) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISTOKEN(pPredicateNode->getChild(1),OR)) // OR-Operator { @@ -177,7 +175,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_AND()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree"); } } else if (SQL_ISRULE(pPredicateNode,boolean_factor)) @@ -203,8 +201,8 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) } else if(SQL_ISRULE(pPredicateNode,num_value_exp)) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"+")) { m_aCodeList.push_back(new OOp_ADD()); @@ -213,13 +211,13 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_SUB()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); } } else if(SQL_ISRULE(pPredicateNode,term)) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"*")) { m_aCodeList.push_back(new OOp_MUL()); @@ -228,11 +226,11 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_DIV()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); } } else - pOperand = execute_Operand(pPredicateNode); // jetzt werden nur einfache Operanden verarbeitet + pOperand = execute_Operand(pPredicateNode); // now only simple operands will be processed return pOperand; } @@ -276,7 +274,7 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th else if (pPrec->getNodeType() == SQL_NODE_GREAT) ePredicateType = SQLFilterOperator::GREATER; else - OSL_ENSURE( false, "OPredicateCompiler::execute_COMPARE: unexpected node type!" ); + OSL_FAIL( "OPredicateCompiler::execute_COMPARE: unexpected node type!" ); execute(pPredicateNode->getChild(0)); execute(pPredicateNode->getChild(2)); @@ -472,7 +470,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes); } else - {// Column existiert nicht im Resultset + {// Column doesn't exist in the Result-set const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution( STR_INVALID_COLUMNNAME, "$columnname$", aColumnName @@ -482,7 +480,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr } catch(Exception &) { - OSL_ENSURE(0,"OPredicateCompiler::execute_Operand Exception"); + OSL_FAIL("OPredicateCompiler::execute_Operand Exception"); } } else if (SQL_ISRULE(pPredicateNode,parameter)) @@ -502,7 +500,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr else if((pPredicateNode->count() == 2) && (SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"+") || SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"-")) && pPredicateNode->getChild(1)->getNodeType() == SQL_NODE_INTNUM) - { // falls -1 bzw. +1 vorhanden ist + { // if -1 or +1 is there ::rtl::OUString aValue(pPredicateNode->getChild(0)->getTokenValue()); aValue += pPredicateNode->getChild(1)->getTokenValue(); pOperand = new OOperandConst(*pPredicateNode->getChild(1), aValue); @@ -568,7 +566,7 @@ sal_Bool OPredicateInterpreter::evaluate(OCodeList& rCodeList) OCodeList::iterator aIter = rCodeList.begin(); if (!(*aIter)) - return sal_True; // kein Praedikat + return sal_True; // no Predicate for(;aIter != rCodeList.end();++aIter) { @@ -595,7 +593,7 @@ void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList,ORowSetValueD { OCodeList::iterator aIter = rCodeList.begin(); if (!(*aIter)) - return ; // kein Praedikat + return ; // no Predicate for(;aIter != rCodeList.end();++aIter) { @@ -789,7 +787,7 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) pOperator = new OOp_Second(); break; default: - OSL_ENSURE(0,"Error in switch!"); + OSL_FAIL("Error in switch!"); } break; case SQL_TOKEN_CHAR: @@ -877,7 +875,7 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) pOperator = new OOp_Week(); break; default: - OSL_ENSURE(0,"Error in switch!"); + OSL_FAIL("Error in switch!"); } } break; @@ -924,3 +922,4 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/file.xml b/connectivity/source/drivers/file/file.xml index 9e8fc7e7a095..2d8281bca957 100644..100755 --- a/connectivity/source/drivers/file/file.xml +++ b/connectivity/source/drivers/file/file.xml @@ -17,11 +17,9 @@ <project-build-dependency>cppuhelper</project-build-dependency> <project-build-dependency>cppu</project-build-dependency> <project-build-dependency>sal</project-build-dependency> - <project-build-dependency>vos</project-build-dependency> <runtime-module-dependency>cppuhelper</runtime-module-dependency> <runtime-module-dependency>cppu</runtime-module-dependency> <runtime-module-dependency>sal</runtime-module-dependency> - <runtime-module-dependency>vos</runtime-module-dependency> <runtime-module-dependency>osl</runtime-module-dependency> <runtime-module-dependency>svtools-light1</runtime-module-dependency> <runtime-module-dependency>svtools</runtime-module-dependency> diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk index 6cc615a0cc32..41f061de80ca 100644..100755 --- a/connectivity/source/drivers/file/makefile.mk +++ b/connectivity/source/drivers/file/makefile.mk @@ -45,27 +45,27 @@ CDEFS += -DOOO_DLLIMPLEMENTATION_FILE # --- Files ------------------------------------- EXCEPTIONSFILES=\ - $(SLO)$/FNoException.obj \ - $(SLO)$/FConnection.obj \ - $(SLO)$/FResultSetMetaData.obj \ - $(SLO)$/FColumns.obj \ - $(SLO)$/FTables.obj \ - $(SLO)$/FTable.obj \ $(SLO)$/FCatalog.obj \ + $(SLO)$/FColumns.obj \ + $(SLO)$/FConnection.obj \ + $(SLO)$/FDatabaseMetaData.obj \ + $(SLO)$/FDateFunctions.obj \ + $(SLO)$/FDriver.obj \ + $(SLO)$/FNoException.obj \ + $(SLO)$/FNumericFunctions.obj \ + $(SLO)$/FPreparedStatement.obj \ $(SLO)$/FResultSet.obj \ + $(SLO)$/FResultSetMetaData.obj \ $(SLO)$/FStatement.obj \ - $(SLO)$/FPreparedStatement.obj \ - $(SLO)$/FDatabaseMetaData.obj \ - $(SLO)$/FDriver.obj \ + $(SLO)$/FStringFunctions.obj \ + $(SLO)$/FTable.obj \ + $(SLO)$/FTables.obj \ $(SLO)$/fanalyzer.obj \ - $(SLO)$/fcomp.obj \ - $(SLO)$/fcode.obj + $(SLO)$/fcode.obj \ + $(SLO)$/fcomp.obj SLOFILES=\ $(EXCEPTIONSFILES) \ - $(SLO)$/FStringFunctions.obj \ - $(SLO)$/FDateFunctions.obj \ - $(SLO)$/FNumericFunctions.obj \ $(SLO)$/quotedstring.obj @@ -75,11 +75,11 @@ SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ $(CPPULIB) \ $(CPPUHELPERLIB) \ - $(VOSLIB) \ $(SVLLIB) \ $(TOOLSLIB) \ $(UCBHELPERLIB) \ $(SALLIB) \ + $(SALHELPERLIB) \ $(DBTOOLSLIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index 6abfa8a02e01..2469169a6963 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.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. @@ -44,44 +45,44 @@ namespace connectivity return 0; xub_StrLen nTokCount = 1; - sal_Bool bStart = sal_True; // Stehen wir auf dem ersten Zeichen im Token? - sal_Bool bInString = sal_False; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bStart = sal_True; // Are we on the first character in the Token? + sal_Bool bInString = sal_False; // Are we WITHIN a (cStrDel delimited) String? - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + // Search for String-end after the first not matching character for( xub_StrLen i = 0; i < nLen; ++i ) { const sal_Unicode cChar = m_sString.GetChar(i); if (bStart) { bStart = sal_False; - // Erstes Zeichen ein String-Delimiter? + // First character a String-Delimiter? if ( cChar == cStrDel ) { - bInString = sal_True; // dann sind wir jetzt INNERHALB des Strings! - continue; // dieses Zeichen ueberlesen! + bInString = sal_True; // then we are now WITHIN the string! + continue; // skip this character! } } if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. + // double String-Delimter-character: + ++i; // no string-end, skip next character. } else { - // String-Ende + // String-End bInString = sal_False; } } } // if (bInString) else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + // does the Token-character match, then raise TokCount if ( cChar == cTok ) { ++nTokCount; @@ -102,58 +103,57 @@ namespace connectivity const xub_StrLen nLen = m_sString.Len(); if ( nLen ) { - sal_Bool bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // are we WITHIN a (cStrDel delimited) String? - // Erstes Zeichen ein String-Delimiter? + // First character a String-Delimiter? if (bInString ) - ++nStartPos; // dieses Zeichen ueberlesen! + ++nStartPos; // skip this character! if ( nStartPos >= nLen ) return; sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 ); const sal_Unicode* pStart = pData; - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + // Search until end of string for the first not matching character for( xub_StrLen i = nStartPos; i < nLen; ++i ) { const sal_Unicode cChar = m_sString.GetChar(i); if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - // kein String-Ende, naechstes Zeichen ueberlesen. + // double String Delimiter-character + // no end of string, skip next character. ++i; - *pData++ = m_sString.GetChar(i); // Zeichen gehoert zum Resultat-String + *pData++ = m_sString.GetChar(i); // character belongs to Result-String } else { - // String-Ende + //end of String bInString = sal_False; *pData = 0; } } else { - *pData++ = cChar; // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // character belongs to Result-String } } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok + // does the Token-sign match, then raise nTok if ( cChar == cTok ) { - // Vorzeitiger Abbruch der Schleife moeglich, denn - // wir haben, was wir wollten. + // premature break of loop possible, because we found what we were looking for nStartPos = i+1; break; } else { - *pData++ = cChar; // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // character belongs to Result-String } } } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) @@ -162,3 +162,5 @@ namespace connectivity } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |