[Libreoffice-commits] core.git: connectivity/source include/connectivity
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 27 13:43:07 UTC 2021
connectivity/source/parse/sqliterator.cxx | 11 ++++++++++-
include/connectivity/sqliterator.hxx | 3 +++
2 files changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 138c6e793882fcf8477e7e75f7f31d5327022aa5
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 26 21:09:23 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Sep 27 15:42:33 2021 +0200
split getUniqueColumnName
Change-Id: Ibcac473463c02e7ce6f853ac2dcdf953c13c14e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122659
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 f20bef933395..ef7873a6c302 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1716,15 +1716,24 @@ void OSQLParseTreeIterator::setSelectColumnName(const OUString & rColumnName,con
}
}
-OUString OSQLParseTreeIterator::getUniqueColumnName(const OUString& rColumnName) const
+std::vector<OUString> OSQLParseTreeIterator::getSelectColumnNames() const
{
::comphelper::UStringMixLess aCompare(isCaseSensitive());
+
std::vector<OUString> aColumnNames;
OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
for (const auto& col : *m_aSelectColumns)
aColumnNames.push_back(getString(col->getPropertyValue(sPropertyName)));
std::sort(aColumnNames.begin(), aColumnNames.end(), aCompare);
+ return aColumnNames;
+}
+
+OUString OSQLParseTreeIterator::getUniqueColumnName(const OUString& rColumnName) const
+{
+ std::vector<OUString> aColumnNames(getSelectColumnNames());
+
+ ::comphelper::UStringMixLess aCompare(isCaseSensitive());
if (!std::binary_search(aColumnNames.begin(), aColumnNames.end(), rColumnName, aCompare))
return rColumnName;
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
index 9693192a7a04..6c529c69b37f 100644
--- a/include/connectivity/sqliterator.hxx
+++ b/include/connectivity/sqliterator.hxx
@@ -105,6 +105,9 @@ namespace connectivity
const OSQLParseNode* getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, OUString& aTableRange );
void getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, OUString& aTableRange );
void getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
+ // get all the column names of m_aSelectColumns and return in a vector sorted by a UStringMixLess that's constructed from
+ // isCaseSensitive()
+ std::vector<OUString> getSelectColumnNames() const;
OUString getUniqueColumnName(const OUString & rColumnName) const;
/** finds the column with a given name, belonging to a given table, in a given tables collection
More information about the Libreoffice-commits
mailing list