[jOOQ/jOOQ#9925] Add support for xmlcomment and xmlconcat
This commit is contained in:
parent
41aefee8e8
commit
edc133bd4d
@ -389,6 +389,7 @@ import org.jooq.WithAsStep7;
|
||||
import org.jooq.WithAsStep8;
|
||||
import org.jooq.WithAsStep9;
|
||||
import org.jooq.WithStep;
|
||||
import org.jooq.XML;
|
||||
import org.jooq.conf.Settings;
|
||||
import org.jooq.exception.SQLDialectNotSupportedException;
|
||||
import org.jooq.tools.Convert;
|
||||
@ -18095,6 +18096,45 @@ public class DSL {
|
||||
return field("rownum", Integer.class);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX XML functions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The XML comment constructor.
|
||||
*/
|
||||
@Support({ POSTGRES })
|
||||
public static Field<XML> xmlcomment(String comment) {
|
||||
return xmlcomment(val(comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* The XML comment constructor.
|
||||
*/
|
||||
@Support({ POSTGRES })
|
||||
public static Field<XML> xmlcomment(Field<String> comment) {
|
||||
return new XMLComment(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* The XML concat function.
|
||||
*/
|
||||
@Support({ POSTGRES })
|
||||
|
||||
@SafeVarargs
|
||||
|
||||
public static Field<XML> xmlconcat(Field<XML>... fields) {
|
||||
return xmlconcat(asList(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The XML concat function.
|
||||
*/
|
||||
@Support({ POSTGRES })
|
||||
public static Field<XML> xmlconcat(Collection<? extends Field<XML>> fields) {
|
||||
return new XMLConcat(fields);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX JSON functions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -143,5 +143,14 @@ final class Names {
|
||||
static final Name N_UPPER = DSL.unquotedName("upper");
|
||||
static final Name N_VALUES = DSL.unquotedName("values");
|
||||
static final Name N_WIDTH_BUCKET = DSL.unquotedName("width_bucket");
|
||||
static final Name N_XMLCOMMENT = DSL.unquotedName("xmlcomment");
|
||||
static final Name N_XMLCONCAT = DSL.unquotedName("xmlconcat");
|
||||
static final Name N_XMLELEMENT = DSL.unquotedName("xmlelement");
|
||||
static final Name N_XMLATTRIBUTES = DSL.unquotedName("xmlattributes");
|
||||
static final Name N_XMLPI = DSL.unquotedName("xmlpi");
|
||||
static final Name N_XMLROOT = DSL.unquotedName("xmlroot");
|
||||
static final Name N_XMLFOREST = DSL.unquotedName("xmlforest");
|
||||
static final Name N_XMLAGG = DSL.unquotedName("xmlagg");
|
||||
static final Name N_XPATH = DSL.unquotedName("xpath");
|
||||
|
||||
}
|
||||
|
||||
67
jOOQ/src/main/java/org/jooq/impl/XMLComment.java
Normal file
67
jOOQ/src/main/java/org/jooq/impl/XMLComment.java
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 static org.jooq.impl.Names.N_XMLCOMMENT;
|
||||
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.XML;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
final class XMLComment extends AbstractField<XML> {
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 4505809303211506197L;
|
||||
private final Field<String> comment;
|
||||
|
||||
XMLComment(Field<String> comment) {
|
||||
super(N_XMLCOMMENT, SQLDataType.XML);
|
||||
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
ctx.visit(N_XMLCOMMENT).sql('(').visit(comment).sql(')');
|
||||
}
|
||||
}
|
||||
69
jOOQ/src/main/java/org/jooq/impl/XMLConcat.java
Normal file
69
jOOQ/src/main/java/org/jooq/impl/XMLConcat.java
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 static org.jooq.impl.Names.N_XMLCONCAT;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.XML;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
final class XMLConcat extends AbstractField<XML> {
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 4505809303211506197L;
|
||||
private final QueryPartList<Field<XML>> args;
|
||||
|
||||
XMLConcat(Collection<? extends Field<XML>> args) {
|
||||
super(N_XMLCONCAT, SQLDataType.XML);
|
||||
|
||||
this.args = new QueryPartList<>(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
ctx.visit(N_XMLCONCAT).sql('(').visit(args).sql(')');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user