本文整理了Java中org.jooq.Field.mul()
方法的一些代码示例,展示了Field.mul()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.mul()
方法的具体详情如下:
包路径:org.jooq.Field
类名称:Field
方法名:mul
[英]An arithmetic expression multiplying this with value.
INTERVAL
field, then the result is also an INTERVAL
field (see Interval)INTERVAL
字段,那么结果也是一个INTERVAL
字段(请参见间隔)代码示例来源:origin: my2iu/Jinq
@Override public ColumnExpressions<?> mathOpValue(TypedValue.MathOpValue val, Void in) throws TypedValueVisitorException
{
ColumnExpressions<?> left = val.left.visit(this, in);
ColumnExpressions<?> right = val.right.visit(this, in);
Field leftField = (Field)left.getOnlyColumn();
Field rightField = (Field)right.getOnlyColumn();
Field resultField;
switch(val.op)
{
case minus: resultField = leftField.minus(rightField); break;
case plus: resultField = leftField.plus(rightField); break;
case mul: resultField = leftField.mul(rightField); break;
default:
throw new TypedValueVisitorException("Unknown math operator");
}
return ColumnExpressions.singleColumn(left.reader, resultField);
}
代码示例来源: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
/**
* 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
@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
@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()));
default:
return function("sinh", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源:origin: org.jooq/jooq
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.family()) {
case FIREBIRD:
case SQLITE:
return argument.cast(BigDecimal.class).mul(pi()).div(inline(180));
default:
return function("radians", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源: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: org.jooq/jooq
return DSL.rpad(string, DSL.length(string).mul(count), string);
代码示例来源:origin: org.jooq/jooq
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.family()) {
case FIREBIRD:
case SQLITE:
return argument.cast(BigDecimal.class).mul(inline(180)).div(pi());
default:
return DSL.field("{degrees}({0})", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源:origin: org.jooq/jooq
@Override
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.dialect().family()) {
case DERBY:
case SQLITE:
return DSL.exp(DSL.ln(arg1).mul(arg2));
default:
return DSL.field("{power}({0}, {1})", SQLDataType.NUMERIC, getArguments());
}
}
}
代码示例来源: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())).sub(one()).div(DSL.exp(argument).mul(two()));
default:
return function("sinh", 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
xxxxxx xxxxxxxxxxx x xxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx xxxxxx
xx [/pro] */
case DERBY:
case SQLITE:
return DSL.exp(DSL.ln(arg1).mul(arg2));
default:
return field("{power}({0}, {1})", SQLDataType.NUMERIC, getArguments());
}
}
}
代码示例来源: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);
}
}
}
代码示例来源: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())).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 xxxxxxx
xxxx xxxxxxx
xx [/pro] */
case FIREBIRD:
case SQLITE:
return argument.cast(BigDecimal.class).mul(pi()).div(inline(180));
default:
return function("radians", 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
xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxx xxxxxxx
xxxx xxxxxxx
xx [/pro] */
case FIREBIRD:
case SQLITE:
return argument.cast(BigDecimal.class).mul(inline(180)).div(pi());
default:
return field("{degrees}({0})", SQLDataType.NUMERIC, argument);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
final Field<String> getFunction0(Configuration configuration) {
switch (configuration.dialect().family()) {
/* [pro] xx
xxxx xxxxxxx
xxxx xxxxxxx
xx [/pro] */
case FIREBIRD:
return DSL.rpad(string, DSL.length(string).mul(count), string);
// Simulation of REPEAT() for SQLite currently cannot be achieved
// using RPAD() above, as RPAD() expects characters, not strings
// Another option is documented here, though:
// http://stackoverflow.com/questions/11568496/how-to-simulate-repeat-in-sqlite
case SQLITE:
return DSL.field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", String.class, count, string);
/* [pro] xx
xxxx xxxx
xxxx xxxxxxxxxx
xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx
xx [/pro] */
default:
return function("repeat", SQLDataType.VARCHAR, string, count);
}
}
}
代码示例来源:origin: com.openle.module.lambda/lambda
@Override public ColumnExpressions<?> mathOpValue(TypedValue.MathOpValue val, Void in) throws TypedValueVisitorException
{
ColumnExpressions<?> left = val.left.visit(this, in);
ColumnExpressions<?> right = val.right.visit(this, in);
Field leftField = (Field)left.getOnlyColumn();
Field rightField = (Field)right.getOnlyColumn();
Field resultField;
switch(val.op)
{
case minus: resultField = leftField.minus(rightField); break;
case plus: resultField = leftField.plus(rightField); break;
case mul: resultField = leftField.mul(rightField); break;
default:
throw new TypedValueVisitorException("Unknown math operator");
}
return ColumnExpressions.singleColumn(left.reader, resultField);
}
代码示例来源:origin: org.jooq/jooq
private static final FieldOrRow parseFactor(ParserContext ctx, Type type) {
FieldOrRow r = parseExp(ctx, type);
if (N.is(type) && r instanceof Field)
for (;;)
if (!peek(ctx, "*=") && parseIf(ctx, '*'))
r = ((Field) r).mul((Field) parseExp(ctx, type));
else if (parseIf(ctx, '/'))
r = ((Field) r).div((Field) parseExp(ctx, type));
else if (parseIf(ctx, '%'))
r = ((Field) r).mod((Field) parseExp(ctx, type));
else
break;
return r;
}
代码示例来源: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!