org.jooq.Field.sub()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中org.jooq.Field.sub()方法的一些代码示例,展示了Field.sub()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.sub()方法的具体详情如下:
包路径:org.jooq.Field
类名称:Field
方法名:sub

Field.sub介绍

[英]An arithmetic expression subtracting value from this.
[中]从中减去值的算术表达式。

代码示例

代码示例来源:origin: org.jooq/jooq

/**
 * Subtract an interval from a date.
 * <p>
 * This translates into any dialect
 *
 * @see Field#add(Field)
 */
@Support
public static Field<LocalDate> localDateSub(Field<LocalDate> date, Field<? extends Number> interval) {
  return nullSafe(date).sub(interval);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Subtract an interval from a timestamp.
 * <p>
 * This translates into any dialect
 *
 * @see Field#sub(Field)
 */
@Support
public static Field<LocalDateTime> localDateTimeSub(Field<LocalDateTime> timestamp, Field<? extends Number> interval) {
  return nullSafe(timestamp).sub(interval);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Subtract an interval from a date.
 * <p>
 * This translates into any dialect
 *
 * @see Field#add(Field)
 */
@Support
public static Field<Date> dateSub(Field<Date> date, Field<? extends Number> interval) {
  return nullSafe(date).sub(interval);
}

代码示例来源:origin: org.jooq/jooq

/**
 * Subtract an interval from a timestamp.
 * <p>
 * This translates into any dialect
 *
 * @see Field#sub(Field)
 */
@Support
public static Field<Timestamp> timestampSub(Field<Timestamp> timestamp, Field<? extends Number> interval) {
  return nullSafe(timestamp).sub(interval);
}

代码示例来源:origin: org.jooq/jooq

@Override
  final Field<T> getFunction0(Configuration configuration) {
    switch (configuration.dialect()) {



      case SQLITE:
        return DSL.round(argument.sub(0.499999999999999));

      default:
        return DSL.field("{floor}({0})", getDataType(), argument);
    }
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
  final Field<T> getFunction0(Configuration configuration) {
    switch (configuration.dialect()) {

      /* [pro] xx
      xxxx xxxxxxx
      xx [/pro] */

      case SQLITE:
        return DSL.round(argument.sub(0.499999999999999));

      default:
        return field("{floor}({0})", getDataType(), argument);
    }
  }
}

代码示例来源: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: org.jooq/jooq

private final QueryPart delegate(Configuration configuration) {
  switch (configuration.family()) {
    case CUBRID:
      // There is a bug in CUBRID preventing reuse of "level" in the
      // predicate http://jira.cubrid.org/browse/ENGINE-119
      if (step == null)
        return table("({select} {0} {as} {1} {from} {2} {connect by} {level} <= {3})",
          from.add(level()).sub(one()),
          name("generate_series"),
          new Dual(),
          to.add(one()).sub(from));
      else
        return table("({select} {0} {as} {1} {from} {2} {connect by} {level} * {3} <= {4})",
          from.add(level().mul(step)).sub(step),
          name("generate_series"),
          new Dual(),
          step,
          to.add(step).sub(from));
    case POSTGRES:
    default:
      if (step == null)
        return table("{generate_series}({0}, {1})", from, to);
      else
        return table("{generate_series}({0}, {1}, {2})", from, to, step);
  }
}

代码示例来源: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

/**
 * 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: org.jooq/jooq

switch (configuration.family()) {
  case DERBY:
    return DSL.substring(field, field.length().add(one()).sub(length));

代码示例来源: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

@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())).sub(one()).div(DSL.exp(argument).mul(two()));

      default:
        return function("sinh", 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 QueryPart getFunction0(Configuration configuration) {
    switch (configuration.dialect().family()) {
      case DERBY:
        return DSL.substring(field, field.length().add(one()).sub(length));

      /* [pro] xx
      xxxx xxxxxxx
      xx [/pro] */
      case SQLITE:
        return DSL.substring(field, length.neg());

      /* [pro] xx
      xxxx xxxx
      xxxx xxxxxxx
      xxxx xxxxxxxxxx
      xxxx xxxxxxx
      xx [/pro] */
      case CUBRID:
      case FIREBIRD:
      case H2:
      case HSQLDB:
      case MARIADB:
      case MYSQL:
      case POSTGRES:
      default:
        return field("{right}({0}, {1})", field, length);
    }
  }
}

代码示例来源: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
      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: org.jooq/jooq

return date1.sub(date2).cast(Integer.class);

相关文章