diff options
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/filter/hsqldb/columndef.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/fbcreateparser.cxx | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/dbaccess/source/filter/hsqldb/columndef.hxx b/dbaccess/source/filter/hsqldb/columndef.hxx index 5b5c68f7e67a..2bdbef83cd11 100644 --- a/dbaccess/source/filter/hsqldb/columndef.hxx +++ b/dbaccess/source/filter/hsqldb/columndef.hxx @@ -35,6 +35,7 @@ public: bool isPrimaryKey() const { return m_bPrimaryKey; } bool isNullable() const { return m_bNullable; } bool isAutoIncremental() const { return m_nAutoIncrement >= 0; } + sal_Int32 getStartValue() const { return m_nAutoIncrement; } const std::vector<sal_Int32> getParams() const { return m_aParams; } }; } diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx index 764ccaca2d69..fe23eec6635b 100644 --- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx @@ -142,9 +142,16 @@ OUString FbCreateStmtParser::compose() const if (!sModifier.isEmpty()) lcl_appendWithSpace(sSql, sModifier); - // TODO autoincremental default value with "START WITH" if (columnIter->isAutoIncremental()) - lcl_appendWithSpace(sSql, "GENERATED BY DEFAULT AS IDENTITY (START WITH 0)"); + { + lcl_appendWithSpace(sSql, "GENERATED BY DEFAULT AS IDENTITY (START WITH "); + + // start with 0: + // HSQLDB: first value will be 0. + // Firebird: first value will be 1. + sSql.append(columnIter->getStartValue() - 1); + sSql.append(")"); + } else if (!columnIter->isNullable()) lcl_appendWithSpace(sSql, "NOT NULL"); |