本文整理了Java中org.jooq.Field.add()
方法的一些代码示例,展示了Field.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.add()
方法的具体详情如下:
包路径:org.jooq.Field
类名称:Field
方法名:add
[英]An arithmetic expression adding this to value.
[中]将此值添加到值的算术表达式。
代码示例来源:origin: org.jooq/jooq
/**
* The upper bound, such that ROW_NUMBER() <= getUpperRownum()
*/
final Field<Integer> getUpperRownum() {
return offsetOrZero.add(numberOfRowsOrMax);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* The upper bound, such that ROW_NUMBER() <= getUpperRownum()
*/
final Field<Integer> getUpperRownum() {
return offsetOrZero.add(numberOfRows);
}
代码示例来源:origin: org.jooq/jooq
/**
* Add an interval to a date.
* <p>
* This translates into any dialect
*
* @see Field#add(Field)
*/
@Support
public static Field<LocalDate> localDateAdd(Field<LocalDate> date, Field<? extends Number> interval) {
return nullSafe(date).add(interval);
}
代码示例来源:origin: org.jooq/jooq
/**
* Add an interval to a date.
* <p>
* This translates into any dialect
*
* @see Field#add(Field)
*/
@Support
public static Field<Date> dateAdd(Field<Date> date, Field<? extends Number> interval) {
return nullSafe(date).add(interval);
}
代码示例来源:origin: org.jooq/jooq
/**
* Add an interval to a timestamp.
* <p>
* This translates into any dialect
*
* @see Field#add(Field)
*/
@Support
public static Field<Timestamp> timestampAdd(Field<Timestamp> timestamp, Field<? extends Number> interval) {
return nullSafe(timestamp).add(interval);
}
代码示例来源:origin: org.jooq/jooq
/**
* Add an interval to a timestamp.
* <p>
* This translates into any dialect
*
* @see Field#add(Field)
*/
@Support
public static Field<LocalDateTime> localDateTimeAdd(Field<LocalDateTime> timestamp, Field<? extends Number> interval) {
return nullSafe(timestamp).add(interval);
}
代码示例来源:origin: mevdschee/java-crud-api
public LinkedHashMap<Field<?>, Object> getIncrements(ReflectedTable table, boolean primaryTable,
Record record, Params params) {
LinkedHashMap<Field<?>, Object> columns = new LinkedHashMap<>();
Set<String> cols = columns(table, primaryTable, params);
for (String key : cols) {
if (record.containsKey(key)) {
Field<Object> field = table.get(key);
Object value = record.get(key);
if (value instanceof Number) {
columns.put(field, field.add((Number) value));
}
}
}
return columns;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Add an interval to a timestamp.
* <p>
* This translates into any dialect
*
* @see Field#add(Field)
*/
@Support
@Transition(
name = "TIMESTAMP_ADD",
args = {
"Field",
"Field"
},
to = "DateFunction"
)
public static Field<Timestamp> timestampAdd(Field<Timestamp> timestamp, Field<? extends Number> interval) {
return nullSafe(timestamp).add(interval);
}
代码示例来源:origin: org.jooq/jooq
private static final FieldOrRow parseSum(ParserContext ctx, Type type) {
FieldOrRow r = parseFactor(ctx, type);
if (N.is(type) && r instanceof Field)
for (;;)
if (parseIf(ctx, '+'))
r = ((Field) r).add((Field) parseFactor(ctx, type));
else if (parseIf(ctx, '-'))
r = ((Field) r).sub((Field) parseFactor(ctx, type));
else
break;
return r;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
private final QueryPart delegate(Configuration configuration) {
switch (configuration.dialect().family()) {
case CUBRID:
/* [pro] xx
xxxx xxxxxxx
xx [/pro] */
// There is a bug in CUBRID preventing reuse of "level" in the
// predicate http://jira.cubrid.org/browse/ENGINE-119
Field<Integer> level = from.add(level()).sub(one());
return table("({select} {0} {as} {1} {from} {2} {connect by} {level} <= {3})",
level,
name("generate_series"),
new Dual(),
to.add(one()).sub(from));
case POSTGRES:
default:
return table("{generate_series}({0}, {1})", from, to);
}
}
代码示例来源:origin: org.jooq/jooq
@Override
final Field<T> getFunction0(Configuration configuration) {
switch (configuration.dialect().family()) {
// evaluate "ceil" if unavailable
case SQLITE:
return DSL.round(argument.add(0.499999999999999));
case H2:
return DSL.field("{ceiling}({0})", getDataType(), argument);
default:
return DSL.field("{ceil}({0})", getDataType(), argument);
}
}
}
代码示例来源:origin: org.jooq/jooq
/**
* Get the hyperbolic cotangent function: coth(field).
* <p>
* This is not supported by any RDBMS, but emulated using exp exp:
* <code><pre>(exp([field] * 2) + 1) / (exp([field] * 2) - 1)</pre></code>
*/
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
public static Field<BigDecimal> coth(Field<? extends Number> field) {
field = nullSafe(field);
return exp(field.mul(2)).add(1).div(exp(field.mul(2)).sub(1));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
final Field<T> getFunction0(Configuration configuration) {
switch (configuration.dialect().family()) {
/* [pro] xx
xxxx xxxxxxx
xxxxxx xxxxxxxxxxxxxxxxxxx x xxxx x xxxxxxxxx x xxxxx xxxxxxxxxxxxxx xxxxxxxxxx
xx [/pro] */
// evaluate "ceil" if unavailable
case SQLITE:
return DSL.round(argument.add(0.499999999999999));
/* [pro] xx
xxxx xxxx
xxxx xxxxxxxxxx
xx [/pro] */
case H2:
return field("{ceiling}({0})", getDataType(), argument);
default:
return field("{ceil}({0})", getDataType(), argument);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Get the hyperbolic cotangent function: coth(field).
* <p>
* This is not supported by any RDBMS, but simulated using exp exp:
* <code><pre>(exp([field] * 2) + 1) / (exp([field] * 2) - 1)</pre></code>
*/
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
@Transition(
name = "COTH",
args = "Field",
to = "MathFunction"
)
public static Field<BigDecimal> coth(Field<? extends Number> field) {
field = nullSafe(field);
return exp(field.mul(2)).add(1).div(exp(field.mul(2)).sub(1));
}
代码示例来源:origin: org.jooq/jooq
switch (configuration.family()) {
case DERBY:
return DSL.substring(field, field.length().add(one()).sub(length));
代码示例来源:origin: org.jooq/jooq
@SuppressWarnings({ "unchecked" })
@Override
public void accept(Context<?> ctx) {
switch (ctx.family()) {
case POSTGRES:
ctx.visit(DSL.field("{width_bucket}({0}, {1}, {2}, {3})", getType(), field, low, high, buckets));
break;
default:
ctx.visit(
DSL.when(field.lt(low), zero())
.when(field.ge(high), buckets.add(one()))
.otherwise((Field<Integer>) DSL.floor(field.sub(low).mul(buckets).div(high.sub(low))).add(one()))
);
break;
}
}
代码示例来源:origin: org.jooq/jooq
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.family()) {
case CUBRID:
case HSQLDB:
case MARIADB:
case MYSQL:
case POSTGRES:
return DSL.exp(argument.mul(two())).add(one()).div(DSL.exp(argument).mul(two()));
default:
return function("cosh", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源:origin: org.jooq/jooq
return DSL.position(DSL.substring(in, startIndex), search).add(startIndex).sub(one());
代码示例来源:origin: org.jooq/jooq
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.family()) {
case CUBRID:
case HSQLDB:
case MARIADB:
case MYSQL:
case POSTGRES:
return DSL.exp(argument.mul(two())).sub(one()).div(DSL.exp(argument.mul(two())).add(one()));
default:
return function("tanh", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.dialect().family()) {
/* [pro] xx
xxxx xxxxxxx
xxxx xxxx
xxxx xxxxxxx
xxxx xxxxxxxxxx
xxxx xxxxxxx
xx [/pro] */
case CUBRID:
case HSQLDB:
case MARIADB:
case MYSQL:
case POSTGRES:
return DSL.exp(argument.mul(two())).add(one()).div(DSL.exp(argument).mul(two()));
default:
return function("cosh", SQLDataType.NUMERIC, argument);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!