Kaydet (Commit) 76279399 authored tarafından Tamas Bunth's avatar Tamas Bunth Kaydeden (comit) Tamás Bunth

tdf#120691 Migrate tables which contain spaces

Change-Id: I115d765bc781a926189605990e91c8e47f24d474
Reviewed-on: https://gerrit.libreoffice.org/62403
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst a1dd2f55
......@@ -22,6 +22,8 @@
#include <comphelper/processfactory.hxx>
#include <connectivity/dbexception.hxx>
#include <sal/log.hxx>
#include "utils.hxx"
using namespace dbahsql;
......@@ -39,6 +41,22 @@ OUString utils::getTableNameFromStmt(const OUString& sSql)
if (*wordIter == "TABLE")
++wordIter;
// it may contain spaces if it's put into apostrophes.
if (wordIter->indexOf("\"") >= 0)
{
sal_Int32 nAposBegin = sSql.indexOf("\"");
sal_Int32 nAposEnd = nAposBegin;
bool bProperEndAposFound = false;
while (!bProperEndAposFound)
{
nAposEnd = sSql.indexOf("\"", nAposEnd + 1);
if (sSql[nAposEnd - 1] != u'\\')
bProperEndAposFound = true;
}
OUString result = sSql.copy(nAposBegin, nAposEnd - nAposBegin + 1);
return result;
}
// next word is the table's name
// it might stuck together with the column definitions.
sal_Int32 nParenPos = wordIter->indexOf("(");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment