summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 11:06:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-01 08:30:18 +0200
commit5200a73627d13e2997f81b53f61e143e77e328ee (patch)
treef95c8346d061ecd0ad33d574895d18e169662785 /dbaccess
parentb90d3d316dd9c720c83180b31f6bbd7003fead78 (diff)
use more string_view in various
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.cxx7
-rw-r--r--dbaccess/source/filter/hsqldb/parseschema.cxx11
-rw-r--r--dbaccess/source/ui/dlg/TextConnectionHelper.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx8
4 files changed, 17 insertions, 11 deletions
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx
index cfff560c0de5..360741ce0b28 100644
--- a/dbaccess/source/filter/hsqldb/createparser.cxx
+++ b/dbaccess/source/filter/hsqldb/createparser.cxx
@@ -251,9 +251,9 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart)
// search next space to get the whole type name
// eg: INTEGER, VARCHAR(10), DECIMAL(6,3)
auto nNextSpace = sFromTypeName.indexOf(" ");
- OUString sFullTypeName;
+ std::u16string_view sFullTypeName;
if (nNextSpace > 0)
- sFullTypeName = sFromTypeName.copy(0, nNextSpace);
+ sFullTypeName = sFromTypeName.subView(0, nNextSpace);
// perhaps column type corresponds to the last info here
else
sFullTypeName = sFromTypeName;
@@ -266,7 +266,8 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart)
if (isPrimaryKey)
m_PrimaryKeys.push_back(rColumnName);
- const OUString sColumnWithoutName = sColumn.copy(sColumn.indexOf(typeParts.typeName));
+ const std::u16string_view sColumnWithoutName
+ = sColumn.subView(sColumn.indexOf(typeParts.typeName));
ColumnDefinition aColDef(rColumnName, lcl_getDataTypeFromHsql(typeParts.typeName),
std::move(typeParts.params), isPrimaryKey,
diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx
index c3b7951a8219..b55340f2deb7 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -60,9 +60,14 @@ public:
{
assert(isIndexStatement());
- OUString sIndexPart = m_sql.copy(m_sql.indexOf("INDEX") + 5);
- sal_Int32 nQuotePos = sIndexPart.indexOf("'") + 1;
- OUString sIndexNums = sIndexPart.copy(nQuotePos, sIndexPart.lastIndexOf("'") - nQuotePos);
+ std::u16string_view sIndexPart = m_sql.subView(m_sql.indexOf("INDEX") + 5);
+ size_t nQuotePos = sIndexPart.find('\'');
+ if (nQuotePos == std::u16string_view::npos)
+ nQuotePos = 0;
+ else
+ ++nQuotePos;
+ std::u16string_view sIndexNums
+ = sIndexPart.substr(nQuotePos, sIndexPart.rfind('\'') - nQuotePos);
std::vector<OUString> sIndexes = string::split(sIndexNums, u' ');
IndexVector indexes;
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index caac1d968779..15fa887f7a63 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -357,7 +357,7 @@ namespace dbaui
int nPos(rBox.find_text(rBox.get_active_text()));
if (nPos == -1)
- return rBox.get_active_text().copy(0);
+ return rBox.get_active_text();
if ( m_xTextSeparator.get() != &rBox || nPos != (rBox.get_count()-1) )
return OUString(
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index cc2895d12c67..414d6bbdca89 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1054,7 +1054,7 @@ bool OSelectionBrowseBox::SaveModified()
sal_Int32 nPos = rComboBox.get_active();
// these functions are only available in CORE
OUString sFunctionName = rComboBox.get_text(nPos);
- OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
+ std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
bool bGroupBy = false;
if ( sGroupFunctionName == sFunctionName ) // check if the function name is GROUP
{
@@ -2282,16 +2282,16 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con
break;
case BROW_FUNCTION_ROW:
{
- OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
+ std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
pEntry->SetFunction(strNewText);
// first reset this two member
sal_Int32 nFunctionType = pEntry->GetFunctionType();
nFunctionType &= ~FKT_AGGREGATE;
pEntry->SetFunctionType(nFunctionType);
- if ( pEntry->IsGroupBy() && !sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
+ if ( pEntry->IsGroupBy() && !o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(false);
- if ( sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
+ if ( o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(true);
else if ( !strNewText.isEmpty() )
{