diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2019-07-16 21:44:38 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-08-05 10:51:38 +0200 |
commit | f877a8625ce4eb5004024d4fdf0cc3d5075050d4 (patch) | |
tree | 5d16cf67bc7977bf03f7274dcc68edb0efd59c5e /dbaccess | |
parent | b7ce5fce07db79af245dcca6c48d78c170487acb (diff) |
tdf#123020 dbahsql: Support string delimiter
Support multi-word table names while migrating HSQLDB data.
Change-Id: I5129f995ea90a3fdbcbcb844774cf074f3ffddb2
Reviewed-on: https://gerrit.libreoffice.org/75734
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
(cherry picked from commit b5890bf269214a47833bc9514b80650455e77ef6)
Reviewed-on: https://gerrit.libreoffice.org/75820
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
(cherry picked from commit 47d6c43c19aa6ea05f0f65db58e5cdcf1c603660)
Reviewed-on: https://gerrit.libreoffice.org/75853
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit ed9acbe6057f535bca8d4ce98aa0eda7be34e15b)
Reviewed-on: https://gerrit.libreoffice.org/76937
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/filter/hsqldb/parseschema.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index e04998c80f28..f8e17d90b312 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -28,6 +28,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> +#include <connectivity/dbexception.hxx> namespace { @@ -74,8 +75,17 @@ public: OUString getTableName() const { - // SET TABLE <tableName> - return string::split(m_sql, u' ')[2]; + // SET TABLE <tableName> or SET TABLE "<multi word table name>" + OUString sName = string::split(m_sql, u' ')[2]; + if (sName.indexOf('"') >= 0) + { + // Table name with string delimiter + OUStringBuffer sMultiName("\""); + sMultiName.append(string::split(m_sql, u'"')[1]); + sMultiName.append("\""); + sName = sMultiName.makeStringAndClear(); + } + return sName; } }; @@ -169,6 +179,12 @@ void SchemaParser::parseSchema() ColumnTypeVector SchemaParser::getTableColumnTypes(const OUString& sTableName) const { + if (m_ColumnTypes.count(sTableName) < 1) + { + constexpr char NOT_EXIST[] = "Internal error while getting column information of table"; + SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName); + dbtools::throwGenericSQLException(NOT_EXIST, ::comphelper::getProcessComponentContext()); + } return m_ColumnTypes.at(sTableName); } |