Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1564
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/64/1564/1
fdo#57950: More chained appends in dbaccess
And more:
Remove RTL_* macros
Remove ::rtl prefix
Change-Id: I5a68ea61b284eb63c22d376c45e1f3788b1b4b50
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
---
M dbaccess/source/core/api/OptimisticSet.cxx
M dbaccess/source/core/dataaccess/documentcontainer.cxx
M dbaccess/source/core/dataaccess/documentdefinition.cxx
M dbaccess/source/core/inc/composertools.hxx
M dbaccess/source/core/misc/sdbcoretools.cxx
5 files changed, 92 insertions(+), 139 deletions(-)
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index ca6f1b5..a19df84 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -67,19 +67,19 @@
using namespace ::cppu;
using namespace ::osl;
-DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUStringBuffer,TSQLStatements);
+DECLARE_STL_USTRINGACCESS_MAP(OUStringBuffer,TSQLStatements);
namespace
{
- void lcl_fillKeyCondition(const ::rtl::OUString& i_sTableName,const ::rtl::OUString&
i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
+ void lcl_fillKeyCondition(const OUString& i_sTableName,const OUString&
i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
{
- ::rtl::OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
+ OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
if ( rKeyCondition.getLength() )
- rKeyCondition.appendAscii(" AND ");
+ rKeyCondition.append(" AND ");
rKeyCondition.append(i_sQuotedColumnName);
if ( i_aValue.isNull() )
- rKeyCondition.appendAscii(" IS NULL");
+ rKeyCondition.append(" IS NULL");
else
- rKeyCondition.appendAscii(" = ?");
+ rKeyCondition.append(" = ?");
}
}
@@ -91,7 +91,7 @@
const ORowSetValueVector& _aParameterValueForCache,
sal_Int32 i_nMaxRows,
sal_Int32& o_nRowCount)
-
:OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount)
+
:OKeySet(NULL,NULL,OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount)
,m_aSqlParser( _rContext.getUNOContext() )
,m_aSqlIterator( i_xConnection,
Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL )
,m_bResultSetChanged(false)
@@ -105,7 +105,7 @@
DBG_DTOR(OptimisticSet,NULL);
}
-void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString&
i_sRowSetFilter)
+void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const OUString&
i_sRowSetFilter)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com",
"OptimisticSet::construct" );
OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
@@ -117,9 +117,9 @@
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY);
const Reference<XNameAccess> xTables = xTabSup->getTables();
- const Sequence< ::rtl::OUString> aTableNames = xTables->getElementNames();
- const ::rtl::OUString* pTableNameIter = aTableNames.getConstArray();
- const ::rtl::OUString* pTableNameEnd = pTableNameIter + aTableNames.getLength();
+ const Sequence< OUString> aTableNames = xTables->getElementNames();
+ const OUString* pTableNameIter = aTableNames.getConstArray();
+ const OUString* pTableNameEnd = pTableNameIter + aTableNames.getLength();
for( ; pTableNameIter != pTableNameEnd ; ++pTableNameIter)
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
@@ -135,15 +135,15 @@
m_aKeyMap.insert(OKeySetMatrix::value_type(0,keySetValue));
m_aKeyIter = m_aKeyMap.begin();
- ::rtl::OUStringBuffer aFilter = createKeyFilter();
+ OUStringBuffer aFilter = createKeyFilter();
Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
Reference<XSingleSelectQueryComposer>
xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- ::rtl::OUString sQuery = xSourceComposer->getQuery();
+ OUString sQuery = xSourceComposer->getQuery();
xAnalyzer->setElementaryQuery(xSourceComposer->getElementaryQuery());
// check for joins
- ::rtl::OUString aErrorMsg;
+ OUString aErrorMsg;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr<OSQLParseNode> pStatementNode( m_aSqlParser.parseTree( aErrorMsg, sQuery ) );
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -151,7 +151,7 @@
m_aSqlIterator.traverseAll();
fillJoinedColumns_throw(m_aSqlIterator.getJoinConditions());
- const ::rtl::OUString sComposerFilter = m_xComposer->getFilter();
+ const OUString sComposerFilter = m_xComposer->getFilter();
if ( !i_sRowSetFilter.isEmpty() || (!sComposerFilter.isEmpty() && sComposerFilter !=
i_sRowSetFilter) )
{
FilterCreator aFilterCreator;
@@ -179,12 +179,12 @@
if ( m_aJoinedKeyColumns.empty() )
throw SQLException();
// list all cloumns that should be set
- static ::rtl::OUString s_sPara(" = ?");
- ::rtl::OUString aQuote = getIdentifierQuoteString();
+ static OUString s_sPara(" = ?");
+ OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUString aColumnName;
- ::rtl::OUStringBuffer sKeyCondition;
- ::std::map< ::rtl::OUString,bool > aResultSetChanged;
+ OUString aColumnName;
+ OUStringBuffer sKeyCondition;
+ ::std::map< OUString,bool > aResultSetChanged;
TSQLStatements aKeyConditions;
TSQLStatements aIndexConditions;
TSQLStatements aSql;
@@ -196,7 +196,7 @@
{
if ( aResultSetChanged.find( aIter->second.sTableName ) == aResultSetChanged.end() )
aResultSetChanged[aIter->second.sTableName] = false;
- const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aIter->second.sRealName);
+ const OUString sQuotedColumnName = ::dbtools::quoteName( aQuote,aIter->second.sRealName);
if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
aResultSetChanged[aIter->second.sTableName] =
m_aJoinedKeyColumns.find(aIter->second.nPosition) != m_aJoinedKeyColumns.end();
@@ -212,11 +212,10 @@
{
(_rInsertRow->get())[aJoinIter->second] =
(_rInsertRow->get())[aIter->second.nPosition];
}
- ::rtl::OUStringBuffer& rPart = aSql[aIter->second.sTableName];
+ OUStringBuffer& rPart = aSql[aIter->second.sTableName];
if ( rPart.getLength() )
- rPart.appendAscii(", ");
- rPart.append(sQuotedColumnName);
- rPart.append(s_sPara);
+ rPart.append(", ");
+ rPart.append(sQuotedColumnName + s_sPara);
}
}
@@ -226,8 +225,8 @@
if( aKeyConditions.empty() )
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ),
SQL_GENERAL_ERROR, m_xConnection );
- static const ::rtl::OUString s_sUPDATE("UPDATE ");
- static const ::rtl::OUString s_sSET(" SET ");
+ static const OUString s_sUPDATE("UPDATE ");
+ static const OUString s_sSET(" SET ");
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
@@ -238,17 +237,14 @@
if ( aSqlIter->second.getLength() )
{
m_bResultSetChanged = m_bResultSetChanged || aResultSetChanged[aSqlIter->first];
- ::rtl::OUStringBuffer sSql(s_sUPDATE);
- ::rtl::OUString sCatalog,sSchema,sTable;
+ OUString sCatalog,sSchema,sTable;
+ OUStringBuffer sSql(s_sUPDATE + ::dbtools::composeTableNameForSelect( m_xConnection,
sCatalog, sSchema, sTable ) + s_sSET +
+ aSqlIter->second.toString() );
::dbtools::qualifiedNameComponents(xMetaData,aSqlIter->first,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- sSql.append( ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema,
sTable ) );
- sSql.append(s_sSET);
- sSql.append(aSqlIter->second.toString());
- ::rtl::OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
+ OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
if ( rCondition.getLength() )
{
- sSql.appendAscii(" WHERE ");
- sSql.append( rCondition.toString() );
+ sSql.append(" WHERE " + rCondition.toString() );
}
executeUpdate(_rInsertRow ,_rOrginalRow,sSql.makeStringAndClear(),aSqlIter->first);
}
@@ -261,8 +257,8 @@
TSQLStatements aSql;
TSQLStatements aParameter;
TSQLStatements aKeyConditions;
- ::std::map< ::rtl::OUString,bool > aResultSetChanged;
- ::rtl::OUString aQuote = getIdentifierQuoteString();
+ ::std::map< OUString,bool > aResultSetChanged;
+ OUString aQuote = getIdentifierQuoteString();
// here we build the condition part for the update statement
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
@@ -272,7 +268,7 @@
if ( aResultSetChanged.find( aIter->second.sTableName ) == aResultSetChanged.end() )
aResultSetChanged[aIter->second.sTableName] = false;
- const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aIter->second.sRealName);
+ const OUString sQuotedColumnName = ::dbtools::quoteName( aQuote,aIter->second.sRealName);
if ( (_rInsertRow->get())[aIter->second.nPosition].isModified() )
{
if ( m_aJoinedKeyColumns.find(aIter->second.nPosition) != m_aJoinedKeyColumns.end() )
@@ -285,22 +281,22 @@
{
(_rInsertRow->get())[aJoinIter->second] =
(_rInsertRow->get())[aIter->second.nPosition];
}
- ::rtl::OUStringBuffer& rPart = aSql[aIter->second.sTableName];
+ OUStringBuffer& rPart = aSql[aIter->second.sTableName];
if ( rPart.getLength() )
- rPart.appendAscii(", ");
+ rPart.append(", ");
rPart.append(sQuotedColumnName);
- ::rtl::OUStringBuffer& rParam = aParameter[aIter->second.sTableName];
+ OUStringBuffer& rParam = aParameter[aIter->second.sTableName];
if ( rParam.getLength() )
- rParam.appendAscii(", ");
- rParam.appendAscii("?");
+ rParam.append(", ");
+ rParam.append("?");
}
}
if ( aParameter.empty() )
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ),
SQL_GENERAL_ERROR, m_xConnection );
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
- static const ::rtl::OUString s_sINSERT("INSERT INTO ");
- static const ::rtl::OUString s_sVALUES(") VALUES ( ");
+ static const OUString s_sINSERT("INSERT INTO ");
+ static const OUString s_sVALUES(") VALUES ( ");
TSQLStatements::iterator aSqlIter = aSql.begin();
TSQLStatements::iterator aSqlEnd = aSql.end();
for(;aSqlIter != aSqlEnd ; ++aSqlIter)
@@ -308,31 +304,20 @@
if ( aSqlIter->second.getLength() )
{
m_bResultSetChanged = m_bResultSetChanged || aResultSetChanged[aSqlIter->first];
- ::rtl::OUStringBuffer sSql(s_sINSERT);
- ::rtl::OUString sCatalog,sSchema,sTable;
+ OUString sCatalog,sSchema,sTable;
+ OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection,
sCatalog, sSchema, sTable );
+ OUString sSql(s_sINSERT + sComposedTableName + " ( " + aSqlIter->second.toString() +
s_sVALUES +
+ aParameter[aSqlIter->first].toString() + " )");
::dbtools::qualifiedNameComponents(xMetaData,aSqlIter->first,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- ::rtl::OUString sComposedTableName = ::dbtools::composeTableNameForSelect(
m_xConnection, sCatalog, sSchema, sTable );
- sSql.append(sComposedTableName);
- sSql.appendAscii(" ( ");
- sSql.append(aSqlIter->second.toString());
- sSql.append(s_sVALUES);
- sSql.append(aParameter[aSqlIter->first].toString());
- sSql.appendAscii(" )");
- ::rtl::OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
+ OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
if ( rCondition.getLength() )
{
- ::rtl::OUStringBuffer sQuery;
- sQuery.appendAscii("SELECT ");
- sQuery.append(aSqlIter->second.toString());
- sQuery.appendAscii(" FROM ");
- sQuery.append(sComposedTableName);
- sQuery.appendAscii(" WHERE ");
- sQuery.append(rCondition.toString());
+ OUString sQuery("SELECT " + aSqlIter->second.toString() + " FROM " +
sComposedTableName + " WHERE " + rCondition.toString());
try
{
- Reference< XPreparedStatement >
xPrep(m_xConnection->prepareStatement(sQuery.makeStringAndClear()));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(sQuery));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
// and then the values of the where condition
SelectColumnsMetaData::iterator aKeyCol = m_pKeyColumnNames->begin();
@@ -358,16 +343,16 @@
}
}
- executeInsert(_rInsertRow,sSql.makeStringAndClear(),aSqlIter->first);
+ executeInsert(_rInsertRow,sSql,aSqlIter->first);
}
}
}
void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const
connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException)
{
- ::rtl::OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUString aColumnName;
- ::rtl::OUStringBuffer sKeyCondition,sIndexCondition;
+ OUString aQuote = getIdentifierQuoteString();
+ OUString aColumnName;
+ OUStringBuffer sKeyCondition,sIndexCondition;
::std::vector<sal_Int32> aIndexColumnPositions;
TSQLStatements aKeyConditions;
TSQLStatements aIndexConditions;
@@ -381,7 +366,7 @@
if ( m_aJoinedKeyColumns.find(aIter->second.nPosition) == m_aJoinedKeyColumns.end() &&
m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
// only delete rows which aren't the key in the join
- const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aIter->second.sRealName);
+ const OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aIter->second.sRealName);
lcl_fillKeyCondition(aIter->second.sTableName,sQuotedColumnName,(_rDeleteRow->get())[aIter->second.nPosition],aKeyConditions);
}
}
@@ -390,22 +375,19 @@
TSQLStatements::iterator aSqlEnd = aKeyConditions.end();
for(;aSqlIter != aSqlEnd ; ++aSqlIter)
{
- ::rtl::OUStringBuffer& rCondition = aSqlIter->second;
+ OUStringBuffer& rCondition = aSqlIter->second;
if ( rCondition.getLength() )
{
- ::rtl::OUStringBuffer sSql;
- sSql.appendAscii("DELETE FROM ");
- ::rtl::OUString sCatalog,sSchema,sTable;
+ OUString sCatalog,sSchema,sTable;
+ OUString sSql("DELETE FROM " + ::dbtools::composeTableNameForSelect( m_xConnection,
sCatalog, sSchema, sTable ) +
+ " WHERE " + rCondition.toString() );
::dbtools::qualifiedNameComponents(xMetaData,aSqlIter->first,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- sSql.append( ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema,
sTable ) );
- sSql.appendAscii(" WHERE ");
- sSql.append( rCondition.toString() );
- executeDelete(_rDeleteRow,sSql.makeStringAndClear(),aSqlIter->first);
+ executeDelete(_rDeleteRow,sSql,aSqlIter->first);
}
}
}
-void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString&
i_sSQL,const ::rtl::OUString& i_sTableName)
+void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,const
OUString& i_sTableName)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com",
"OptimisticSet::executeDelete" );
@@ -438,21 +420,16 @@
::std::vector< TNodePair >::const_iterator aIter = i_aJoinColumns.begin();
for(;aIter != i_aJoinColumns.end();++aIter)
{
- ::rtl::OUString sColumnName,sTableName;
+ OUString sColumnName,sTableName;
m_aSqlIterator.getColumnRange(aIter->first,sColumnName,sTableName);
- ::rtl::OUStringBuffer sLeft,sRight;
- sLeft.append(sTableName);
- sLeft.appendAscii(".");
- sLeft.append(sColumnName);
+ OUString sLeft(sTableName + "." + sColumnName);
+ OUString sRight(sTableName + "." + sColumnName);
m_aSqlIterator.getColumnRange(aIter->second,sColumnName,sTableName);
- sRight.append(sTableName);
- sRight.appendAscii(".");
- sRight.append(sColumnName);
- fillJoinedColumns_throw(sLeft.makeStringAndClear(),sRight.makeStringAndClear());
+ fillJoinedColumns_throw(sLeft, sRight);
}
}
-void OptimisticSet::fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const
::rtl::OUString& i_sRightColumn)
+void OptimisticSet::fillJoinedColumns_throw(const OUString& i_sLeftColumn,const OUString&
i_sRightColumn)
{
sal_Int32 nLeft = 0,nRight = 0;
SelectColumnsMetaData::const_iterator aLeftIter = m_pKeyColumnNames->find(i_sLeftColumn);
@@ -501,7 +478,7 @@
void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet)
{
- OCacheSet::construct(_xDriverSet,::rtl::OUString());
+ OCacheSet::construct(_xDriverSet,OUString());
m_bRowCountFinal = sal_False;
m_aKeyMap.clear();
OKeySetValue keySetValue((ORowSetValueVector *)NULL,::std::pair<sal_Int32,Reference<XRow>
(0,(Reference<XRow>)NULL));
@@ -538,8 +515,8 @@
};
struct TableNameFunctor : ::std::unary_function<SelectColumnsMetaData::value_type,bool>
{
- ::rtl::OUString m_sTableName;
- TableNameFunctor(const ::rtl::OUString& i_sTableName)
+ OUString m_sTableName;
+ TableNameFunctor(const OUString& i_sTableName)
: m_sTableName(i_sTableName)
{
}
@@ -560,7 +537,7 @@
SelectColumnsMetaData::const_iterator aFind =
::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),PositionFunctor(*aColIdxIter));
if ( aFind != m_pKeyColumnNames->end() )
{
- const ::rtl::OUString sTableName = aFind->second.sTableName;
+ const OUString sTableName = aFind->second.sTableName;
aFind =
::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),TableNameFunctor(sTableName));
while( aFind != m_pKeyColumnNames->end() )
{
@@ -598,7 +575,7 @@
SelectColumnsMetaData::const_iterator aFind =
::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),PositionFunctor(aIter->second.nPosition));
if ( aFind != m_pKeyColumnNames->end() )
{
- const ::rtl::OUString sTableName = aFind->second.sTableName;
+ const OUString sTableName = aFind->second.sTableName;
aFind =
::std::find_if(m_pKeyColumnNames->begin(),m_pKeyColumnNames->end(),TableNameFunctor(sTableName));
while( aFind != m_pKeyColumnNames->end() )
{
@@ -631,21 +608,21 @@
{
TSQLStatements aSql;
TSQLStatements aKeyConditions;
- ::std::map< ::rtl::OUString,bool > aResultSetChanged;
- ::rtl::OUString aQuote = getIdentifierQuoteString();
+ ::std::map< OUString,bool > aResultSetChanged;
+ OUString aQuote = getIdentifierQuoteString();
// here we build the condition part for the update statement
SelectColumnsMetaData::const_iterator aColIter = m_pColumnNames->begin();
SelectColumnsMetaData::const_iterator aColEnd = m_pColumnNames->end();
for(;aColIter != aColEnd;++aColIter)
{
- const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aColIter->second.sRealName);
+ const OUString sQuotedColumnName = ::dbtools::quoteName(
aQuote,aColIter->second.sRealName);
if ( m_aJoinedKeyColumns.find(aColIter->second.nPosition) != m_aJoinedKeyColumns.end() )
{
lcl_fillKeyCondition(aColIter->second.sTableName,sQuotedColumnName,io_aRow[aColIter->second.nPosition],aKeyConditions);
}
- ::rtl::OUStringBuffer& rPart = aSql[aColIter->second.sTableName];
+ OUStringBuffer& rPart = aSql[aColIter->second.sTableName];
if ( rPart.getLength() )
- rPart.appendAscii(", ");
+ rPart.append(", ");
rPart.append(sQuotedColumnName);
}
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
@@ -655,23 +632,17 @@
{
if ( aSqlIter->second.getLength() )
{
- ::rtl::OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
+ OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first];
if ( rCondition.getLength() )
{
- ::rtl::OUString sCatalog,sSchema,sTable;
+ OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,aSqlIter->first,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- ::rtl::OUString sComposedTableName = ::dbtools::composeTableNameForSelect(
m_xConnection, sCatalog, sSchema, sTable );
- ::rtl::OUStringBuffer sQuery;
- sQuery.appendAscii("SELECT ");
- sQuery.append(aSqlIter->second.toString());
- sQuery.appendAscii(" FROM ");
- sQuery.append(sComposedTableName);
- sQuery.appendAscii(" WHERE ");
- sQuery.append(rCondition.makeStringAndClear());
+ OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection,
sCatalog, sSchema, sTable );
+ OUString sQuery("SELECT " + aSqlIter->second.toString() + " FROM " +
sComposedTableName + " WHERE " + rCondition.makeStringAndClear());
try
{
- Reference< XPreparedStatement >
xPrep(m_xConnection->prepareStatement(sQuery.makeStringAndClear()));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(sQuery));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
// and then the values of the where condition
SelectColumnsMetaData::iterator aKeyIter = m_pKeyColumnNames->begin();
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx
b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 311263d..e63ea43 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -649,13 +649,9 @@
return impl_getHierarchicalName( false );
}
-::rtl::OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const ::rtl::OUString&
i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException)
+OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const ::rtl::OUString&
i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException)
{
- ::rtl::OUStringBuffer aBuffer;
- aBuffer.append( getHierarchicalName() );
- aBuffer.append( sal_Unicode( '/' ) );
- aBuffer.append( i_rRelativeName );
- return aBuffer.makeStringAndClear();
+ return OUString ( getHierarchicalName() + "/" + i_rRelativeName );
}
::rtl::Reference<OContentHelper> ODocumentContainer::getContent(const ::rtl::OUString& _sName)
const
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx
b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index d0fd4dc..4bebb96 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -534,14 +534,12 @@
{
if ( i_nHandle == PROPERTY_ID_PERSISTENT_PATH )
{
- ::rtl::OUString sPersistentPath;
+ OUString sPersistentPath;
if ( !m_pImpl->m_aProps.sPersistentName.isEmpty() )
{
- ::rtl::OUStringBuffer aBuffer;
- aBuffer.append( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ?
ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) );
- aBuffer.append( sal_Unicode( '/' ) );
- aBuffer.append( m_pImpl->m_aProps.sPersistentName );
- sPersistentPath = aBuffer.makeStringAndClear();
+ OUString aBuffer(ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ?
ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) +
+ "/" + m_pImpl->m_aProps.sPersistentName );
+ sPersistentPath = aBuffer;
}
o_rValue <<= sPersistentPath;
return;
@@ -1973,13 +1971,9 @@
return impl_getHierarchicalName( false );
}
-::rtl::OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const ::rtl::OUString&
i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException)
+OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const ::rtl::OUString&
i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException)
{
- ::rtl::OUStringBuffer aBuffer;
- aBuffer.append( getHierarchicalName() );
- aBuffer.append( sal_Unicode( '/' ) );
- aBuffer.append( i_rRelativeName );
- return aBuffer.makeStringAndClear();
+ return OUString( getHierarchicalName() + "/" + i_rRelativeName );
}
void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) throw (SQLException,
ElementExistException, RuntimeException)
diff --git a/dbaccess/source/core/inc/composertools.hxx b/dbaccess/source/core/inc/composertools.hxx
index 5549a70..61d50e4 100644
--- a/dbaccess/source/core/inc/composertools.hxx
+++ b/dbaccess/source/core/inc/composertools.hxx
@@ -102,9 +102,7 @@
{
m_aBuffer.insert( 0, (sal_Unicode)' ' );
m_aBuffer.insert( 0, (sal_Unicode)'(' );
- m_aBuffer.appendAscii( " ) AND ( " );
- m_aBuffer.append( lhs );
- m_aBuffer.appendAscii( " )" );
+ m_aBuffer.append( " ) AND ( " + lhs + " )" );
}
};
@@ -115,8 +113,7 @@
{
virtual void appendNonEmptyToNonEmpty( const ::rtl::OUString& lhs )
{
- m_aBuffer.appendAscii( ", " );
- m_aBuffer.append( lhs );
+ m_aBuffer.append( ", " + lhs );
}
};
diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx
index 0f11c15..d971a71 100644
--- a/dbaccess/source/core/misc/sdbcoretools.cxx
+++ b/dbaccess/source/core/misc/sdbcoretools.cxx
@@ -81,9 +81,9 @@
}
// -----------------------------------------------------------------------------
- ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext,
const Any& _rError )
+ OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const Any&
_rError )
{
- ::rtl::OUString sDisplayMessage;
+ OUString sDisplayMessage;
try
{
@@ -108,12 +108,7 @@
Exception aExcept;
_rError >>= aExcept;
- ::rtl::OUStringBuffer aBuffer;
- aBuffer.append( _rError.getValueTypeName() );
- aBuffer.appendAscii( ":\n" );
- aBuffer.append( aExcept.Message );
-
- sDisplayMessage = aBuffer.makeStringAndClear();
+ return OUString(_rError.getValueTypeName() + ":\n" + aExcept.Message);
}
return sDisplayMessage;
--
To view, visit https://gerrit.libreoffice.org/1564
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a68ea61b284eb63c22d376c45e1f3788b1b4b50
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org@gmail.com>
Context
- [PATCH] fdo#57950: More chained appends in dbaccess · Marcos Souza (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.