[Libreoffice-commits] core.git: connectivity/source include/connectivity
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 27 11:02:23 UTC 2021
connectivity/source/parse/sqliterator.cxx | 24 +++++++++++-------------
include/connectivity/sqliterator.hxx | 2 +-
2 files changed, 12 insertions(+), 14 deletions(-)
New commits:
commit b63c5ade3554a42def4bce94f9fd67ea66528214
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 26 20:57:29 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Sep 27 13:01:49 2021 +0200
setSelectColumnName is always called with m_aSelectColumns as 1st arg
Change-Id: If86c4f48ed7eb6860f461fe905c0628cb9b73043
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122657
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 95c0cd875a93..752caa841473 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -852,7 +852,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*"))
{
// SELECT * ...
- setSelectColumnName(m_aSelectColumns, "*", "", "");
+ setSelectColumnName("*", "", "");
}
else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist))
{
@@ -872,7 +872,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
// All the table's columns
OUString aTableRange;
pColumnRef->getChild(0)->parseNodeToStr( aTableRange, m_pImpl->m_xConnection, nullptr, false, false );
- setSelectColumnName(m_aSelectColumns, "*", "", aTableRange);
+ setSelectColumnName("*", "", aTableRange);
continue;
}
else if (SQL_ISRULE(pColumnRef,derived_column))
@@ -924,7 +924,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
*/
if(aColumnAlias.isEmpty())
aColumnAlias = sColumnName;
- setSelectColumnName(m_aSelectColumns,sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
+ setSelectColumnName(sColumnName,aColumnAlias,aTableRange,bFkt,nType,SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec));
}
}
}
@@ -1567,21 +1567,19 @@ void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns> const &
}
}
-void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> const & _rColumns,const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange, bool bFkt, sal_Int32 _nType, bool bAggFkt)
+void OSQLParseTreeIterator::setSelectColumnName(const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange, bool bFkt, sal_Int32 _nType, bool bAggFkt)
{
if(rColumnName.toChar() == '*' && rTableRange.isEmpty())
{ // SELECT * ...
- OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
for (auto const& table : *m_pImpl->m_pTables)
- appendColumns(_rColumns,table.first,table.second);
+ appendColumns(m_aSelectColumns, table.first, table.second);
}
else if( rColumnName.toChar() == '*' && !rTableRange.isEmpty() )
{ // SELECT <table>.*
- OSL_ENSURE(_rColumns == m_aSelectColumns,"Invalid columns used here!");
OSQLTables::const_iterator aFind = m_pImpl->m_pTables->find(rTableRange);
if(aFind != m_pImpl->m_pTables->end())
- appendColumns(_rColumns,rTableRange,aFind->second);
+ appendColumns(m_aSelectColumns, rTableRange, aFind->second);
}
else if ( rTableRange.isEmpty() )
{ // SELECT <something> ...
@@ -1642,7 +1640,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
pColumn->setRealName( rColumnName );
}
- _rColumns->push_back( xNewColumn );
+ m_aSelectColumns->push_back( xNewColumn );
}
else
{
@@ -1655,7 +1653,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
pColumn->setAggregateFunction(bAggFkt);
pColumn->setRealName(rColumnName);
- _rColumns->push_back(pColumn);
+ m_aSelectColumns->push_back(pColumn);
}
}
else // ColumnName and TableName exist
@@ -1679,7 +1677,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
assert(false);
pColumn->setTableName(aFind->first);
- _rColumns->push_back(pColumn);
+ m_aSelectColumns->push_back(pColumn);
}
else
{
@@ -1693,7 +1691,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
pColumn->setRealName(rColumnName);
pColumn->setTableName(aFind->first);
- _rColumns->push_back(pColumn);
+ m_aSelectColumns->push_back(pColumn);
}
else
bError = true;
@@ -1713,7 +1711,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns> co
pColumn->setFunction(true);
pColumn->setAggregateFunction(bAggFkt);
- _rColumns->push_back(pColumn);
+ m_aSelectColumns->push_back(pColumn);
}
}
}
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
index d0f3711e6968..9cb6ce4e9976 100644
--- a/include/connectivity/sqliterator.hxx
+++ b/include/connectivity/sqliterator.hxx
@@ -141,7 +141,7 @@ namespace connectivity
css::uno::Reference< css::beans::XPropertySet > findSelectColumn(
std::u16string_view rColumnName );
- void setSelectColumnName(::rtl::Reference<OSQLColumns> const & _rColumns,const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange, bool bFkt=false, sal_Int32 _nType = css::sdbc::DataType::VARCHAR, bool bAggFkt=false);
+ void setSelectColumnName(const OUString& rColumnName, const OUString& rColumnAlias, const OUString& rTableRange, bool bFkt = false, sal_Int32 _nType = css::sdbc::DataType::VARCHAR, bool bAggFkt = false);
void appendColumns(::rtl::Reference<OSQLColumns> const & _rColumns,const OUString& _rTableAlias,const OSQLTable& _rTable);
// Other member variables that should be available in the "set" functions
// can be defined in the derived class. They can be initialized
More information about the Libreoffice-commits
mailing list