[#5055] Add CreateTableColumnStep.column(Field<?>) for convenience

This commit is contained in:
lukaseder 2016-02-04 22:06:52 +01:00
parent c122a176ec
commit b7d0776c66
3 changed files with 26 additions and 0 deletions

View File

@ -70,6 +70,16 @@ public interface CreateTableAsStep<R extends Record> {
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
CreateTableOnCommitStep as(Select<? extends R> select);
/**
* Add a column to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} with
* {@link Field#getDataType()} as the argument data type.
*/
@Support
CreateTableColumnStep column(Field<?> field);
/**
* Add a column to the column list of the <code>CREATE TABLE</code> statement.
*/

View File

@ -47,6 +47,16 @@ package org.jooq;
*/
public interface CreateTableColumnStep extends CreateTableConstraintStep {
/**
* Add a column to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} with
* {@link Field#getDataType()} as the argument data type.
*/
@Support
CreateTableColumnStep column(Field<?> field);
/**
* Add a column to the column list of the <code>CREATE TABLE</code> statement.
*/

View File

@ -128,6 +128,12 @@ class CreateTableImpl<R extends Record> extends AbstractQuery implements
return this;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final CreateTableColumnStep column(Field<?> field) {
return column((Field) field, field.getDataType());
}
@Override
public final <T> CreateTableColumnStep column(Field<T> field, DataType<T> type) {
columnFields.add(field);