[jOOQ/jOOQ#12772] Various improvements

- [jOOQ/jOOQ#12779] Add support for MySQL COMMENT syntax in DDLDatabase
- [jOOQ/jOOQ#12772] Added QOM.CreateTable
- [jOOQ/jOOQ#13004] Add a TableElement type, a super type of Field<?> | Constraint | Index
- [jOOQ/jOOQ#13005] Deprecate FieldOrConstraint
This commit is contained in:
Lukas Eder 2022-02-07 21:10:40 +01:00
parent 667416b30f
commit 2393afc7f2
31 changed files with 1676 additions and 1556 deletions

View File

@ -37,6 +37,7 @@
*/
package org.jooq.meta.extensions.ddl;
// ...
import static org.jooq.conf.SettingsTools.renderLocale;
import static org.jooq.impl.DSL.name;
import static org.jooq.tools.StringUtils.isBlank;
@ -55,6 +56,7 @@ import org.jooq.Name;
import org.jooq.Name.Quoted;
import org.jooq.Queries;
import org.jooq.Query;
// ...
import org.jooq.ResultQuery;
import org.jooq.Source;
import org.jooq.VisitContext;
@ -171,6 +173,12 @@ public class DDLDatabase extends AbstractInterpretingDatabase {
Scanner s = new Scanner(r = source.reader()).useDelimiter("\\A");
Queries queries = ctx.parser().parse(s.hasNext() ? s.next() : "");
for (Query query : queries) {
repeat:

View File

@ -325,7 +325,7 @@ public interface AlterTableStep {
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
AlterTableAddStep add(FieldOrConstraint... fields);
AlterTableAddStep add(TableElement... fields);
/**
* Add an <code>ADD</code> clause with multiple columns or constraints to
@ -333,7 +333,7 @@ public interface AlterTableStep {
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
AlterTableAddStep add(Collection<? extends FieldOrConstraint> fields);
AlterTableAddStep add(Collection<? extends TableElement> fields);
/**
* Add an <code>ADD COLUMN</code> clause to the <code>ALTER TABLE</code>

View File

@ -61,6 +61,10 @@ import org.jooq.impl.DSL;
*
* @author Lukas Eder
*/
public /* non-sealed */ interface Constraint extends FieldOrConstraint {
public /* non-sealed */ interface Constraint
extends
FieldOrConstraint,
TableElement
{
}

View File

@ -37,37 +37,14 @@
*/
package org.jooq;
// ...
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.CUBRID;
// ...
import static org.jooq.SQLDialect.DERBY;
// ...
import static org.jooq.SQLDialect.H2;
// ...
import static org.jooq.SQLDialect.HSQLDB;
// ...
import static org.jooq.SQLDialect.MARIADB;
// ...
import static org.jooq.SQLDialect.MYSQL;
// ...
import static org.jooq.SQLDialect.POSTGRES;
// ...
// ...
// ...
import static org.jooq.SQLDialect.SQLITE;
// ...
// ...
// ...
import static org.jooq.SQLDialect.YUGABYTEDB;
import static org.jooq.SQLDialect.*;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import org.jetbrains.annotations.*;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -86,15 +63,14 @@ import org.jetbrains.annotations.NotNull;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
public interface CreateTableAsStep<R extends Record> {
@SuppressWarnings({ "unused" })
public interface CreateTableAsStep extends CreateTableOnCommitStep {
/**
* Add an <code>AS</code> clause to the <code>CREATE TABLE</code> statement.
* Add the <code>AS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableWithDataStep as(Select<? extends R> select);
@NotNull @CheckReturnValue
CreateTableWithDataStep as(Select<?> select);
}

View File

@ -1,147 +0,0 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
import org.jetbrains.annotations.*;
import java.util.Collection;
/**
* A {@link Query} that can create tables.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> types
* directly from client code, or assign them to local variables. When writing
* dynamic SQL, creating a statement's components dynamically, and passing them
* to the DSL API statically is usually a better choice. See the manual's
* section about dynamic SQL for details: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
public interface CreateTableColumnStep extends CreateTableAsStep<Record>, 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.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep column(Field<?> field);
/**
* Add a column to the column list of the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support
<T> CreateTableColumnStep column(Field<T> field, DataType<T> type);
/**
* Add a column to the column list of the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep column(Name field, DataType<?> type);
/**
* Add a column to the column list of the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep column(String field, DataType<?> type);
/**
* Add several columns to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} for each
* column, with {@link Field#getDataType()} as the argument data type.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep columns(Field<?>... fields);
/**
* Add several columns to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} for each
* column. Lacking an explicit data type, this makes sense only for a
* <code>CREATE TABLE AS SELECT...</code> statement.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep columns(Name... fields);
/**
* Add several columns to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} for each
* column. Lacking an explicit data type, this makes sense only for a
* <code>CREATE TABLE AS SELECT...</code> statement.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep columns(String... fields);
/**
* Add several columns to the column list of the <code>CREATE TABLE</code>
* statement.
* <p>
* This is the same as calling {@link #column(Field, DataType)} for each
* column, with {@link Field#getDataType()} as the argument data type.
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep columns(Collection<? extends Field<?>> fields);
}

View File

@ -37,13 +37,14 @@
*/
package org.jooq;
import org.jetbrains.annotations.*;
import static org.jooq.SQLDialect.*;
import java.util.*;
import org.jetbrains.annotations.*;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -62,23 +63,21 @@ import static org.jooq.SQLDialect.*;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
@SuppressWarnings({ "unused" })
public interface CreateTableCommentStep extends CreateTableStorageStep {
/**
* Add a comment to the table.
* Add the <code>COMMENT</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableStorageStep comment(String comment);
@NotNull @CheckReturnValue
CreateTableStorageStep comment(@Stringly.Comment String comment);
/**
* Add a comment to the table.
* Add the <code>COMMENT</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableStorageStep comment(Comment comment);
}

View File

@ -1,214 +0,0 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
import org.jooq.impl.DSL;
import org.jetbrains.annotations.*;
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.CUBRID;
// ...
import static org.jooq.SQLDialect.DERBY;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.H2;
// ...
import static org.jooq.SQLDialect.HSQLDB;
// ...
// ...
import static org.jooq.SQLDialect.MARIADB;
import static org.jooq.SQLDialect.MYSQL;
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.SQLITE;
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.YUGABYTEDB;
import java.util.Collection;
/**
* A {@link Query} that can create tables.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> types
* directly from client code, or assign them to local variables. When writing
* dynamic SQL, creating a statement's components dynamically, and passing them
* to the DSL API statically is usually a better choice. See the manual's
* section about dynamic SQL for details: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
public interface CreateTableConstraintStep extends CreateTableIndexStep {
/**
* Add a constraint to the table.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep constraint(Constraint constraint);
/**
* Add constraints to the table.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep constraints(Constraint... constraints);
/**
* Add constraints to the table.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep constraints(Collection<? extends Constraint> constraints);
/**
* Convenience method to add an unnamed (system named)
* <code>PRIMARY KEY</code> constraint to the table.
* <p>
* This does the same as adding {@link DSL#primaryKey(String...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep primaryKey(String... fields);
/**
* Convenience method to add an unnamed (system named)
* <code>PRIMARY KEY</code> constraint to the table.
* <p>
* This does the same as adding {@link DSL#primaryKey(Name...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep primaryKey(Name... fields);
/**
* Convenience method to add an unnamed (system named)
* <code>PRIMARY KEY</code> constraint to the table.
* <p>
* This does the same as adding {@link DSL#primaryKey(Field...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep primaryKey(Field<?>... fields);
/**
* Convenience method to add an unnamed (system named)
* <code>PRIMARY KEY</code> constraint to the table.
* <p>
* This does the same as adding {@link DSL#primaryKey(Field...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep primaryKey(Collection<? extends Field<?>> fields);
/**
* Convenience method to add an unnamed (system named) <code>UNIQUE</code>
* constraint to the table.
* <p>
* This does the same as adding {@link DSL#unique(String...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep unique(String... fields);
/**
* Convenience method to add an unnamed (system named) <code>UNIQUE</code>
* constraint to the table.
* <p>
* This does the same as adding {@link DSL#unique(Name...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep unique(Name... fields);
/**
* Convenience method to add an unnamed (system named) <code>UNIQUE</code>
* constraint to the table.
* <p>
* This does the same as adding {@link DSL#unique(Field...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep unique(Field<?>... fields);
/**
* Convenience method to add an unnamed (system named) <code>UNIQUE</code>
* constraint to the table.
* <p>
* This does the same as adding {@link DSL#unique(Field...)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support
CreateTableConstraintStep unique(Collection<? extends Field<?>> fields);
/**
* Convenience method to add an unnamed (system named) <code>CHECK</code>
* constraint to the table.
* <p>
* This does the same as adding {@link DSL#check(Condition)} via
* {@link #constraint(Constraint)} explicitly.
*/
@NotNull @CheckReturnValue
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableConstraintStep check(Condition condition);
}

View File

@ -0,0 +1,244 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
import org.jetbrains.annotations.*;
/**
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> types
* directly from client code, or assign them to local variables. When writing
* dynamic SQL, creating a statement's components dynamically, and passing them
* to the DSL API statically is usually a better choice. See the manual's
* section about dynamic SQL for details: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*/
@SuppressWarnings({ "unused" })
public interface CreateTableElementListStep extends CreateTableAsStep {
/**
* Add the <code>TABLE ELEMENTS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep tableElements(TableElement... tableElements);
/**
* Add the <code>TABLE ELEMENTS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep tableElements(Collection<? extends TableElement> tableElements);
/**
* Add the <code>COLUMNS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep columns(String... columns);
/**
* Add the <code>COLUMNS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep columns(Name... columns);
/**
* Add the <code>COLUMNS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep columns(Field<?>... columns);
/**
* Add the <code>COLUMNS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep columns(Collection<? extends Field<?>> columns);
/**
* Add the <code>COLUMN</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep column(Field<?> column);
/**
* Add the <code>COLUMN</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep column(@Stringly.Name String field, DataType<?> type);
/**
* Add the <code>COLUMN</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep column(Name field, DataType<?> type);
/**
* Add the <code>COLUMN</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep column(Field<?> field, DataType<?> type);
/**
* Add the <code>CONSTRAINTS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep constraints(Constraint... constraints);
/**
* Add the <code>CONSTRAINTS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep constraints(Collection<? extends Constraint> constraints);
/**
* Add the <code>CONSTRAINT</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep constraint(Constraint constraint);
/**
* Add the <code>PRIMARY KEY</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep primaryKey(String... fields);
/**
* Add the <code>PRIMARY KEY</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep primaryKey(Name... fields);
/**
* Add the <code>PRIMARY KEY</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep primaryKey(Field<?>... fields);
/**
* Add the <code>PRIMARY KEY</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep primaryKey(Collection<? extends Field<?>> fields);
/**
* Add the <code>UNIQUE</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep unique(String... fields);
/**
* Add the <code>UNIQUE</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep unique(Name... fields);
/**
* Add the <code>UNIQUE</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep unique(Field<?>... fields);
/**
* Add the <code>UNIQUE</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support
@NotNull @CheckReturnValue
CreateTableElementListStep unique(Collection<? extends Field<?>> fields);
/**
* Add the <code>CHECK</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableElementListStep check(Condition condition);
/**
* Add the <code>INDEXES</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableElementListStep indexes(Index... indexes);
/**
* Add the <code>INDEXES</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableElementListStep indexes(Collection<? extends Index> indexes);
/**
* Add the <code>INDEX</code> clause to the <code>CREATE TABLE</code> statement.
*/
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableElementListStep index(Index index);
}

View File

@ -37,9 +37,16 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
import org.jetbrains.annotations.*;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* @deprecated - [#11329] - 3.15.0 - This type will be removed in the future. Do not reference it directly
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -58,11 +65,8 @@ package org.jooq;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @deprecated - [#11329] - 3.15.0 - This type will be removed in the future. Do not reference it directly
* @author Lukas Eder
*/
@SuppressWarnings({ "unused" })
@Deprecated(forRemoval = true, since = "3.15")
public interface CreateTableFinalStep extends DDLQuery {
}

View File

@ -1,103 +0,0 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
import org.jetbrains.annotations.*;
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.MARIADB;
// ...
import static org.jooq.SQLDialect.MYSQL;
// ...
import static org.jooq.SQLDialect.POSTGRES;
// ...
import static org.jooq.SQLDialect.YUGABYTEDB;
import java.util.Collection;
/**
* A {@link Query} that can create tables.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> types
* directly from client code, or assign them to local variables. When writing
* dynamic SQL, creating a statement's components dynamically, and passing them
* to the DSL API statically is usually a better choice. See the manual's
* section about dynamic SQL for details: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
public interface CreateTableIndexStep extends CreateTableOnCommitStep {
/**
* Add an index to the table.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableIndexStep index(Index index);
/**
* Add indexes to the table.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableIndexStep indexes(Index... indexes);
/**
* Add indexes to the table.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableIndexStep indexes(Collection<? extends Index> indexes);
}

View File

@ -37,18 +37,14 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
import org.jetbrains.annotations.*;
// ...
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.YUGABYTEDB;
import org.jooq.impl.DSL;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -67,44 +63,28 @@ import org.jooq.impl.DSL;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
@SuppressWarnings({ "unused" })
public interface CreateTableOnCommitStep extends CreateTableCommentStep {
/**
* Add an <code>ON COMMIT DELETE ROWS</code> clause.
* <p>
* This clause will only be rendered when used with a
* <code>GLOBAL TEMPORARY TABLE</code>
*
* @see DSL#createGlobalTemporaryTable(Table)
* Add the <code>ON COMMIT DELETE ROWS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableCommentStep onCommitDeleteRows();
/**
* Add an <code>ON COMMIT PRESERVE ROWS</code> clause.
* <p>
* This clause will only be rendered when used with a
* <code>GLOBAL TEMPORARY TABLE</code>
*
* @see DSL#createGlobalTemporaryTable(Table)
* Add the <code>ON COMMIT PRESERVE ROWS</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableCommentStep onCommitPreserveRows();
/**
* Add an <code>ON COMMIT DROP</code> clause.
* <p>
* This clause will only be rendered when used with a
* <code>GLOBAL TEMPORARY TABLE</code>
*
* @see DSL#createGlobalTemporaryTable(Table)
* Add the <code>ON COMMIT DROP</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ POSTGRES, YUGABYTEDB })
@NotNull @CheckReturnValue
CreateTableCommentStep onCommitDrop();
}

View File

@ -37,13 +37,14 @@
*/
package org.jooq;
import static org.jooq.SQLDialect.*;
import java.util.*;
import org.jetbrains.annotations.*;
import org.jooq.impl.DSL;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -62,156 +63,47 @@ import org.jooq.impl.DSL;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
@SuppressWarnings({ "unused" })
public interface CreateTableStorageStep extends CreateTableFinalStep {
/**
* Add vendor-specific storage clauses to the <code>CREATE TABLE</code> statement.
* <p>
* Storage clauses will always be appended to the <em>end</em> of everything
* else that jOOQ renders, including possibly other storage clauses, such as
* {@link CreateTableOnCommitStep#onCommitDeleteRows()} or similar clauses.
* If custom storage clauses should be mixed with jOOQ-provided storage
* clauses, it is recommended not to use the jOOQ API and use the custom
* clause API for all storage clauses instead.
* <p>
* Storage clauses will be separated from previous elements by a separator
* (whitespace or newline) to ensure syntactic integrity.
* <p>
* Example usage:
* <p>
* <code><pre>
* DSL.using(configuration)
* .createTable("t")
* .column(field("i", SQLDataType.INTEGER))
* .storage("TABLESPACE my_tablespace")
* .execute();
* </pre></code>
* <p>
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
* guarantee syntax integrity. You may also create the possibility of
* malicious SQL injection. Be sure to properly use bind variables and/or
* escape literals when concatenated into SQL clauses! One way to escape
* literals is to use {@link DSL#name(String...)} and similar methods
* Add the <code>STORAGE</code> clause to the <code>CREATE TABLE</code> statement.
*
* @param sql The SQL
* @see SQL
*/
@NotNull @CheckReturnValue
@Support
@PlainSQL
CreateTableFinalStep storage(SQL sql);
@NotNull @CheckReturnValue
CreateTableFinalStep storage(SQL storage);
/**
* Add vendor-specific storage clauses to the <code>CREATE TABLE</code> statement.
* <p>
* Storage clauses will always be appended to the <em>end</em> of everything
* else that jOOQ renders, including possibly other storage clauses, such as
* {@link CreateTableOnCommitStep#onCommitDeleteRows()} or similar clauses.
* If custom storage clauses should be mixed with jOOQ-provided storage
* clauses, it is recommended not to use the jOOQ API and use the custom
* clause API for all storage clauses instead.
* <p>
* Storage clauses will be separated from previous elements by a separator
* (whitespace or newline) to ensure syntactic integrity.
* <p>
* Example usage:
* <p>
* <code><pre>
* DSL.using(configuration)
* .createTable("t")
* .column(field("i", SQLDataType.INTEGER))
* .storage("TABLESPACE my_tablespace")
* .execute();
* </pre></code>
* <p>
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
* guarantee syntax integrity. You may also create the possibility of
* malicious SQL injection. Be sure to properly use bind variables and/or
* escape literals when concatenated into SQL clauses! One way to escape
* literals is to use {@link DSL#name(String...)} and similar methods
* Add the <code>STORAGE</code> clause to the <code>CREATE TABLE</code> statement.
*
* @param sql The SQL
* @see SQL
*/
@NotNull @CheckReturnValue
@Support
@PlainSQL
CreateTableFinalStep storage(String sql);
@NotNull @CheckReturnValue
CreateTableFinalStep storage(@Stringly.SQL String storage, QueryPart... parts);
/**
* Add vendor-specific storage clauses to the <code>CREATE TABLE</code> statement.
* <p>
* Storage clauses will always be appended to the <em>end</em> of everything
* else that jOOQ renders, including possibly other storage clauses, such as
* {@link CreateTableOnCommitStep#onCommitDeleteRows()} or similar clauses.
* If custom storage clauses should be mixed with jOOQ-provided storage
* clauses, it is recommended not to use the jOOQ API and use the custom
* clause API for all storage clauses instead.
* <p>
* Storage clauses will be separated from previous elements by a separator
* (whitespace or newline) to ensure syntactic integrity.
* <p>
* Example usage:
* <p>
* <code><pre>
* DSL.using(configuration)
* .createTable("t")
* .column(field("i", SQLDataType.INTEGER))
* .storage("TABLESPACE my_tablespace")
* .execute();
* </pre></code>
* <p>
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
* guarantee syntax integrity. You may also create the possibility of
* malicious SQL injection. Be sure to properly use bind variables and/or
* escape literals when concatenated into SQL clauses! One way to escape
* literals is to use {@link DSL#name(String...)} and similar methods
* Add the <code>STORAGE</code> clause to the <code>CREATE TABLE</code> statement.
*
* @param sql The SQL
* @param bindings The bindings
* @see SQL
*/
@NotNull @CheckReturnValue
@Support
@PlainSQL
CreateTableFinalStep storage(String sql, Object... bindings);
@NotNull @CheckReturnValue
CreateTableFinalStep storage(@Stringly.SQL String storage, Object... bindings);
/**
* Add vendor-specific storage clauses to the <code>CREATE TABLE</code>
* statement.
* <p>
* Storage clauses will always be appended to the <em>end</em> of everything
* else that jOOQ renders, including possibly other storage clauses, such as
* {@link CreateTableOnCommitStep#onCommitDeleteRows()} or similar clauses.
* If custom storage clauses should be mixed with jOOQ-provided storage
* clauses, it is recommended not to use the jOOQ API and use the custom
* clause API for all storage clauses instead.
* <p>
* Storage clauses will be separated from previous elements by a separator
* (whitespace or newline) to ensure syntactic integrity.
* <p>
* Example usage:
* <p>
* <code><pre>
* DSL.using(configuration)
* .createTable("t")
* .column(field("i", SQLDataType.INTEGER))
* .storage("TABLESPACE my_tablespace")
* .execute();
* </pre></code>
* <p>
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
* guarantee syntax integrity. You may also create the possibility of
* malicious SQL injection. Be sure to properly use bind variables and/or
* escape literals when concatenated into SQL clauses! One way to escape
* literals is to use {@link DSL#name(String...)} and similar methods
* Add the <code>STORAGE</code> clause to the <code>CREATE TABLE</code> statement.
*
* @param sql The SQL
* @param parts The {@link QueryPart} objects that are rendered at the
* {numbered placeholder} locations
* @see SQL
*/
@NotNull @CheckReturnValue
@Support
@PlainSQL
CreateTableFinalStep storage(String sql, QueryPart... parts);
@NotNull @CheckReturnValue
CreateTableFinalStep storage(@Stringly.SQL String storage);
}

View File

@ -37,37 +37,14 @@
*/
package org.jooq;
// ...
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.CUBRID;
// ...
import static org.jooq.SQLDialect.DERBY;
// ...
import static org.jooq.SQLDialect.H2;
// ...
import static org.jooq.SQLDialect.HSQLDB;
// ...
import static org.jooq.SQLDialect.MARIADB;
// ...
import static org.jooq.SQLDialect.MYSQL;
// ...
import static org.jooq.SQLDialect.POSTGRES;
// ...
// ...
// ...
import static org.jooq.SQLDialect.SQLITE;
// ...
// ...
// ...
import static org.jooq.SQLDialect.YUGABYTEDB;
import static org.jooq.SQLDialect.*;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import org.jetbrains.annotations.*;
/**
* A {@link Query} that can create tables.
* A step in the construction of the <code>CREATE TABLE</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
@ -86,22 +63,21 @@ import org.jetbrains.annotations.NotNull;
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*
* @author Lukas Eder
*/
@SuppressWarnings({ "unused" })
public interface CreateTableWithDataStep extends CreateTableOnCommitStep {
/**
* Add a <code>WITH DATA</code> clause.
* Add the <code>WITH DATA</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ CUBRID, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableCommentStep withData();
@NotNull @CheckReturnValue
CreateTableOnCommitStep withData();
/**
* Add a <code>WITH DATA</code> clause.
* Add the <code>WITH NO DATA</code> clause to the <code>CREATE TABLE</code> statement.
*/
@NotNull @CheckReturnValue
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableCommentStep withNoData();
@NotNull @CheckReturnValue
CreateTableOnCommitStep withNoData();
}

View File

@ -9992,6 +9992,172 @@ public interface DSLContext extends Scope {
/**
* The <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(String)
*/
@NotNull @CheckReturnValue
@Support
CreateTableElementListStep createTable(@Stringly.Name String table);
/**
* The <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(Name)
*/
@NotNull @CheckReturnValue
@Support
CreateTableElementListStep createTable(Name table);
/**
* The <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(Table)
*/
@NotNull @CheckReturnValue
@Support
CreateTableElementListStep createTable(Table<?> table);
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createTableIfNotExists(@Stringly.Name String table);
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createTableIfNotExists(Name table);
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createTableIfNotExists(Table<?> table);
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTable(@Stringly.Name String table);
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTable(Name table);
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTable(Table<?> table);
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTableIfNotExists(@Stringly.Name String table);
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTableIfNotExists(Name table);
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createTemporaryTableIfNotExists(Table<?> table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTable(@Stringly.Name String table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTable(Name table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTable(Table<?> table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createGlobalTemporaryTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTableIfNotExists(@Stringly.Name String table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createGlobalTemporaryTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Name table);
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createGlobalTemporaryTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Table<?> table);
@ -10960,141 +11126,6 @@ public interface DSLContext extends Scope {
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(String)
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep createTable(String table);
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(Name)
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep createTable(Name table);
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTable(Table)
*/
@NotNull @CheckReturnValue
@Support
CreateTableColumnStep createTable(Table<?> table);
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableColumnStep createTableIfNotExists(String table);
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableColumnStep createTableIfNotExists(Name table);
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSL#createTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
CreateTableColumnStep createTableIfNotExists(Table<?> table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTable(String table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTable(Name table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSL#createTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTable(Table<?> table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTableIfNotExists(String table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTableIfNotExists(Name table);
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
*
* @see DSL#createTemporaryTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table);
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createGlobalTemporaryTable(String table);
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createGlobalTemporaryTable(Name table);
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSL#createGlobalTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
CreateTableColumnStep createGlobalTemporaryTable(Table<?> table);
/**
* Create a new DSL <code>CREATE VIEW</code> statement.

View File

@ -150,7 +150,8 @@ extends
GroupField,
OrderField<T>,
FieldOrRow,
FieldOrConstraint
FieldOrConstraint,
TableElement
{
// ------------------------------------------------------------------------

View File

@ -46,10 +46,12 @@ package org.jooq;
* Instances of this type cannot be created directly, only of its subtypes.
*
* @author Lukas Eder
* @deprecated - 3.17.0 - [#13005] - Use {@link TableElement} instead.
*/
@Deprecated
public /* sealed */ interface FieldOrConstraint
extends
Named
TableElement
/* permits
Field,
Constraint */

View File

@ -53,7 +53,7 @@ import org.jetbrains.annotations.ApiStatus.Experimental;
*
* @author Lukas Eder
*/
public interface Index extends Named {
public /* non-sealed */ interface Index extends TableElement {
/**
* The table on which this index is defined.

View File

@ -40,8 +40,8 @@ package org.jooq;
import org.jooq.impl.QOM;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.ApiStatus.Experimental;
import org.jetbrains.annotations.NotNull;
/**

View File

@ -74,6 +74,87 @@ package org.jooq;

View File

@ -0,0 +1,60 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
/**
* A common base type for {@link Field}, {@link Constraint}, and {@link Index}
* where DSL API accepts all types alike.
* <p>
* This is useful for DDL statements.
* <p>
* Instances of this type cannot be created directly, only of its subtypes.
*
* @author Lukas Eder
*/
public /* sealed */ interface TableElement
extends
Named
/* permits
FieldOrConstraint,
Field,
Constraint,
Index */
{
}

View File

@ -40,9 +40,14 @@ package org.jooq;
// ...
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.TableOptions.OnCommit.DELETE_ROWS;
import static org.jooq.TableOptions.OnCommit.DROP;
import static org.jooq.TableOptions.OnCommit.PRESERVE_ROWS;
import java.io.Serializable;
import org.jooq.impl.QOM.TableCommitAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -141,6 +146,22 @@ public final class TableOptions implements Serializable {
return new TableOptions(onCommit);
}
/**
* Create a new {@link TableOptions} object for a {@link TableType#TEMPORARY}.
*/
@NotNull
public static final TableOptions temporaryTable(TableCommitAction onCommit) {
if (onCommit == null)
return new TableOptions((OnCommit) null);
switch (onCommit) {
case DELETE_ROWS: return temporaryTable(DELETE_ROWS);
case PRESERVE_ROWS: return temporaryTable(PRESERVE_ROWS);
case DROP: return temporaryTable(DROP);
default: throw new IllegalArgumentException("TableCommitAction not supported: " + onCommit);
}
}
/**
* Create a new {@link TableOptions} object for a {@link TableType#VIEW} of
* unknown content.

View File

@ -39,7 +39,6 @@
package org.jooq.impl;
import static org.jooq.impl.AbstractName.NO_NAME;
import static org.jooq.impl.Tools.findAny;
import java.util.ArrayList;
import java.util.List;

View File

@ -199,6 +199,7 @@ import org.jooq.Record1;
import org.jooq.SQLDialect;
import org.jooq.Select;
import org.jooq.Table;
import org.jooq.TableElement;
// ...
import org.jooq.impl.QOM.Cascade;
import org.jooq.impl.QOM.UNotYetImplemented;
@ -223,18 +224,18 @@ implements
UNotYetImplemented
{
private static final Clause[] CLAUSES = { ALTER_TABLE };
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, MARIADB);
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS_COLUMN = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS_CONSTRAINT = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS_COLUMN = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> SUPPORT_RENAME_COLUMN = SQLDialect.supportedBy(DERBY);
private static final Set<SQLDialect> SUPPORT_RENAME_TABLE = SQLDialect.supportedBy(DERBY);
private static final Set<SQLDialect> NO_SUPPORT_RENAME_QUALIFIED_TABLE = SQLDialect.supportedBy(POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> NO_SUPPORT_ALTER_TYPE_AND_NULL = SQLDialect.supportedBy(POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> NO_SUPPORT_DROP_CONSTRAINT = SQLDialect.supportedBy(MARIADB, MYSQL);
private static final Set<SQLDialect> REQUIRE_REPEAT_ADD_ON_MULTI_ALTER = SQLDialect.supportedBy(FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> REQUIRE_REPEAT_DROP_ON_MULTI_ALTER = SQLDialect.supportedBy(FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB);
private static final Clause[] CLAUSES = { ALTER_TABLE };
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, MARIADB);
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS_COLUMN = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS_CONSTRAINT = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> NO_SUPPORT_IF_NOT_EXISTS_COLUMN = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
private static final Set<SQLDialect> SUPPORT_RENAME_COLUMN = SQLDialect.supportedBy(DERBY);
private static final Set<SQLDialect> SUPPORT_RENAME_TABLE = SQLDialect.supportedBy(DERBY);
private static final Set<SQLDialect> NO_SUPPORT_RENAME_QUALIFIED_TABLE = SQLDialect.supportedBy(POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> NO_SUPPORT_ALTER_TYPE_AND_NULL = SQLDialect.supportedBy(POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> NO_SUPPORT_DROP_CONSTRAINT = SQLDialect.supportedBy(MARIADB, MYSQL);
private static final Set<SQLDialect> REQUIRE_REPEAT_ADD_ON_MULTI_ALTER = SQLDialect.supportedBy(FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB);
private static final Set<SQLDialect> REQUIRE_REPEAT_DROP_ON_MULTI_ALTER = SQLDialect.supportedBy(FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB);
@ -248,41 +249,41 @@ implements
private final Table<?> table;
private final boolean ifExists;
private boolean ifExistsColumn;
private boolean ifExistsConstraint;
private boolean ifNotExistsColumn;
private Comment comment;
private Table<?> renameTo;
private Field<?> renameColumn;
private Field<?> renameColumnTo;
private Index renameIndex;
private Index renameIndexTo;
private Constraint renameConstraint;
private Constraint renameConstraintTo;
private QueryPartList<FieldOrConstraint> add;
private Field<?> addColumn;
private DataType<?> addColumnType;
private Constraint addConstraint;
private boolean addFirst;
private Field<?> addBefore;
private Field<?> addAfter;
private final Table<?> table;
private final boolean ifExists;
private boolean ifExistsColumn;
private boolean ifExistsConstraint;
private boolean ifNotExistsColumn;
private Comment comment;
private Table<?> renameTo;
private Field<?> renameColumn;
private Field<?> renameColumnTo;
private Index renameIndex;
private Index renameIndexTo;
private Constraint renameConstraint;
private Constraint renameConstraintTo;
private QueryPartList<TableElement> add;
private Field<?> addColumn;
private DataType<?> addColumnType;
private Constraint addConstraint;
private boolean addFirst;
private Field<?> addBefore;
private Field<?> addAfter;
private Constraint alterConstraint;
private boolean alterConstraintEnforced;
private Field<?> alterColumn;
private Nullability alterColumnNullability;
private DataType<?> alterColumnType;
private Field<?> alterColumnDefault;
private boolean alterColumnDropDefault;
private QueryPartList<Field<?>> dropColumns;
private Constraint dropConstraint;
private ConstraintType dropConstraintType;
private Cascade dropCascade;
private Constraint alterConstraint;
private boolean alterConstraintEnforced;
private Field<?> alterColumn;
private Nullability alterColumnNullability;
private DataType<?> alterColumnType;
private Field<?> alterColumnDefault;
private boolean alterColumnDropDefault;
private QueryPartList<Field<?>> dropColumns;
private Constraint dropConstraint;
private ConstraintType dropConstraintType;
private Cascade dropCascade;
AlterTableImpl(Configuration configuration, Table<?> table) {
this(configuration, table, false);
@ -300,7 +301,7 @@ implements
final boolean $ifExistsColumn() { return ifExistsColumn; }
final boolean $ifExistsConstraint() { return ifExistsConstraint; }
final boolean $ifNotExistsColumn() { return ifNotExistsColumn; }
final List<FieldOrConstraint> $add() { return add; }
final List<TableElement> $add() { return add; }
final Field<?> $addColumn() { return addColumn; }
final DataType<?> $addColumnType() { return addColumnType; }
final Constraint $addConstraint() { return addConstraint; }
@ -457,21 +458,23 @@ implements
}
@Override
public final AlterTableImpl add(FieldOrConstraint... fields) {
public final AlterTableImpl add(TableElement... fields) {
return add(Arrays.asList(fields));
}
@Override
public final AlterTableImpl add(Collection<? extends FieldOrConstraint> fields) {
public final AlterTableImpl add(Collection<? extends TableElement> fields) {
// [#9570] Better portability of single item ADD statements
if (fields.size() == 1) {
FieldOrConstraint first = fields.iterator().next();
TableElement first = fields.iterator().next();
if (first instanceof Field)
return add((Field<?>) first);
else if (first instanceof Constraint)
return add((Constraint) first);
else if (first instanceof Index)
throw new UnsupportedOperationException("ALTER TABLE .. ADD INDEX not yet supported, see https://github.com/jOOQ/jOOQ/issues/13006");
}
add = new QueryPartList<>(fields);
@ -1295,7 +1298,7 @@ implements
ctx.visit(addColumnKeyword(ctx)).sql(' ');
}
FieldOrConstraint part = add.get(i);
TableElement part = add.get(i);
ctx.qualify(false, c -> c.visit(part));
if (part instanceof Field) { Field<?> f = (Field<?>) part;

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,6 @@ import static org.jooq.impl.Tools.map;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.jooq.Check;
@ -138,7 +137,7 @@ final class DDL {
.constraints(constraints);
if (temporary && onCommit != null) {
switch (table.getOptions().onCommit()) {
switch (onCommit) {
case DELETE_ROWS:
return asList(s0.onCommitDeleteRows());
case PRESERVE_ROWS:

View File

@ -191,7 +191,6 @@ import org.jooq.ConstraintForeignKeyReferencesStep9;
import org.jooq.ConstraintForeignKeyReferencesStepN;
import org.jooq.ConstraintTypeStep;
// ...
import org.jooq.CreateTableColumnStep;
import org.jooq.CreateTypeStep;
import org.jooq.CreateViewAsStep;
import org.jooq.DSLContext;
@ -8376,6 +8375,280 @@ public class DSL {
/**
* The <code>CREATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTable(String)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.CreateTableElementListStep createTable(@Stringly.Name String table) {
return dsl().createTable(table);
}
/**
* The <code>CREATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTable(Name)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.CreateTableElementListStep createTable(Name table) {
return dsl().createTable(table);
}
/**
* The <code>CREATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTable(Table)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.CreateTableElementListStep createTable(Table<?> table) {
return dsl().createTable(table);
}
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTableIfNotExists(@Stringly.Name String table) {
return dsl().createTableIfNotExists(table);
}
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTableIfNotExists(Name table) {
return dsl().createTableIfNotExists(table);
}
/**
* The <code>CREATE TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTableIfNotExists(Table<?> table) {
return dsl().createTableIfNotExists(table);
}
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTable(@Stringly.Name String table) {
return dsl().createTemporaryTable(table);
}
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTable(Name table) {
return dsl().createTemporaryTable(table);
}
/**
* The <code>CREATE TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTable(Table<?> table) {
return dsl().createTemporaryTable(table);
}
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(@Stringly.Name String table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(Name table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* The <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createTemporaryTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(Table<?> table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTable(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTable(@Stringly.Name String table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTable(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTable(Name table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTable(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTable(Table<?> table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTableIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(@Stringly.Name String table) {
return dsl().createGlobalTemporaryTableIfNotExists(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTableIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Name table) {
return dsl().createGlobalTemporaryTableIfNotExists(table);
}
/**
* The <code>CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#createGlobalTemporaryTableIfNotExists(Table)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Table<?> table) {
return dsl().createGlobalTemporaryTableIfNotExists(table);
}
@ -9950,171 +10223,6 @@ public class DSL {
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTable(String)
*/
@NotNull
@Support
public static CreateTableColumnStep createTable(String table) {
return dsl().createTable(table);
}
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTable(Name)
*/
@NotNull
@Support
public static CreateTableColumnStep createTable(Name table) {
return dsl().createTable(table);
}
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTable(Table)
*/
@NotNull
@Support
public static CreateTableColumnStep createTable(Table<?> table) {
return dsl().createTable(table);
}
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTableIfNotExists(String)
*/
@NotNull
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static CreateTableColumnStep createTableIfNotExists(String table) {
return dsl().createTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTableIfNotExists(Name)
*/
@NotNull
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static CreateTableColumnStep createTableIfNotExists(Name table) {
return dsl().createTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE TABLE</code> statement.
*
* @see DSLContext#createTableIfNotExists(Table)
*/
@NotNull
@Support({ FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static CreateTableColumnStep createTableIfNotExists(Table<?> table) {
return dsl().createTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTable(String)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTable(String table) {
return dsl().createTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTable(Name)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTable(Name table) {
return dsl().createTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTable(Table)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTable(Table<?> table) {
return dsl().createTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTableIfNotExists(String)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTableIfNotExists(String table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTableIfNotExists(Name)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTableIfNotExists(Name table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createTemporaryTableIfNotExists(Table)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table) {
return dsl().createTemporaryTableIfNotExists(table);
}
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createGlobalTemporaryTable(String)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createGlobalTemporaryTable(String table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createGlobalTemporaryTable(Name)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createGlobalTemporaryTable(Name table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
*
* @see DSLContext#createGlobalTemporaryTable(Table)
*/
@NotNull
@Support({ FIREBIRD, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
public static CreateTableColumnStep createGlobalTemporaryTable(Table<?> table) {
return dsl().createGlobalTemporaryTable(table);
}
/**
* Create a new DSL <code>CREATE VIEW</code> statement.

View File

@ -110,7 +110,6 @@ import org.jooq.ConnectionProvider;
import org.jooq.ConnectionRunnable;
import org.jooq.ContextTransactionalCallable;
import org.jooq.ContextTransactionalRunnable;
import org.jooq.CreateTableColumnStep;
import org.jooq.CreateTypeStep;
import org.jooq.CreateViewAsStep;
import org.jooq.Cursor;
@ -3270,6 +3269,100 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
@Override
public org.jooq.CreateTableElementListStep createTable(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), false, false);
}
@Override
public org.jooq.CreateTableElementListStep createTable(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), false, false);
}
@Override
public org.jooq.CreateTableElementListStep createTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, false, false);
}
@Override
public org.jooq.CreateTableElementListStep createTableIfNotExists(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), false, true);
}
@Override
public org.jooq.CreateTableElementListStep createTableIfNotExists(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), false, true);
}
@Override
public org.jooq.CreateTableElementListStep createTableIfNotExists(Table<?> table) {
return new CreateTableImpl(configuration(), table, false, true);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTable(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), true, false);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTable(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), true, false);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, false);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), true, true);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), true, true);
}
@Override
public org.jooq.CreateTableElementListStep createTemporaryTableIfNotExists(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, true);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTable(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), true, false);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTable(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), true, false);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, false);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(@Stringly.Name String table) {
return new CreateTableImpl(configuration(), DSL.table(DSL.name(table)), true, true);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Name table) {
return new CreateTableImpl(configuration(), DSL.table(table), true, true);
}
@Override
public org.jooq.CreateTableElementListStep createGlobalTemporaryTableIfNotExists(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, true);
}
@ -4029,81 +4122,6 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new CreateViewImpl<>(configuration(), view, fieldNameFunction, true, false);
}
@Override
public CreateTableColumnStep createTable(String table) {
return createTable(name(table));
}
@Override
public CreateTableColumnStep createTable(Name table) {
return createTable(table(table));
}
@Override
public CreateTableColumnStep createTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, false, false);
}
@Override
public CreateTableColumnStep createTableIfNotExists(String table) {
return createTableIfNotExists(name(table));
}
@Override
public CreateTableColumnStep createTableIfNotExists(Name table) {
return createTableIfNotExists(table(table));
}
@Override
public CreateTableColumnStep createTableIfNotExists(Table<?> table) {
return new CreateTableImpl(configuration(), table, false, true);
}
@Override
public CreateTableColumnStep createTemporaryTable(String table) {
return createTemporaryTable(name(table));
}
@Override
public CreateTableColumnStep createTemporaryTable(Name table) {
return createTemporaryTable(table(table));
}
@Override
public CreateTableColumnStep createTemporaryTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, false);
}
@Override
public CreateTableColumnStep createTemporaryTableIfNotExists(String table) {
return createTemporaryTableIfNotExists(name(table));
}
@Override
public CreateTableColumnStep createTemporaryTableIfNotExists(Name table) {
return createTemporaryTableIfNotExists(table(table));
}
@Override
public CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, true);
}
@Override
public CreateTableColumnStep createGlobalTemporaryTable(String table) {
return createGlobalTemporaryTable(name(table));
}
@Override
public CreateTableColumnStep createGlobalTemporaryTable(Name table) {
return createGlobalTemporaryTable(table(table));
}
@Override
public CreateTableColumnStep createGlobalTemporaryTable(Table<?> table) {
return new CreateTableImpl(configuration(), table, true, false);
}
@Override
public CreateTypeStep createType(String type) {
return createType(name(type));

View File

@ -44,8 +44,10 @@ import java.lang.reflect.Array;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.jooq.Attachable;
import org.jooq.Binding;
import org.jooq.Check;
import org.jooq.Configuration;
import org.jooq.Converter;
import org.jooq.DataType;
import org.jooq.Domain;
@ -494,4 +496,12 @@ public final class Internal {
public static final void requireCommercial(Supplier<String> logMessage) throws DataAccessException {
CTX.configuration().requireCommercial(logMessage);
}
/**
* Retrieve a {@link Configuration} from an attachable, or the default
* {@link Configuration} if the attachable is detached.
*/
public static final Configuration configuration(Attachable attachable) {
return Tools.configuration(attachable);
}
}

View File

@ -101,6 +101,7 @@ import org.jooq.Sequence;
import org.jooq.SortField;
import org.jooq.SortOrder;
import org.jooq.Table;
import org.jooq.TableElement;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.TableOptions.TableType;
@ -327,7 +328,7 @@ final class Interpreter {
return;
}
MutableTable mt = newTable(table, schema, query.$columnFields(), query.$columnTypes(), query.$select(), query.$comment(), query.$temporary() ? TableOptions.temporaryTable(query.$onCommit()) : TableOptions.table());
MutableTable mt = newTable(table, schema, query.$columns(), query.$select(), query.$comment(), query.$temporary() ? TableOptions.temporaryTable(query.$onCommit()) : TableOptions.table());
for (Constraint constraint : query.$constraints())
addConstraint(query, (ConstraintImpl) constraint, mt);
@ -499,7 +500,7 @@ final class Interpreter {
throw objectNotTable(table);
if (query.$add() != null) {
for (FieldOrConstraint fc : query.$add())
for (TableElement fc : query.$add())
if (fc instanceof Field && find(existing.fields, (Field<?>) fc) != null)
throw alreadyExists(fc);
else if (fc instanceof Constraint && !fc.getUnqualifiedName().empty() && existing.constraint((Constraint) fc) != null)
@ -523,7 +524,7 @@ final class Interpreter {
addField(existing, index, (UnqualifiedName) f.getUnqualifiedName(), f.getDataType());
}
else {
for (FieldOrConstraint fc : query.$add())
for (TableElement fc : query.$add())
if (fc instanceof Field)
addField(existing, Integer.MAX_VALUE, (UnqualifiedName) fc.getUnqualifiedName(), ((Field<?>) fc).getDataType());
else if (fc instanceof ConstraintImpl)
@ -701,9 +702,9 @@ final class Interpreter {
throw unsupportedQuery(query);
}
private final Iterable<Field<?>> assertFields(Query query, Iterable<FieldOrConstraint> fields) {
private final Iterable<Field<?>> assertFields(Query query, Iterable<TableElement> fields) {
return () -> new Iterator<Field<?>>() {
final Iterator<FieldOrConstraint> it = fields.iterator();
final Iterator<TableElement> it = fields.iterator();
@Override
public boolean hasNext() {
@ -712,7 +713,7 @@ final class Interpreter {
@Override
public Field<?> next() {
FieldOrConstraint next = it.next();
TableElement next = it.next();
if (next instanceof Field)
return (Field<?>) next;
@ -810,11 +811,7 @@ final class Interpreter {
return;
}
List<DataType<?>> columnTypes = query.$select() != null
? dataTypes(query.$select())
: map(query.$fields(), f -> f.getDataType());
newTable(table, schema, query.$fields(), columnTypes, query.$select(), null, TableOptions.view(query.$select()));
newTable(table, schema, query.$fields(), query.$select(), null, TableOptions.view(query.$select()));
}
private final void accept0(AlterViewImpl query) {
@ -1251,16 +1248,16 @@ final class Interpreter {
Table<?> table,
MutableSchema schema,
List<? extends Field<?>> columns,
List<? extends DataType<?>> columnTypes,
Select<?> select,
Comment comment,
TableOptions options
) {
MutableTable t = new MutableTable((UnqualifiedName) table.getUnqualifiedName(), schema, comment, options);
// TODO: [#13003] Merge the column and select types if both are available
if (!columns.isEmpty())
for (int i = 0; i < columns.size(); i++)
addField(t, Integer.MAX_VALUE, (UnqualifiedName) columns.get(i).getUnqualifiedName(), columnTypes.get(i));
addField(t, Integer.MAX_VALUE, (UnqualifiedName) columns.get(i).getUnqualifiedName(), columns.get(i).getDataType());
else if (select != null)
for (Field<?> column : select.fields())
addField(t, Integer.MAX_VALUE, (UnqualifiedName) column.getUnqualifiedName(), column.getDataType());

View File

@ -529,9 +529,8 @@ import org.jooq.CreateIndexWhereStep;
// ...
// ...
import org.jooq.CreateSequenceFlagsStep;
import org.jooq.CreateTableColumnStep;
import org.jooq.CreateTableCommentStep;
import org.jooq.CreateTableConstraintStep;
import org.jooq.CreateTableElementListStep;
import org.jooq.CreateTableOnCommitStep;
import org.jooq.CreateTableStorageStep;
import org.jooq.CreateTableWithDataStep;
@ -645,6 +644,7 @@ import org.jooq.SortField;
import org.jooq.SortOrder;
import org.jooq.Statement;
import org.jooq.Table;
import org.jooq.TableElement;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOnStep;
@ -4394,7 +4394,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
else
ctas = true;
CreateTableColumnStep columnStep = ifNotExists
CreateTableElementListStep elementListStep = ifNotExists
? temporary
? dsl.createTemporaryTableIfNotExists(tableName)
: dsl.createTableIfNotExists(tableName)
@ -4403,14 +4403,14 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
: dsl.createTable(tableName);
if (!fields.isEmpty())
columnStep = columnStep.columns(fields);
elementListStep = elementListStep.columns(fields);
// [#12888] To avoid ambiguities with T-SQL's support for statement batches
// without statement separators, let's accept MySQL's optional AS
// keyword only for empty field lists
if (parseKeywordIf("AS") || fields.isEmpty() && peekSelectOrWith(true)) {
boolean previousMetaLookupsForceIgnore = metaLookupsForceIgnore();
CreateTableWithDataStep withDataStep = columnStep.as((Select<Record>) metaLookupsForceIgnore(false).parseQuery(true, true));
CreateTableWithDataStep withDataStep = elementListStep.as((Select<Record>) metaLookupsForceIgnore(false).parseQuery(true, true));
metaLookupsForceIgnore(previousMetaLookupsForceIgnore);
commentStep =
parseKeywordIf("WITH DATA")
@ -4423,9 +4423,9 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
throw expected("AS, WITH, SELECT, or (");
}
else {
CreateTableConstraintStep constraintStep = constraints.isEmpty()
? columnStep
: columnStep.constraints(constraints);
CreateTableElementListStep constraintStep = constraints.isEmpty()
? elementListStep
: elementListStep.constraints(constraints);
CreateTableOnCommitStep onCommitStep = indexes.isEmpty()
? constraintStep
: constraintStep.indexes(indexes);
@ -5297,7 +5297,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
}
private final DDLQuery parseAlterTableAdd(AlterTableStep s1, Table<?> tableName) {
List<FieldOrConstraint> list = new ArrayList<>();
List<TableElement> list = new ArrayList<>();
if (parseIndexOrKeyIf()) {
Name name = parseIdentifierIf();
@ -5358,7 +5358,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|| parseKeywordIf("KEY");
}
private final void parseAlterTableAddFieldsOrConstraints(List<FieldOrConstraint> list) {
private final void parseAlterTableAddFieldsOrConstraints(List<TableElement> list) {
ConstraintTypeStep constraint = parseConstraintNameSpecification();
if (parsePrimaryKeyClusteredNonClusteredKeywordIf())
@ -5382,7 +5382,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
return null;
}
private final Field<?> parseAlterTableAddField(List<FieldOrConstraint> list) {
private final Field<?> parseAlterTableAddField(List<TableElement> list) {
// The below code is taken from CREATE TABLE, with minor modifications as
// https://github.com/jOOQ/jOOQ/issues/5317 has not yet been implemented

View File

@ -110,6 +110,7 @@ import org.jooq.Role;
import org.jooq.Row;
import org.jooq.RowCountQuery;
import org.jooq.RowId;
import org.jooq.SQL;
import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Select;
@ -117,6 +118,7 @@ import org.jooq.Sequence;
import org.jooq.Spatial;
import org.jooq.Statement;
import org.jooq.Table;
import org.jooq.TableElement;
// ...
// ...
import org.jooq.WindowDefinition;
@ -1339,6 +1341,37 @@ public final class QOM {
/**
* The <code>CREATE TABLE</code> statement.
*/
public /*sealed*/ interface CreateTable
extends
DDLQuery
//permits
// CreateTableImpl
{
@NotNull Table<?> $table();
boolean $temporary();
boolean $ifNotExists();
@NotNull UnmodifiableList<? extends TableElement> $tableElements();
@Nullable Select<?> $select();
@Nullable WithOrWithoutData $withData();
@Nullable TableCommitAction $onCommit();
@Nullable Comment $comment();
@Nullable SQL $storage();
@NotNull CreateTable $table(Table<?> table);
@NotNull CreateTable $temporary(boolean temporary);
@NotNull CreateTable $ifNotExists(boolean ifNotExists);
@NotNull CreateTable $tableElements(Collection<? extends TableElement> tableElements);
@NotNull CreateTable $select(Select<?> select);
@NotNull CreateTable $withData(WithOrWithoutData withData);
@NotNull CreateTable $onCommit(TableCommitAction onCommit);
@NotNull CreateTable $comment(Comment comment);
@NotNull CreateTable $storage(SQL storage);
}
@ -5721,6 +5754,41 @@ public final class QOM {
}
}
/**
* The <code>WithOrWithoutData</code> type.
* <p>
* Specify whether a table created from a subquery should include the subquery's data.
*/
public enum WithOrWithoutData {
WITH_DATA(keyword("with data")),
WITH_NO_DATA(keyword("with no data")),
;
final Keyword keyword;
private WithOrWithoutData(Keyword keyword) {
this.keyword = keyword;
}
}
/**
* The <code>TableCommitAction</code> type.
* <p>
* Specify the action to be taken on temporary tables when committing.
*/
public enum TableCommitAction {
DELETE_ROWS(keyword("delete rows")),
PRESERVE_ROWS(keyword("preserve rows")),
DROP(keyword("drop")),
;
final Keyword keyword;
private TableCommitAction(Keyword keyword) {
this.keyword = keyword;
}
}