[#7120] Add org.jooq.Collation and DSL.collation(String)

This commit is contained in:
lukaseder 2018-01-30 11:33:29 +01:00
parent a6f6acf54f
commit 6ae89a844f
3 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,51 @@
/*
* 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 collation.
*
* @author Lukas Eder
*/
public interface Collation extends QueryPart {
/**
* The name of the collation.
*/
String getName();
}

View File

@ -0,0 +1,71 @@
/*
* 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.impl;
import org.jooq.Clause;
import org.jooq.Collation;
import org.jooq.Context;
import org.jooq.Name;
/**
* @author Lukas Eder
*/
final class CollationImpl extends AbstractQueryPart implements Collation {
private static final long serialVersionUID = 21679143762776222L;
private final Name name;
CollationImpl(Name name) {
this.name = name;
}
@Override
public final void accept(Context<?> ctx) {
ctx.visit(name);
}
@Override
public final Clause[] clauses(Context<?> ctx) {
return null;
}
@Override
public final String getName() {
return name.last();
}
}

View File

@ -118,6 +118,7 @@ import org.jooq.Case;
import org.jooq.CaseConditionStep;
import org.jooq.CaseValueStep;
import org.jooq.Catalog;
import org.jooq.Collation;
import org.jooq.Comment;
import org.jooq.CommentOnIsStep;
import org.jooq.CommonTableExpression;
@ -8260,6 +8261,24 @@ public class DSL {
return dsl().revoke(privileges);
}
// -------------------------------------------------------------------------
// XXX Other objects
// -------------------------------------------------------------------------
/**
* Create a collation by its unqualified name.
*/
public static Collation collation(String collation) {
return collation(name(collation));
}
/**
* Create a collation by its qualified name.
*/
public static Collation collation(Name collation) {
return new CollationImpl(collation);
}
/**
* Create a new privilege reference.
* <p>