summaryrefslogtreecommitdiff
path: root/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/filter/hsqldb/fbcreateparser.cxx')
-rw-r--r--dbaccess/source/filter/hsqldb/fbcreateparser.cxx37
1 files changed, 13 insertions, 24 deletions
diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
index 4f8fb8667d1e..5d4244f8085b 100644
--- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
+++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx
@@ -29,12 +29,6 @@ using namespace css::sdbc;
namespace
{
-void lcl_appendWithSpace(OUStringBuffer& sBuff, const OUString& sStr)
-{
- sBuff.append(" ");
- sBuff.append(sStr);
-}
-
OUString lcl_DataTypetoFbTypeName(sal_Int32 eType)
{
switch (eType)
@@ -110,8 +104,7 @@ void FbCreateStmtParser::appendPrimaryKeyPart(OUStringBuffer& rSql) const
if (sPrimaryKeys.empty())
return; // no primary key specified
- rSql.append(",");
- rSql.append("PRIMARY KEY(");
+ rSql.append(",PRIMARY KEY(");
auto it = sPrimaryKeys.cbegin();
while (it != sPrimaryKeys.end())
{
@@ -135,16 +128,14 @@ OUString FbCreateStmtParser::compose() const
{
ensureProperTableLengths();
OUStringBuffer sSql(128);
- sSql.append("CREATE TABLE ");
- sSql.append(getTableName());
+ sSql.append("CREATE TABLE " + getTableName() + " ("); // column declaration
- lcl_appendWithSpace(sSql, "("); // column declaration
auto& rColumns = getColumnDef();
auto columnIter = rColumns.cbegin();
while (columnIter != rColumns.end())
{
- lcl_appendWithSpace(sSql, columnIter->getName());
- lcl_appendWithSpace(sSql, lcl_DataTypetoFbTypeName(columnIter->getDataType()));
+ sSql.append(" " + columnIter->getName() + " "
+ + lcl_DataTypetoFbTypeName(columnIter->getDataType()));
std::vector<sal_Int32> params{ columnIter->getParams() };
@@ -163,7 +154,7 @@ OUString FbCreateStmtParser::compose() const
auto it = params.cbegin();
while (it != params.end())
{
- sSql.append(OUString::number(*it));
+ sSql.append(*it);
++it;
if (it != params.end())
sSql.append(",");
@@ -174,32 +165,30 @@ OUString FbCreateStmtParser::compose() const
// special modifiers here, based on type (e.g. charset, subtype)
OUString sModifier = lcl_getTypeModifier(columnIter->getDataType());
if (!sModifier.isEmpty())
- lcl_appendWithSpace(sSql, sModifier);
+ sSql.append(" " + sModifier);
if (columnIter->isAutoIncremental())
{
- 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(")");
+ sSql.append(" GENERATED BY DEFAULT AS IDENTITY (START WITH "
+ + OUString::number(columnIter->getStartValue() - 1) + ")");
}
else if (!columnIter->isNullable())
- lcl_appendWithSpace(sSql, "NOT NULL");
+ sSql.append(" NOT NULL");
if (columnIter->isCaseInsensitive())
- lcl_appendWithSpace(sSql, "COLLATE UNICODE_CI");
+ sSql.append(" COLLATE UNICODE_CI");
const OUString& sDefaultVal = columnIter->getDefault();
if (!sDefaultVal.isEmpty())
{
- lcl_appendWithSpace(sSql, "DEFAULT");
+ sSql.append(" DEFAULT ");
if (sDefaultVal.equalsIgnoreAsciiCase("NOW"))
- lcl_appendWithSpace(sSql, "\'NOW\'"); // Fb likes it single quoted
+ sSql.append("'NOW'"); // Fb likes it single quoted
else
- lcl_appendWithSpace(sSql, sDefaultVal);
+ sSql.append(sDefaultVal);
}
++columnIter;