[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - dbaccess/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 18:06:17 UTC 2018


 dbaccess/source/filter/hsqldb/utils.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 3c8ad17c769753af50ef14770661a6c1ffed226e
Author:     Tamas Bunth <tamas.bunth at collabora.co.uk>
AuthorDate: Fri Oct 26 21:04:09 2018 +0200
Commit:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Tue Nov 6 19:05:21 2018 +0100

    tdf#120691 Migrate tables which contain spaces
    
    Change-Id: I115d765bc781a926189605990e91c8e47f24d474
    Reviewed-on: https://gerrit.libreoffice.org/62403
    Tested-by: Jenkins
    Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
    (cherry picked from commit 76279399f747548494a259173ef5669553c3f06f)
    Reviewed-on: https://gerrit.libreoffice.org/62501
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx
index dfdbee40c37b..8d6c49e348dc 100644
--- a/dbaccess/source/filter/hsqldb/utils.cxx
+++ b/dbaccess/source/filter/hsqldb/utils.cxx
@@ -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("(");


More information about the Libreoffice-commits mailing list