diff options
author | Gil Forcada <gforcada@gnome.org> | 2010-10-12 22:40:56 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-10-13 12:18:30 +0200 |
commit | 2ab6d2bd492320472e33526674923b02876d427d (patch) | |
tree | 2d572fa2c72f43bda922bce38813cda767909dae /dbaccess/source/core/api/OptimisticSet.cxx | |
parent | a3d79e7f7b596f856b5f07ea55779ba8d366a4b3 (diff) |
Removed comments, trailing spaces and death code
Diffstat (limited to 'dbaccess/source/core/api/OptimisticSet.cxx')
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.cxx | 72 |
1 files changed, 23 insertions, 49 deletions
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 31cb0ef1a..088966e73 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -99,7 +99,7 @@ namespace } DBG_NAME(OptimisticSet) -// ------------------------------------------------------------------------- + OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, @@ -112,12 +112,12 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::OptimisticSet" ); DBG_CTOR(OptimisticSet,NULL); } -// ----------------------------------------------------------------------------- + OptimisticSet::~OptimisticSet() { DBG_DTOR(OptimisticSet,NULL); } -// ----------------------------------------------------------------------------- + void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::construct" ); @@ -170,14 +170,14 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const :: m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution()); ::comphelper::disposeComponent(xAnalyzer); } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OptimisticSet::deleteRows( const Sequence< Any >& /*rows*/ ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException) { Sequence< sal_Int32 > aRet; return aRet; } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::updateRow" ); @@ -265,7 +265,7 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow } } } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::insertRow" ); @@ -277,7 +277,7 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); - + // here we build the condition part for the update statement SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin(); SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); @@ -285,7 +285,7 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn { if ( aResultSetChanged.find( aIter->second.sTableName ) == aResultSetChanged.end() ) aResultSetChanged[aIter->second.sTableName] = false; - + const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName( aQuote,aIter->second.sRealName); if ( (_rInsertRow->get())[aIter->second.nPosition].isModified() ) { @@ -364,19 +364,19 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn if ( xRow.is() && xRes->next() ) { m_bResultSetChanged = true; - continue; + continue; } } catch(const SQLException&) { } } - + executeInsert(_rInsertRow,sSql.makeStringAndClear(),aSqlIter->first); } } } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); @@ -422,7 +422,7 @@ void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const conne } } } -// ------------------------------------------------------------------------- + void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::executeDelete" ); @@ -450,41 +450,17 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUS m_bDeleted = sal_True; } } -// ----------------------------------------------------------------------------- + ::rtl::OUString OptimisticSet::getComposedTableName(const ::rtl::OUString& /*_sCatalog*/, const ::rtl::OUString& /*_sSchema*/, const ::rtl::OUString& /*_sTable*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getComposedTableName" ); ::rtl::OUString aComposedName; -/* - Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); - if( xMetaData.is() && xMetaData->supportsTableCorrelationNames() ) - { - aComposedName = ::dbtools::composeTableName( xMetaData, _sCatalog, _sSchema, _sTable, sal_False, ::dbtools::eInDataManipulation ); - // first we have to check if the composed tablename is in the select clause or if an alias is used - Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY); - Reference<XNameAccess> xSelectTables = xTabSup->getTables(); - OSL_ENSURE(xSelectTables.is(),"No Select tables!"); - if(xSelectTables.is()) - { - if(!xSelectTables->hasByName(aComposedName)) - { // the composed name isn't used in the select clause so we have to find out which name is used instead - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(xMetaData,m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ); - } - else - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, _sCatalog, _sSchema, _sTable ); - } - } - else - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, _sCatalog, _sSchema, _sTable ); -*/ return aComposedName; } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_aJoinColumns) { ::std::vector< TNodePair >::const_iterator aIter = i_aJoinColumns.begin(); @@ -503,9 +479,9 @@ void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_ fillJoinedColumns_throw(sLeft.makeStringAndClear(),sRight.makeStringAndClear()); } } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const ::rtl::OUString& i_sRightColumn) -{ +{ sal_Int32 nLeft = 0,nRight = 0; SelectColumnsMetaData::const_iterator aLeftIter = m_pKeyColumnNames->find(i_sLeftColumn); SelectColumnsMetaData::const_iterator aRightIter = m_pKeyColumnNames->find(i_sRightColumn); @@ -543,14 +519,14 @@ void OptimisticSet::fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn else m_aJoinedColumns[nRight] = nLeft; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::isResultSetChanged() const { bool bOld = m_bResultSetChanged; m_bResultSetChanged = false; return bOld; } -// ----------------------------------------------------------------------------- + void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet) { OCacheSet::construct(_xDriverSet,::rtl::OUString()); @@ -559,7 +535,7 @@ void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet) m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL)))); m_aKeyIter = m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + void OptimisticSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns) { o_aChangedColumns.push_back(i_nColumnIndex); @@ -601,7 +577,7 @@ namespace } }; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns) { bool bRet = false; @@ -638,7 +614,7 @@ bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCac } return bRet; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow) { bool bRet = false; @@ -677,7 +653,7 @@ bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow } return bRet; } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const { TSQLStatements aSql; @@ -761,6 +737,4 @@ void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const } } } -// ----------------------------------------------------------------------------- - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |