summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-26 21:21:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-09-27 16:38:20 +0200
commit118b96cd424ec4a02501852e9052131f322d0d36 (patch)
tree6f94e2379c3c6c9f160bdf98725a976d2d77738e /connectivity
parentce89c11c5aa2e01f9827da199c68ab9803e6013e (diff)
fetch the column names once and keep it up to date as new names inserted
Change-Id: Ic865c82c2bbf8cb3be730158c823bd8769038bbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122661 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/parse/sqliterator.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index aed5b6bfcb38..662a000870b7 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1536,10 +1536,12 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
const OUString* pBegin = aColNames.getConstArray();
const OUString* pEnd = pBegin + aColNames.getLength();
+ ::comphelper::UStringMixLess aCompare(isCaseSensitive());
+ std::vector<OUString> aSelectColumnNames = getSelectColumnNames();
+
for(;pBegin != pEnd;++pBegin)
{
-
- OUString aName(getUniqueColumnName(getSelectColumnNames(), *pBegin));
+ OUString aName(getUniqueColumnName(aSelectColumnNames, *pBegin));
Reference< XPropertySet > xColumn;
if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is())
{
@@ -1561,6 +1563,8 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
pColumn->setTableName(_rTableAlias);
pColumn->setRealName(*pBegin);
m_aSelectColumns->push_back(pColumn);
+ // update aSelectColumnNames with newly insert aName
+ aSelectColumnNames.insert(std::upper_bound(aSelectColumnNames.begin(), aSelectColumnNames.end(), aName, aCompare), aName);
}
else
impl_appendError( IParseContext::ErrorCode::InvalidColumn, pBegin, &_rTableAlias );