[Libreoffice-commits] core.git: connectivity/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 27 14:38:55 UTC 2021
connectivity/source/parse/sqliterator.cxx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 118b96cd424ec4a02501852e9052131f322d0d36
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 26 21:21:19 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Sep 27 16:38:20 2021 +0200
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 at redhat.com>
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 );
More information about the Libreoffice-commits
mailing list