summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/filter/hsqldb/parseschema.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/filter/hsqldb/parseschema.cxx')
-rw-r--r--dbaccess/source/filter/hsqldb/parseschema.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx
index c3b7951a8219..5e512f067920 100644
--- a/dbaccess/source/filter/hsqldb/parseschema.cxx
+++ b/dbaccess/source/filter/hsqldb/parseschema.cxx
@@ -33,6 +33,7 @@
#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <connectivity/dbexception.hxx>
+#include <utility>
namespace
{
@@ -46,8 +47,8 @@ private:
OUString m_sql;
public:
- IndexStmtParser(const OUString& sSql)
- : m_sql(sSql)
+ IndexStmtParser(OUString sSql)
+ : m_sql(std::move(sSql))
{
}
@@ -60,9 +61,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;
@@ -112,7 +118,7 @@ void SchemaParser::parseSchema()
{
assert(m_rStorage);
- static constexpr OUStringLiteral SCHEMA_FILENAME = u"script";
+ static constexpr OUString SCHEMA_FILENAME = u"script"_ustr;
if (!m_rStorage->hasByName(SCHEMA_FILENAME))
{
SAL_WARN("dbaccess", "script file does not exist in storage during hsqldb import");
@@ -176,8 +182,8 @@ std::vector<ColumnDefinition> SchemaParser::getTableColumnTypes(const OUString&
{
if (m_ColumnTypes.count(sTableName) < 1)
{
- static constexpr OUStringLiteral NOT_EXIST
- = u"Internal error while getting column information of table";
+ static constexpr OUString NOT_EXIST
+ = u"Internal error while getting column information of table"_ustr;
SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName);
dbtools::throwGenericSQLException(NOT_EXIST, ::comphelper::getProcessComponentContext());
}