From aedb4295186ba9720c22a4a1e2b2118beeae7a28 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 14 Sep 2021 16:55:56 +0200 Subject: [PATCH] [jOOQ/jOOQ#12425] Move BIT_NAND, BIT_NOR, BIT_XNOR to API generator This includes: - [jOOQ/jOOQ#12427] Extract bitwise operations into their own classes --- jOOQ/src/main/java/org/jooq/Field.java | 108 +++---- .../java/org/jooq/impl/AbstractField.java | 72 ++--- jOOQ/src/main/java/org/jooq/impl/BitNand.java | 132 ++++++++ jOOQ/src/main/java/org/jooq/impl/BitNor.java | 132 ++++++++ jOOQ/src/main/java/org/jooq/impl/BitXNor.java | 132 ++++++++ jOOQ/src/main/java/org/jooq/impl/DSL.java | 287 ++++++++---------- .../main/java/org/jooq/impl/Expression.java | 14 - .../org/jooq/impl/ExpressionOperator.java | 15 - jOOQ/src/main/java/org/jooq/impl/Names.java | 7 +- 9 files changed, 614 insertions(+), 285 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/BitNand.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/BitNor.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/BitXNor.java diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index 905f63470f..f025affc28 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -677,6 +677,54 @@ extends + /** + * The BIT_NAND operator. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitNand(T arg2); + + /** + * The BIT_NAND operator. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitNand(Field arg2); + + /** + * The BIT_NOR operator. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitNor(T arg2); + + /** + * The BIT_NOR operator. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitNor(Field arg2); + + /** + * The BIT_X_NOR operator. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitXNor(T arg2); + + /** + * The BIT_X_NOR operator. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + Field bitXNor(Field arg2); + /** * The SHL operator. *

@@ -1152,26 +1200,6 @@ extends @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) Field bitAnd(Field value); - /** - * The bitwise not and operator. - * - * @see DSL#bitNand(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitNand(T value); - - /** - * The bitwise not and operator. - * - * @see DSL#bitNand(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitNand(Field value); - /** * The bitwise or operator. * @@ -1190,26 +1218,6 @@ extends @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) Field bitOr(Field value); - /** - * The bitwise not or operator. - * - * @see DSL#bitNor(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitNor(T value); - - /** - * The bitwise not or operator. - * - * @see DSL#bitNor(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitNor(Field value); - /** * The bitwise xor operator. * @@ -1228,26 +1236,6 @@ extends @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) Field bitXor(Field value); - /** - * The bitwise not xor operator. - * - * @see DSL#bitXNor(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitXNor(T value); - - /** - * The bitwise not xor operator. - * - * @see DSL#bitXNor(Field, Field) - * @see DSL#bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - Field bitXNor(Field value); - // ------------------------------------------------------------------------ // XML predicates // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java index d629c0a7ce..12fd1afd50 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java @@ -339,6 +339,42 @@ abstract class AbstractField extends AbstractTypedNamed implements Field bitNand(T arg2) { + return DSL.bitNand((Field) this, (Number) arg2); + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final Field bitNand(Field arg2) { + return DSL.bitNand((Field) this, (Field) arg2); + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final Field bitNor(T arg2) { + return DSL.bitNor((Field) this, (Number) arg2); + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final Field bitNor(Field arg2) { + return DSL.bitNor((Field) this, (Field) arg2); + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final Field bitXNor(T arg2) { + return DSL.bitXNor((Field) this, (Number) arg2); + } + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public final Field bitXNor(Field arg2) { + return DSL.bitXNor((Field) this, (Field) arg2); + } + @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public final Field shl(Number count) { @@ -542,18 +578,6 @@ abstract class AbstractField extends AbstractTypedNamed implements Field bitNand(T value) { - return DSL.bitNand((Field) this, (Field) val(value, this)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final Field bitNand(Field value) { - return DSL.bitNand((Field) this, (Field) value); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public final Field bitOr(T value) { @@ -566,18 +590,6 @@ abstract class AbstractField extends AbstractTypedNamed implements Field bitNor(T value) { - return DSL.bitNor((Field) this, (Field) val(value, this)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final Field bitNor(Field value) { - return DSL.bitNor((Field) this, (Field) value); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public final Field bitXor(T value) { @@ -590,18 +602,6 @@ abstract class AbstractField extends AbstractTypedNamed implements Field bitXNor(T value) { - return DSL.bitXNor((Field) this, (Field) val(value, this)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final Field bitXNor(Field value) { - return DSL.bitXNor((Field) this, (Field) value); - } - // ------------------------------------------------------------------------ // XXX: Conditions created from this field // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/BitNand.java b/jOOQ/src/main/java/org/jooq/impl/BitNand.java new file mode 100644 index 0000000000..508967e06c --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/BitNand.java @@ -0,0 +1,132 @@ +/* + * 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.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; + + +/** + * The BIT NAND statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class BitNand +extends + AbstractField +{ + + private final Field arg1; + private final Field arg2; + + BitNand( + Field arg1, + Field arg2 + ) { + super( + N_BIT_NAND, + allNotNull((DataType) dataType(INTEGER, arg1, false), arg1, arg2) + ); + + this.arg1 = nullSafeNotNull(arg1, INTEGER); + this.arg2 = nullSafeNotNull(arg2, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + switch (ctx.family()) { + + + + + + + default: + ctx.visit(DSL.bitNot(DSL.bitAnd((Field) arg1, (Field) arg2))); + break; + } + } + + + + + + + + + + + + + + + // ------------------------------------------------------------------------- + // The Object API + // ------------------------------------------------------------------------- + + @Override + public boolean equals(Object that) { + if (that instanceof BitNand) { + return + StringUtils.equals(arg1, ((BitNand) that).arg1) && + StringUtils.equals(arg2, ((BitNand) that).arg2) + ; + } + else + return super.equals(that); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/BitNor.java b/jOOQ/src/main/java/org/jooq/impl/BitNor.java new file mode 100644 index 0000000000..7d66197600 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/BitNor.java @@ -0,0 +1,132 @@ +/* + * 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.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; + + +/** + * The BIT NOR statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class BitNor +extends + AbstractField +{ + + private final Field arg1; + private final Field arg2; + + BitNor( + Field arg1, + Field arg2 + ) { + super( + N_BIT_NOR, + allNotNull((DataType) dataType(INTEGER, arg1, false), arg1, arg2) + ); + + this.arg1 = nullSafeNotNull(arg1, INTEGER); + this.arg2 = nullSafeNotNull(arg2, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + switch (ctx.family()) { + + + + + + + default: + ctx.visit(DSL.bitNot(DSL.bitOr((Field) arg1, (Field) arg2))); + break; + } + } + + + + + + + + + + + + + + + // ------------------------------------------------------------------------- + // The Object API + // ------------------------------------------------------------------------- + + @Override + public boolean equals(Object that) { + if (that instanceof BitNor) { + return + StringUtils.equals(arg1, ((BitNor) that).arg1) && + StringUtils.equals(arg2, ((BitNor) that).arg2) + ; + } + else + return super.equals(that); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/BitXNor.java b/jOOQ/src/main/java/org/jooq/impl/BitXNor.java new file mode 100644 index 0000000000..3c9f7e07fc --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/BitXNor.java @@ -0,0 +1,132 @@ +/* + * 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.DSL.*; +import static org.jooq.impl.Internal.*; +import static org.jooq.impl.Keywords.*; +import static org.jooq.impl.Names.*; +import static org.jooq.impl.SQLDataType.*; +import static org.jooq.impl.Tools.*; +import static org.jooq.impl.Tools.BooleanDataKey.*; +import static org.jooq.impl.Tools.DataExtendedKey.*; +import static org.jooq.impl.Tools.DataKey.*; +import static org.jooq.SQLDialect.*; + +import org.jooq.*; +import org.jooq.Record; +import org.jooq.conf.*; +import org.jooq.impl.*; +import org.jooq.tools.*; + +import java.util.*; + + +/** + * The BIT X NOR statement. + */ +@SuppressWarnings({ "rawtypes", "unchecked", "unused" }) +final class BitXNor +extends + AbstractField +{ + + private final Field arg1; + private final Field arg2; + + BitXNor( + Field arg1, + Field arg2 + ) { + super( + N_BIT_X_NOR, + allNotNull((DataType) dataType(INTEGER, arg1, false), arg1, arg2) + ); + + this.arg1 = nullSafeNotNull(arg1, INTEGER); + this.arg2 = nullSafeNotNull(arg2, INTEGER); + } + + // ------------------------------------------------------------------------- + // XXX: QueryPart API + // ------------------------------------------------------------------------- + + @Override + public final void accept(Context ctx) { + switch (ctx.family()) { + + + + + + + default: + ctx.visit(DSL.bitNot(DSL.bitXor((Field) arg1, (Field) arg2))); + break; + } + } + + + + + + + + + + + + + + + // ------------------------------------------------------------------------- + // The Object API + // ------------------------------------------------------------------------- + + @Override + public boolean equals(Object that) { + if (that instanceof BitXNor) { + return + StringUtils.equals(arg1, ((BitXNor) that).arg1) && + StringUtils.equals(arg2, ((BitXNor) that).arg2) + ; + } + else + return super.equals(that); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index c531bbc5c9..f96e9f5ef0 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -15840,6 +15840,135 @@ public class DSL { return new BitCount(number); } + /** + * The BIT_NAND function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNand(T arg1, T arg2) { + return new BitNand(Tools.field(arg1), Tools.field(arg2)); + } + + /** + * The BIT_NAND function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNand(T arg1, Field arg2) { + return new BitNand(Tools.field(arg1), arg2); + } + + /** + * The BIT_NAND function. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNand(Field arg1, T arg2) { + return new BitNand(arg1, Tools.field(arg2, arg1)); + } + + /** + * The BIT_NAND function. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNand(Field arg1, Field arg2) { + return new BitNand(arg1, arg2); + } + + /** + * The BIT_NOR function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNor(T arg1, T arg2) { + return new BitNor(Tools.field(arg1), Tools.field(arg2)); + } + + /** + * The BIT_NOR function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNor(T arg1, Field arg2) { + return new BitNor(Tools.field(arg1), arg2); + } + + /** + * The BIT_NOR function. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNor(Field arg1, T arg2) { + return new BitNor(arg1, Tools.field(arg2, arg1)); + } + + /** + * The BIT_NOR function. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitNor(Field arg1, Field arg2) { + return new BitNor(arg1, arg2); + } + + /** + * The BIT_X_NOR function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitXNor(T arg1, T arg2) { + return new BitXNor(Tools.field(arg1), Tools.field(arg2)); + } + + /** + * The BIT_X_NOR function. + * + * @param arg1 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitXNor(T arg1, Field arg2) { + return new BitXNor(Tools.field(arg1), arg2); + } + + /** + * The BIT_X_NOR function. + * + * @param arg2 is wrapped as {@link #val(Object)}. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitXNor(Field arg1, T arg2) { + return new BitXNor(arg1, Tools.field(arg2, arg1)); + } + + /** + * The BIT_X_NOR function. + */ + @NotNull + @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) + public static Field bitXNor(Field arg1, Field arg2) { + return new BitXNor(arg1, arg2); + } + /** * The CEIL function. *

@@ -22478,60 +22607,6 @@ public class DSL { return new Expression<>(ExpressionOperator.BIT_AND, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); } - /** - * The bitwise not and operator. - * - * @see #bitNand(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNand(T value1, T value2) { - return bitNand(Tools.field(value1), Tools.field(value2)); - } - - /** - * The bitwise not and operator. - * - * @see #bitNand(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNand(T value1, Field value2) { - return bitNand(Tools.field(value1, value2), Tools.nullSafe(value2)); - } - - /** - * The bitwise not and operator. - * - * @see #bitNand(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNand(Field value1, T value2) { - return bitNand(Tools.nullSafe(value1), Tools.field(value2, value1)); - } - - /** - * The bitwise not and operator. - *

- * This is not supported by Derby, Ingres - *

- * This renders the not and operation where available: - *

~([field1] & [field2])
- * ... or the not and function elsewhere: - *
bitnot(bitand([field1], [field2]))
- * - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNand(Field field1, Field field2) { - return new Expression<>(ExpressionOperator.BIT_NAND, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); - } - /** * The bitwise or operator. * @@ -22581,58 +22656,6 @@ public class DSL { return new Expression<>(ExpressionOperator.BIT_OR, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); } - /** - * The bitwise not or operator. - * - * @see #bitNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNor(T value1, T value2) { - return bitNor(Tools.field(value1), Tools.field(value2)); - } - /** - * The bitwise not or operator. - * - * @see #bitNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNor(T value1, Field value2) { - return bitNor(Tools.field(value1, value2), Tools.nullSafe(value2)); - } - /** - * The bitwise not or operator. - * - * @see #bitNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNor(Field value1, T value2) { - return bitNor(Tools.nullSafe(value1), Tools.field(value2, value1)); - } - - /** - * The bitwise not or operator. - *

- * This is not supported by Derby, Ingres - *

- * This renders the not or operation where available: - *

~([field1] | [field2])
- * ... or the not or function elsewhere: - *
bitnot(bitor([field1], [field2]))
- * - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitNor(Field field1, Field field2) { - return new Expression<>(ExpressionOperator.BIT_NOR, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); - } - /** * The bitwise xor operator. * @@ -22682,58 +22705,6 @@ public class DSL { return new Expression<>(ExpressionOperator.BIT_XOR, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); } - /** - * The bitwise not xor operator. - * - * @see #bitXNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitXNor(T value1, T value2) { - return bitXNor(Tools.field(value1), Tools.field(value2)); - } - - /** - * The bitwise not xor operator. - * - * @see #bitXNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitXNor(T value1, Field value2) { - return bitXNor(Tools.field(value1, value2), Tools.nullSafe(value2)); - } - - /** - * The bitwise not xor operator. - * - * @see #bitXNor(Field, Field) - * @see #bitNot(Field) - */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitXNor(Field value1, T value2) { - return bitXNor(Tools.nullSafe(value1), Tools.field(value2, value1)); - } - - /** - * The bitwise not xor operator. - *

- * This is not supported by Derby, Ingres - *

- * This renders the or operation where available: - *

~([field1] ^ [field2])
- * ... or the not xor function elsewhere: - *
bitnot(bitxor([field1], [field2]))
- */ - @NotNull - @Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE }) - public static Field bitXNor(Field field1, Field field2) { - return new Expression<>(ExpressionOperator.BIT_XNOR, false, Tools.nullSafe(field1), Tools.nullSafe(field2)); - } - // ------------------------------------------------------------------------ // XXX Mathematical functions // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/Expression.java b/jOOQ/src/main/java/org/jooq/impl/Expression.java index d50ba87d1c..b576fcff89 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Expression.java +++ b/jOOQ/src/main/java/org/jooq/impl/Expression.java @@ -67,10 +67,7 @@ import static org.jooq.impl.DSL.keyword; import static org.jooq.impl.DSL.val; import static org.jooq.impl.ExpressionOperator.ADD; import static org.jooq.impl.ExpressionOperator.BIT_AND; -import static org.jooq.impl.ExpressionOperator.BIT_NAND; -import static org.jooq.impl.ExpressionOperator.BIT_NOR; import static org.jooq.impl.ExpressionOperator.BIT_OR; -import static org.jooq.impl.ExpressionOperator.BIT_XNOR; import static org.jooq.impl.ExpressionOperator.BIT_XOR; import static org.jooq.impl.ExpressionOperator.MULTIPLY; import static org.jooq.impl.ExpressionOperator.SUBTRACT; @@ -214,14 +211,6 @@ final class Expression extends AbstractTransformable { DSL.bitNot(DSL.bitAnd(lhsAsNumber(), rhsAsNumber())), DSL.bitOr(lhsAsNumber(), rhsAsNumber()))); - // These operators are not supported in any dialect - else if (BIT_NAND == operator) - ctx.visit(DSL.bitNot(DSL.bitAnd(lhsAsNumber(), rhsAsNumber()))); - else if (BIT_NOR == operator) - ctx.visit(DSL.bitNot(DSL.bitOr(lhsAsNumber(), rhsAsNumber()))); - else if (BIT_XNOR == operator) - ctx.visit(DSL.bitNot(DSL.bitXor(lhsAsNumber(), rhsAsNumber()))); - // --------------------------------------------------------------------- // XXX: Date time arithmetic operators // --------------------------------------------------------------------- @@ -262,9 +251,6 @@ final class Expression extends AbstractTransformable { - - - diff --git a/jOOQ/src/main/java/org/jooq/impl/ExpressionOperator.java b/jOOQ/src/main/java/org/jooq/impl/ExpressionOperator.java index 9998b47ceb..d354b3be4d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ExpressionOperator.java +++ b/jOOQ/src/main/java/org/jooq/impl/ExpressionOperator.java @@ -96,21 +96,6 @@ enum ExpressionOperator { */ BIT_XOR("^", true, true), - /** - * Bitwise nand - */ - BIT_NAND("~&"), - - /** - * Bitwise nor - */ - BIT_NOR("~|"), - - /** - * Bitwise xor - */ - BIT_XNOR("~^"), - ; private final String sql; diff --git a/jOOQ/src/main/java/org/jooq/impl/Names.java b/jOOQ/src/main/java/org/jooq/impl/Names.java index f972f32767..165f5a6e58 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -84,6 +84,7 @@ final class Names { static final Name N_BIN_SHR = unquotedName("bin_shr"); static final Name N_BIN_XOR = unquotedName("bin_xor"); static final Name N_BITAND = unquotedName("bitand"); + static final Name N_BITCOUNT = unquotedName("bitcount"); static final Name N_BITNOT = unquotedName("bitnot"); static final Name N_BITOR = unquotedName("bitor"); static final Name N_BITSHIFTLEFT = unquotedName("bitshiftleft"); @@ -91,13 +92,15 @@ final class Names { static final Name N_BITXOR = unquotedName("bitxor"); static final Name N_BIT_AND = unquotedName("bit_and"); static final Name N_BIT_AND_AGG = unquotedName("bit_and_agg"); - static final Name N_BITCOUNT = unquotedName("bitcount"); static final Name N_BIT_COUNT = unquotedName("bit_count"); static final Name N_BIT_LENGTH = unquotedName("bit_length"); + static final Name N_BIT_NAND = unquotedName("bit_nand"); + static final Name N_BIT_NOR = unquotedName("bit_nor"); static final Name N_BIT_OR = unquotedName("bit_or"); static final Name N_BIT_OR_AGG = unquotedName("bit_or_agg"); static final Name N_BIT_XOR = unquotedName("bit_xor"); static final Name N_BIT_XOR_AGG = unquotedName("bit_xor_agg"); + static final Name N_BIT_X_NOR = unquotedName("bit_xnor"); static final Name N_BOOLAND_AGG = unquotedName("booland_agg"); static final Name N_BOOLOR_AGG = unquotedName("boolor_agg"); static final Name N_BOOL_AND = unquotedName("bool_and"); @@ -195,12 +198,12 @@ final class Names { static final Name N_INSTR = unquotedName("instr"); static final Name N_ISJSON = unquotedName("isjson"); static final Name N_JOIN = unquotedName("join"); + static final Name N_JSON = unquotedName("json"); static final Name N_JSONB_AGG = unquotedName("jsonb_agg"); static final Name N_JSONB_BUILD_ARRAY = unquotedName("jsonb_build_array"); static final Name N_JSONB_OBJECT_AGG = unquotedName("jsonb_object_agg"); static final Name N_JSONB_PATH_EXISTS = unquotedName("jsonb_path_exists"); static final Name N_JSONB_PATH_QUERY_FIRST = unquotedName("jsonb_path_query_first"); - static final Name N_JSON = unquotedName("json"); static final Name N_JSON_AGG = unquotedName("json_agg"); static final Name N_JSON_ARRAY = unquotedName("json_array"); static final Name N_JSON_ARRAYAGG = unquotedName("json_arrayagg");