From b7d0776c660e2cdaca9672365a103c6d234e7278 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Thu, 4 Feb 2016 22:06:52 +0100 Subject: [PATCH] [#5055] Add CreateTableColumnStep.column(Field) for convenience --- jOOQ/src/main/java/org/jooq/CreateTableAsStep.java | 10 ++++++++++ jOOQ/src/main/java/org/jooq/CreateTableColumnStep.java | 10 ++++++++++ jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/CreateTableAsStep.java b/jOOQ/src/main/java/org/jooq/CreateTableAsStep.java index d79363c57e..d342ec6b10 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTableAsStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTableAsStep.java @@ -70,6 +70,16 @@ public interface CreateTableAsStep { @Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) CreateTableOnCommitStep as(Select select); + /** + * Add a column to the column list of the CREATE TABLE + * statement. + *

+ * 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 CREATE TABLE statement. */ diff --git a/jOOQ/src/main/java/org/jooq/CreateTableColumnStep.java b/jOOQ/src/main/java/org/jooq/CreateTableColumnStep.java index b3c69b9606..8a6421a44c 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTableColumnStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTableColumnStep.java @@ -47,6 +47,16 @@ package org.jooq; */ public interface CreateTableColumnStep extends CreateTableConstraintStep { + /** + * Add a column to the column list of the CREATE TABLE + * statement. + *

+ * 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 CREATE TABLE statement. */ diff --git a/jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java b/jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java index 821ca945fd..f27be4ec93 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java @@ -128,6 +128,12 @@ class CreateTableImpl extends AbstractQuery implements return this; } + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public final CreateTableColumnStep column(Field field) { + return column((Field) field, field.getDataType()); + } + @Override public final CreateTableColumnStep column(Field field, DataType type) { columnFields.add(field);