[jOOQ/jOOQ#8528] Support more CREATE TABLE clauses

- COMMENT clause
- Basic support for [ CONSTRAINT ... ] [ PRIMARY KEY | UNIQUE ] clause
This commit is contained in:
Knut Wannheden 2019-09-18 14:47:59 +02:00
parent 9b9622f2bc
commit 78ae663c92
2 changed files with 5 additions and 3 deletions

View File

@ -188,6 +188,7 @@ final class CreateTableImpl extends AbstractRowCountQuery implements
final List<DataType<?>> $columnTypes() { return columnTypes; }
final List<Constraint> $constraints() { return constraints; }
final boolean $ifNotExists() { return ifNotExists; }
final Comment $comment() { return comment; }
// ------------------------------------------------------------------------
// XXX: DSL API

View File

@ -46,6 +46,7 @@ import java.util.List;
import java.util.Map;
import org.jooq.Catalog;
import org.jooq.Comment;
import org.jooq.Configuration;
import org.jooq.Constraint;
import org.jooq.DataType;
@ -113,7 +114,7 @@ final class DDLInterpreter {
return;
}
MutableTable t = new MutableTable(table.getUnqualifiedName(), schema);
MutableTable t = new MutableTable(table.getUnqualifiedName(), schema, query.$comment());
List<Field<?>> columns = query.$columnFields();
if (!columns.isEmpty())
for (int i = 0; i < columns.size(); i++) {
@ -281,8 +282,8 @@ final class DDLInterpreter {
private UniqueKey<Record> primaryKey;
private List<UniqueKey<Record>> keys;
MutableTable(Name name, MutableSchema schema) {
super(normalize(name), schema);
MutableTable(Name name, MutableSchema schema, Comment comment) {
super(normalize(name), schema, null, null, comment);
schema.tables.add(this);
}