[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
This commit is contained in:
Lukas Eder 2021-09-14 16:55:56 +02:00
parent ae165e78a6
commit aedb429518
9 changed files with 614 additions and 285 deletions

View File

@ -677,6 +677,54 @@ extends
/**
* The <code>BIT_NAND</code> operator.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitNand(T arg2);
/**
* The <code>BIT_NAND</code> operator.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitNand(Field<T> arg2);
/**
* The <code>BIT_NOR</code> operator.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitNor(T arg2);
/**
* The <code>BIT_NOR</code> operator.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitNor(Field<T> arg2);
/**
* The <code>BIT_X_NOR</code> operator.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitXNor(T arg2);
/**
* The <code>BIT_X_NOR</code> operator.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitXNor(Field<T> arg2);
/**
* The <code>SHL</code> operator.
* <p>
@ -1152,26 +1200,6 @@ extends
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitAnd(Field<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<T> 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<T> bitNand(Field<T> value);
/**
* The bitwise or operator.
*
@ -1190,26 +1218,6 @@ extends
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitOr(Field<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<T> 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<T> bitNor(Field<T> value);
/**
* The bitwise xor operator.
*
@ -1228,26 +1236,6 @@ extends
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
Field<T> bitXor(Field<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<T> 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<T> bitXNor(Field<T> value);
// ------------------------------------------------------------------------
// XML predicates
// ------------------------------------------------------------------------

View File

@ -339,6 +339,42 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitNand(T arg2) {
return DSL.bitNand((Field) this, (Number) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitNand(Field<T> arg2) {
return DSL.bitNand((Field) this, (Field<Number>) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitNor(T arg2) {
return DSL.bitNor((Field) this, (Number) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitNor(Field<T> arg2) {
return DSL.bitNor((Field) this, (Field<Number>) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitXNor(T arg2) {
return DSL.bitXNor((Field) this, (Number) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> bitXNor(Field<T> arg2) {
return DSL.bitXNor((Field) this, (Field<Number>) arg2);
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public final Field<T> shl(Number count) {
@ -542,18 +578,6 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
return DSL.bitAnd((Field) this, (Field) value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitNand(T value) {
return DSL.bitNand((Field) this, (Field) val(value, this));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitNand(Field<T> value) {
return DSL.bitNand((Field) this, (Field) value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitOr(T value) {
@ -566,18 +590,6 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
return DSL.bitOr((Field) this, (Field) value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitNor(T value) {
return DSL.bitNor((Field) this, (Field) val(value, this));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitNor(Field<T> value) {
return DSL.bitNor((Field) this, (Field) value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitXor(T value) {
@ -590,18 +602,6 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
return DSL.bitXor((Field) this, (Field) value);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitXNor(T value) {
return DSL.bitXNor((Field) this, (Field) val(value, this));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Field<T> bitXNor(Field<T> value) {
return DSL.bitXNor((Field) this, (Field) value);
}
// ------------------------------------------------------------------------
// XXX: Conditions created from this field
// ------------------------------------------------------------------------

View File

@ -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 <code>BIT NAND</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
final class BitNand<T extends Number>
extends
AbstractField<T>
{
private final Field<T> arg1;
private final Field<T> arg2;
BitNand(
Field<T> arg1,
Field<T> 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<Number>) arg1, (Field<Number>) 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);
}
}

View File

@ -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 <code>BIT NOR</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
final class BitNor<T extends Number>
extends
AbstractField<T>
{
private final Field<T> arg1;
private final Field<T> arg2;
BitNor(
Field<T> arg1,
Field<T> 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<Number>) arg1, (Field<Number>) 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);
}
}

View File

@ -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 <code>BIT X NOR</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
final class BitXNor<T extends Number>
extends
AbstractField<T>
{
private final Field<T> arg1;
private final Field<T> arg2;
BitXNor(
Field<T> arg1,
Field<T> 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<Number>) arg1, (Field<Number>) 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);
}
}

View File

@ -15840,6 +15840,135 @@ public class DSL {
return new BitCount(number);
}
/**
* The <code>BIT_NAND</code> 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 <T extends Number> Field<T> bitNand(T arg1, T arg2) {
return new BitNand(Tools.field(arg1), Tools.field(arg2));
}
/**
* The <code>BIT_NAND</code> function.
*
* @param arg1 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNand(T arg1, Field<T> arg2) {
return new BitNand(Tools.field(arg1), arg2);
}
/**
* The <code>BIT_NAND</code> function.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNand(Field<T> arg1, T arg2) {
return new BitNand(arg1, Tools.field(arg2, arg1));
}
/**
* The <code>BIT_NAND</code> function.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNand(Field<T> arg1, Field<T> arg2) {
return new BitNand(arg1, arg2);
}
/**
* The <code>BIT_NOR</code> 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 <T extends Number> Field<T> bitNor(T arg1, T arg2) {
return new BitNor(Tools.field(arg1), Tools.field(arg2));
}
/**
* The <code>BIT_NOR</code> function.
*
* @param arg1 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNor(T arg1, Field<T> arg2) {
return new BitNor(Tools.field(arg1), arg2);
}
/**
* The <code>BIT_NOR</code> function.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNor(Field<T> arg1, T arg2) {
return new BitNor(arg1, Tools.field(arg2, arg1));
}
/**
* The <code>BIT_NOR</code> function.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNor(Field<T> arg1, Field<T> arg2) {
return new BitNor(arg1, arg2);
}
/**
* The <code>BIT_X_NOR</code> 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 <T extends Number> Field<T> bitXNor(T arg1, T arg2) {
return new BitXNor(Tools.field(arg1), Tools.field(arg2));
}
/**
* The <code>BIT_X_NOR</code> function.
*
* @param arg1 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitXNor(T arg1, Field<T> arg2) {
return new BitXNor(Tools.field(arg1), arg2);
}
/**
* The <code>BIT_X_NOR</code> function.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitXNor(Field<T> arg1, T arg2) {
return new BitXNor(arg1, Tools.field(arg2, arg1));
}
/**
* The <code>BIT_X_NOR</code> function.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitXNor(Field<T> arg1, Field<T> arg2) {
return new BitXNor(arg1, arg2);
}
/**
* The <code>CEIL</code> function.
* <p>
@ -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 <T extends Number> Field<T> 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 <T extends Number> Field<T> bitNand(T value1, Field<T> 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 <T extends Number> Field<T> bitNand(Field<T> value1, T value2) {
return bitNand(Tools.nullSafe(value1), Tools.field(value2, value1));
}
/**
* The bitwise not and operator.
* <p>
* This is not supported by Derby, Ingres
* <p>
* This renders the not and operation where available:
* <code><pre>~([field1] &amp; [field2])</pre></code>
* ... or the not and function elsewhere:
* <code><pre>bitnot(bitand([field1], [field2]))</pre></code>
*
* @see #bitNot(Field)
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNand(Field<T> field1, Field<T> 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 <T extends Number> Field<T> 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 <T extends Number> Field<T> bitNor(T value1, Field<T> 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 <T extends Number> Field<T> bitNor(Field<T> value1, T value2) {
return bitNor(Tools.nullSafe(value1), Tools.field(value2, value1));
}
/**
* The bitwise not or operator.
* <p>
* This is not supported by Derby, Ingres
* <p>
* This renders the not or operation where available:
* <code><pre>~([field1] | [field2])</pre></code>
* ... or the not or function elsewhere:
* <code><pre>bitnot(bitor([field1], [field2]))</pre></code>
*
* @see #bitNot(Field)
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitNor(Field<T> field1, Field<T> 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 <T extends Number> Field<T> 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 <T extends Number> Field<T> bitXNor(T value1, Field<T> 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 <T extends Number> Field<T> bitXNor(Field<T> value1, T value2) {
return bitXNor(Tools.nullSafe(value1), Tools.field(value2, value1));
}
/**
* The bitwise not xor operator.
* <p>
* This is not supported by Derby, Ingres
* <p>
* This renders the or operation where available:
* <code><pre>~([field1] ^ [field2])</pre></code>
* ... or the not xor function elsewhere:
* <code><pre>bitnot(bitxor([field1], [field2]))</pre></code>
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTE })
public static <T extends Number> Field<T> bitXNor(Field<T> field1, Field<T> field2) {
return new Expression<>(ExpressionOperator.BIT_XNOR, false, Tools.nullSafe(field1), Tools.nullSafe(field2));
}
// ------------------------------------------------------------------------
// XXX Mathematical functions
// ------------------------------------------------------------------------

View File

@ -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<T> extends AbstractTransformable<T> {
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<T> extends AbstractTransformable<T> {

View File

@ -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;

View File

@ -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");