dbaccess/source/filter/hsqldb/alterparser.cxx   |   13 ++++++++++---
 dbaccess/source/filter/hsqldb/alterparser.hxx   |    3 +++
 dbaccess/source/filter/hsqldb/fbalterparser.cxx |    2 ++
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 05b03813779922110bc9d31c922f906b4920c603
Author: Tamas Bunth <tamas.bu...@collabora.co.uk>
Date:   Sat Apr 14 21:13:46 2018 +0200

    tdf#116965 dbahsql: migrate relationgships
    
    from ALTER statements
    
    Change-Id: I399f2ea6f6181c609952d08beb85068cfb45b4df
    Reviewed-on: https://gerrit.libreoffice.org/52893
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tamás Bunth <btom...@gmail.com>

diff --git a/dbaccess/source/filter/hsqldb/alterparser.cxx 
b/dbaccess/source/filter/hsqldb/alterparser.cxx
index f3c53239c64d..20d035152579 100644
--- a/dbaccess/source/filter/hsqldb/alterparser.cxx
+++ b/dbaccess/source/filter/hsqldb/alterparser.cxx
@@ -25,6 +25,7 @@ namespace dbahsql
 {
 void AlterStmtParser::parse(const OUString& sSql)
 {
+    m_sStmt = sSql;
     if (!sSql.startsWith("ALTER"))
     {
         SAL_WARN("dbaccess", "Not an ALTER statement");
@@ -35,11 +36,17 @@ void AlterStmtParser::parse(const OUString& sSql)
     auto words = comphelper::string::split(sSql, sal_Unicode(u' '));
 
     if (words[3] == "ALTER" && words[4] == "COLUMN")
+    {
         m_sColumnName = words[5];
-    if (words[6] == "RESTART" && words[7] == "WITH")
+        if (words[6] == "RESTART" && words[7] == "WITH")
+        {
+            m_eAction = AlterAction::IDENTITY_RESTART;
+            m_nIdentityParam = words[8].toInt32();
+        }
+    }
+    else if (words[3] == "ADD" && words[4] == "CONSTRAINT")
     {
-        m_eAction = AlterAction::IDENTITY_RESTART;
-        m_nIdentityParam = words[8].toInt32();
+        m_eAction = AlterAction::ADD_FOREIGN;
     }
 }
 
diff --git a/dbaccess/source/filter/hsqldb/alterparser.hxx 
b/dbaccess/source/filter/hsqldb/alterparser.hxx
index 29d77b1c1a80..12b496a55df9 100644
--- a/dbaccess/source/filter/hsqldb/alterparser.hxx
+++ b/dbaccess/source/filter/hsqldb/alterparser.hxx
@@ -17,12 +17,14 @@ namespace dbahsql
 enum class AlterAction
 {
     UNKNOWN,
+    ADD_FOREIGN,
     IDENTITY_RESTART
 };
 
 class SAL_DLLPUBLIC_EXPORT AlterStmtParser
 {
 private:
+    OUString m_sStmt;
     OUString m_sTableName;
     OUString m_sColumnName;
     AlterAction m_eAction = AlterAction::UNKNOWN;
@@ -32,6 +34,7 @@ protected:
     AlterAction getActionType() const { return m_eAction; }
     OUString getColumnName() const { return m_sColumnName; }
     sal_Int32 getIdentityParam() const { return m_nIdentityParam; }
+    OUString getStatement() const { return m_sStmt; }
 
 public:
     virtual ~AlterStmtParser() = default;
diff --git a/dbaccess/source/filter/hsqldb/fbalterparser.cxx 
b/dbaccess/source/filter/hsqldb/fbalterparser.cxx
index ee34f4a8b72b..80bf72b2e635 100644
--- a/dbaccess/source/filter/hsqldb/fbalterparser.cxx
+++ b/dbaccess/source/filter/hsqldb/fbalterparser.cxx
@@ -29,6 +29,8 @@ OUString FbAlterStmtParser::compose() const
         SAL_WARN("dbaccess", "Unkown type of ALTER statement in 
FbAlterStmtParser");
         return OUString{};
     }
+    else if (getActionType() == AlterAction::ADD_FOREIGN)
+        return getStatement(); // do nothing with that
     OUStringBuffer sSql("ALTER TABLE ");
     sSql.append(getTableName());
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to