[jOOQ/jOOQ#12688] Add support for H2's BIT_NAND_AGG, BIT_NOR_AGG, BIT_XNOR_AGG aggregate functions

This commit is contained in:
Lukas Eder 2022-05-19 10:58:33 +02:00
parent 6ccb0aee8b
commit f366b4976e
6 changed files with 123 additions and 12 deletions

View File

@ -1196,7 +1196,7 @@ extends
Field<T> bitOr(Field<T> arg2);
/**
* The <code>BIT_X_NOR</code> operator.
* The <code>BIT_XNOR</code> operator.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@ -1205,7 +1205,7 @@ extends
Field<T> bitXNor(T arg2);
/**
* The <code>BIT_X_NOR</code> operator.
* The <code>BIT_XNOR</code> operator.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })

View File

@ -80,7 +80,7 @@ implements
Field<T> arg2
) {
super(
N_BIT_X_NOR,
N_BIT_XNOR,
allNotNull((DataType) dataType(INTEGER, arg1, false), arg1, arg2)
);

View File

@ -16398,7 +16398,7 @@ public class DSL {
}
/**
* The <code>BIT_X_NOR</code> function.
* The <code>BIT_XNOR</code> function.
*
* @param arg1 is wrapped as {@link #val(Object)}.
* @param arg2 is wrapped as {@link #val(Object)}.
@ -16410,7 +16410,7 @@ public class DSL {
}
/**
* The <code>BIT_X_NOR</code> function.
* The <code>BIT_XNOR</code> function.
*
* @param arg1 is wrapped as {@link #val(Object)}.
*/
@ -16421,7 +16421,7 @@ public class DSL {
}
/**
* The <code>BIT_X_NOR</code> function.
* The <code>BIT_XNOR</code> function.
*
* @param arg2 is wrapped as {@link #val(Object)}.
*/
@ -16432,7 +16432,7 @@ public class DSL {
}
/**
* The <code>BIT_X_NOR</code> function.
* The <code>BIT_XNOR</code> function.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
@ -20319,6 +20319,39 @@ public class DSL {
return new BitXorAgg<>(value);
}
/**
* The <code>BIT_NAND_AGG</code> function.
* <p>
* Calculate the bitwise <code>NAND</code> aggregate value.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static <T extends Number> AggregateFunction<T> bitNandAgg(Field<T> value) {
return new BitNandAgg<>(value);
}
/**
* The <code>BIT_NOR_AGG</code> function.
* <p>
* Calculate the bitwise <code>NOR</code> aggregate value.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static <T extends Number> AggregateFunction<T> bitNorAgg(Field<T> value) {
return new BitNorAgg<>(value);
}
/**
* The <code>BIT_XNOR_AGG</code> function.
* <p>
* Calculate the bitwise <code>XNOR</code> aggregate value.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
public static <T extends Number> AggregateFunction<T> bitXNorAgg(Field<T> value) {
return new BitXNorAgg<>(value);
}
/**
* The <code>BOOL_AND</code> function.
*/

View File

@ -94,7 +94,7 @@ final class Names {
static final Name N_BIT_NOT = systemName("bit_not");
static final Name N_BIT_OR = systemName("bit_or");
static final Name N_BIT_XOR = systemName("bit_xor");
static final Name N_BIT_X_NOR = systemName("bit_xnor");
static final Name N_BIT_XNOR = systemName("bit_xnor");
static final Name N_BOOLAND_AGG = systemName("booland_agg");
static final Name N_BOOLOR_AGG = systemName("boolor_agg");
static final Name N_BYTEA = systemName("bytea");
@ -351,7 +351,10 @@ final class Names {
static final Name N_BIT_AND_AGG = systemName("bit_and_agg");
static final Name N_BIT_COUNT = systemName("bit_count");
static final Name N_BIT_LENGTH = systemName("bit_length");
static final Name N_BIT_NAND_AGG = systemName("bit_nand_agg");
static final Name N_BIT_NOR_AGG = systemName("bit_nor_agg");
static final Name N_BIT_OR_AGG = systemName("bit_or_agg");
static final Name N_BIT_XNOR_AGG = systemName("bit_xnor_agg");
static final Name N_BIT_XOR_AGG = systemName("bit_xor_agg");
static final Name N_BOOL_AND = systemName("bool_and");
static final Name N_BOOL_OR = systemName("bool_or");
@ -434,7 +437,7 @@ final class Names {
static final Name N_RPAD = systemName("rpad");
static final Name N_RTRIM = systemName("rtrim");
static final Name N_SIGN = systemName("sign");
static final Name N_SIGNAL_SQL_STATE = systemName("signal_sql_state");
static final Name N_SIGNAL_SQLSTATE = systemName("signal_sqlstate");
static final Name N_SIN = systemName("sin");
static final Name N_SINH = systemName("sinh");
static final Name N_SPACE = systemName("space");

View File

@ -94,11 +94,14 @@ import static org.jooq.impl.DSL.bitAndAgg;
import static org.jooq.impl.DSL.bitCount;
import static org.jooq.impl.DSL.bitLength;
import static org.jooq.impl.DSL.bitNand;
import static org.jooq.impl.DSL.bitNandAgg;
import static org.jooq.impl.DSL.bitNor;
import static org.jooq.impl.DSL.bitNorAgg;
import static org.jooq.impl.DSL.bitNot;
import static org.jooq.impl.DSL.bitOr;
import static org.jooq.impl.DSL.bitOrAgg;
import static org.jooq.impl.DSL.bitXNor;
import static org.jooq.impl.DSL.bitXNorAgg;
import static org.jooq.impl.DSL.bitXor;
import static org.jooq.impl.DSL.bitXorAgg;
import static org.jooq.impl.DSL.boolOr;
@ -8985,9 +8988,18 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
return bitAnd((Field) x, (Field) y);
}
else if (parseKeywordIf("BIT_NAND") || parseKeywordIf("BITNAND") || parseKeywordIf("BIN_NAND")) {
else if (parseKeywordIf("BIT_NAND") ||
parseKeywordIf("BITNAND") ||
parseKeywordIf("BIN_NAND") ||
(agg = parseKeywordIf("BIT_NAND_AGG")) ||
(agg = parseKeywordIf("BITNAND_AGG")) ||
(agg = parseKeywordIf("BIN_NAND_AGG"))) {
parse('(');
Field<?> x = toField(parseNumericOp());
if (agg && parse(')') || parseIf(')'))
return parseAggregateFunctionIf(false, bitNandAgg((Field) x));
parse(',');
Field<?> y = toField(parseNumericOp());
parse(')');
@ -9012,9 +9024,18 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
return bitOr((Field) x, (Field) y);
}
else if (parseKeywordIf("BIT_NOR") || parseKeywordIf("BITNOR") || parseKeywordIf("BIN_NOR")) {
else if (parseKeywordIf("BIT_NOR") ||
parseKeywordIf("BITNOR") ||
parseKeywordIf("BIN_NOR") ||
(agg = parseKeywordIf("BIT_NOR_AGG")) ||
(agg = parseKeywordIf("BITNOR_AGG")) ||
(agg = parseKeywordIf("BIN_NOR_AGG"))) {
parse('(');
Field<?> x = toField(parseNumericOp());
if (agg && parse(')') || parseIf(')'))
return parseAggregateFunctionIf(false, bitNorAgg((Field) x));
parse(',');
Field<?> y = toField(parseNumericOp());
parse(')');
@ -9039,9 +9060,18 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
return bitXor((Field) x, (Field) y);
}
else if (parseKeywordIf("BIT_XNOR") || parseKeywordIf("BITXNOR") || parseKeywordIf("BIN_XNOR")) {
else if (parseKeywordIf("BIT_XNOR") ||
parseKeywordIf("BITXNOR") ||
parseKeywordIf("BIN_XNOR") ||
(agg = parseKeywordIf("BIT_XNOR_AGG")) ||
(agg = parseKeywordIf("BITXNOR_AGG")) ||
(agg = parseKeywordIf("BIN_XNOR_AGG"))) {
parse('(');
Field<?> x = toField(parseNumericOp());
if (agg && parse(')') || parseIf(')'))
return parseAggregateFunctionIf(false, bitXNorAgg((Field) x));
parse(',');
Field<?> y = toField(parseNumericOp());
parse(')');

View File

@ -4663,6 +4663,51 @@ public final class QOM {
@NotNull BitXorAgg<T> $value(Field<T> value);
}
/**
* The <code>BIT NAND AGG</code> function.
* <p>
* Calculate the bitwise <code>NAND</code> aggregate value.
*/
public /*sealed*/ interface BitNandAgg<T extends Number>
extends
org.jooq.AggregateFunction<T>
//permits
// BitNandAgg
{
@NotNull Field<T> $value();
@NotNull BitNandAgg<T> $value(Field<T> value);
}
/**
* The <code>BIT NOR AGG</code> function.
* <p>
* Calculate the bitwise <code>NOR</code> aggregate value.
*/
public /*sealed*/ interface BitNorAgg<T extends Number>
extends
org.jooq.AggregateFunction<T>
//permits
// BitNorAgg
{
@NotNull Field<T> $value();
@NotNull BitNorAgg<T> $value(Field<T> value);
}
/**
* The <code>BIT X NOR AGG</code> function.
* <p>
* Calculate the bitwise <code>XNOR</code> aggregate value.
*/
public /*sealed*/ interface BitXNorAgg<T extends Number>
extends
org.jooq.AggregateFunction<T>
//permits
// BitXNorAgg
{
@NotNull Field<T> $value();
@NotNull BitXNorAgg<T> $value(Field<T> value);
}
/**
* The <code>BOOL AND</code> function.
*/