summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2018-04-14 21:13:46 +0200
committerTamás Bunth <btomi96@gmail.com>2018-04-15 21:29:13 +0200
commit05b03813779922110bc9d31c922f906b4920c603 (patch)
tree545099da06d2fa90ddfc7ab4fffcc04278d77521
parent098b84ff26212d5bee30f16848fac90d061e8b14 (diff)
tdf#116965 dbahsql: migrate relationgships
from ALTER statements Change-Id: I399f2ea6f6181c609952d08beb85068cfb45b4df Reviewed-on: https://gerrit.libreoffice.org/52893 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Bunth <btomi96@gmail.com>
-rw-r--r--dbaccess/source/filter/hsqldb/alterparser.cxx13
-rw-r--r--dbaccess/source/filter/hsqldb/alterparser.hxx3
-rw-r--r--dbaccess/source/filter/hsqldb/fbalterparser.cxx2
3 files changed, 15 insertions, 3 deletions
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());