diff --git a/jOOQ/src/main/java/org/jooq/CreateIndexStep.java b/jOOQ/src/main/java/org/jooq/CreateIndexStep.java index ba81262b02..f87018fdfe 100644 --- a/jOOQ/src/main/java/org/jooq/CreateIndexStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateIndexStep.java @@ -70,11 +70,11 @@ public interface CreateIndexStep { * Specify the table and column expressions on which to create an index. */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) - CreateIndexFinalStep on(Table table, Field... fields); + CreateIndexWhereStep on(Table table, Field... fields); /** * Specify the table and column expressions on which to create an index. */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) - CreateIndexFinalStep on(String tableName, String... fieldNames); + CreateIndexWhereStep on(String tableName, String... fieldNames); } diff --git a/jOOQ/src/main/java/org/jooq/CreateIndexWhereStep.java b/jOOQ/src/main/java/org/jooq/CreateIndexWhereStep.java new file mode 100644 index 0000000000..cd32bc53f6 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/CreateIndexWhereStep.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * 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 java.util.Collection; + +import org.jooq.impl.DSL; + +/** + * A {@link Query} that can create indexes. + * + * @author Lukas Eder + */ +public interface CreateIndexWhereStep extends CreateIndexFinalStep { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/CreateIndexImpl.java b/jOOQ/src/main/java/org/jooq/impl/CreateIndexImpl.java index 93bb117fb7..c563ed6a34 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CreateIndexImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CreateIndexImpl.java @@ -54,14 +54,18 @@ import static org.jooq.impl.DSL.field; import static org.jooq.impl.DSL.name; import static org.jooq.impl.DSL.table; +import java.util.Collection; + import org.jooq.Clause; +import org.jooq.Condition; import org.jooq.Configuration; import org.jooq.Context; -import org.jooq.CreateIndexFinalStep; import org.jooq.CreateIndexStep; +import org.jooq.CreateIndexWhereStep; import org.jooq.Field; import org.jooq.Name; import org.jooq.QueryPart; +import org.jooq.SQL; import org.jooq.Table; /** @@ -71,7 +75,7 @@ final class CreateIndexImpl extends AbstractQuery implements // Cascading interface implementations for CREATE INDEX behaviour CreateIndexStep, - CreateIndexFinalStep { + CreateIndexWhereStep { /** * Generated UID @@ -85,6 +89,9 @@ final class CreateIndexImpl extends AbstractQuery implements private Table table; private Field[] fields; + + + CreateIndexImpl(Configuration configuration, Name index, boolean unique, boolean ifNotExists) { super(configuration); @@ -98,7 +105,7 @@ final class CreateIndexImpl extends AbstractQuery implements // ------------------------------------------------------------------------ @Override - public final CreateIndexFinalStep on(Table t, Field... f) { + public final CreateIndexImpl on(Table t, Field... f) { this.table = t; this.fields = f; @@ -106,7 +113,7 @@ final class CreateIndexImpl extends AbstractQuery implements } @Override - public final CreateIndexFinalStep on(String tableName, String... fieldNames) { + public final CreateIndexImpl on(String tableName, String... fieldNames) { Field[] f = new Field[fieldNames.length]; for (int i = 0; i < f.length; i++) @@ -115,6 +122,45 @@ final class CreateIndexImpl extends AbstractQuery implements return on(table(name(tableName)), f); } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // ------------------------------------------------------------------------ // XXX: QueryPart API // ------------------------------------------------------------------------ @@ -160,6 +206,11 @@ final class CreateIndexImpl extends AbstractQuery implements .visit(new QueryPartList(fields)) .qualify(true) .sql(')'); + + + + + } @Override