diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 3830c60259..7b4ba92973 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -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 xmlcomment(String comment) { + return xmlcomment(val(comment)); + } + + /** + * The XML comment constructor. + */ + @Support({ POSTGRES }) + public static Field xmlcomment(Field comment) { + return new XMLComment(comment); + } + + /** + * The XML concat function. + */ + @Support({ POSTGRES }) + + @SafeVarargs + + public static Field xmlconcat(Field... fields) { + return xmlconcat(asList(fields)); + } + + /** + * The XML concat function. + */ + @Support({ POSTGRES }) + public static Field xmlconcat(Collection> fields) { + return new XMLConcat(fields); + } + // ------------------------------------------------------------------------- // XXX JSON functions // ------------------------------------------------------------------------- diff --git a/jOOQ/src/main/java/org/jooq/impl/Names.java b/jOOQ/src/main/java/org/jooq/impl/Names.java index 3c7cd29083..cd12a34165 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -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"); } diff --git a/jOOQ/src/main/java/org/jooq/impl/XMLComment.java b/jOOQ/src/main/java/org/jooq/impl/XMLComment.java new file mode 100644 index 0000000000..d7f355aaeb --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/XMLComment.java @@ -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 { + + /** + * Generated UID + */ + private static final long serialVersionUID = 4505809303211506197L; + private final Field comment; + + XMLComment(Field comment) { + super(N_XMLCOMMENT, SQLDataType.XML); + + this.comment = comment; + } + + @Override + public final void accept(Context ctx) { + ctx.visit(N_XMLCOMMENT).sql('(').visit(comment).sql(')'); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/XMLConcat.java b/jOOQ/src/main/java/org/jooq/impl/XMLConcat.java new file mode 100644 index 0000000000..73fcc32582 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/XMLConcat.java @@ -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 { + + /** + * Generated UID + */ + private static final long serialVersionUID = 4505809303211506197L; + private final QueryPartList> args; + + XMLConcat(Collection> 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(')'); + } +}