if (appendColumnDesc(c, sql, false)==false)
continue; // Ignore and continue;
addSeparator = true;
}
// Primary Key
DBIndex pk = t.getPrimaryKey();
if (pk != null)
{ // add the primary key
sql.append(", PRIMARY KEY (");
addSeparator = false;
// columns
DBColumn[] keyColumns = pk.getColumns();
for (int i = 0; i < keyColumns.length; i++)
{
sql.append((addSeparator) ? ", " : "");
keyColumns[i].addSQL(sql, DBExpr.CTX_NAME);
addSeparator = true;
}
sql.append(")");
}
sql.append(")");
// Comment?
String comment = t.getComment();
if (StringUtils.isValid(comment))
{ // Add the table comment
sql.append(" COMMENT = '");
sql.append(comment);
sql.append("'");
}
// Create the table
if (script.addStmt(sql) == false)
return false;
// Create other Indizes (except primary key)
Iterator<DBIndex> indexes = t.getIndexes().iterator();
while (indexes.hasNext())
{
DBIndex idx = indexes.next();
if (idx == pk || idx.getType() == DBIndex.PRIMARYKEY)
continue;
// Cretae Index
sql.setLength(0);
sql.append((idx.getType() == DBIndex.UNIQUE) ? "CREATE UNIQUE INDEX " : "CREATE INDEX ");
appendElementName(sql, idx.getName());
sql.append(" ON ");
t.addSQL(sql, DBExpr.CTX_FULLNAME);
sql.append(" (");
addSeparator = false;
// columns
DBColumn[] idxColumns = idx.getColumns();
for (int i = 0; i < idxColumns.length; i++)
{
sql.append((addSeparator) ? ", " : "");
idxColumns[i].addSQL(sql, DBExpr.CTX_NAME);
addSeparator = true;