示例#1
0
文件: Rpad.java 项目: nablaone/jOOQ
  @Override
  final Field<String> getFunction0(Configuration configuration) {
    switch (configuration.family()) {

        // This beautiful expression was contributed by "Ludo", here:
        // http://stackoverflow.com/questions/6576343/how-to-simulate-lpad-rpad-with-sqlite
      case SQLITE:
        {
          return DSL.field(
              "{0} || substr("
                  + "replace("
                  + "replace("
                  + "substr("
                  + "quote("
                  + "zeroblob((({1} - length({0}) - 1 + length({2})) / length({2}) + 1) / 2)"
                  + "), 3"
                  + "), '\''', ''"
                  + "), '0', {2}"
                  + "), 1, ({1} - length({0}))"
                  + ")",
              String.class, field, length, character);
        }

        // According to the Firebird documentation, LPAD outcomes should be
        // cast to truncate large results...
      case FIREBIRD:
        {
          return field(
              "cast(rpad({0}, {1}, {2}) as varchar(4000))",
              SQLDataType.VARCHAR, field, length, character);
        }

      default:
        {
          return function("rpad", SQLDataType.VARCHAR, field, length, character);
        }
    }
  }
示例#2
0
/** This class is generated by jOOQ. */
@Generated(
    value = {"http://www.jooq.org", "jOOQ version:3.8.1"},
    comments = "This class is generated by jOOQ")
@SuppressWarnings({"all", "unchecked", "rawtypes"})
public class SchemaVersion extends TableImpl<SchemaVersionRecord> {

  private static final long serialVersionUID = -1827404851;

  /** The reference instance of <code>lifetime.schema_version</code> */
  public static final SchemaVersion SCHEMA_VERSION = new SchemaVersion();

  /** The class holding records for this type */
  @Override
  public Class<SchemaVersionRecord> getRecordType() {
    return SchemaVersionRecord.class;
  }

  /** The column <code>lifetime.schema_version.installed_rank</code>. */
  public final TableField<SchemaVersionRecord, Integer> INSTALLED_RANK =
      createField("installed_rank", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");

  /** The column <code>lifetime.schema_version.version</code>. */
  public final TableField<SchemaVersionRecord, String> VERSION =
      createField("version", org.jooq.impl.SQLDataType.VARCHAR.length(50), this, "");

  /** The column <code>lifetime.schema_version.description</code>. */
  public final TableField<SchemaVersionRecord, String> DESCRIPTION =
      createField(
          "description", org.jooq.impl.SQLDataType.VARCHAR.length(200).nullable(false), this, "");

  /** The column <code>lifetime.schema_version.type</code>. */
  public final TableField<SchemaVersionRecord, String> TYPE =
      createField("type", org.jooq.impl.SQLDataType.VARCHAR.length(20).nullable(false), this, "");

  /** The column <code>lifetime.schema_version.script</code>. */
  public final TableField<SchemaVersionRecord, String> SCRIPT =
      createField(
          "script", org.jooq.impl.SQLDataType.VARCHAR.length(1000).nullable(false), this, "");

  /** The column <code>lifetime.schema_version.checksum</code>. */
  public final TableField<SchemaVersionRecord, Integer> CHECKSUM =
      createField("checksum", org.jooq.impl.SQLDataType.INTEGER, this, "");

  /** The column <code>lifetime.schema_version.installed_by</code>. */
  public final TableField<SchemaVersionRecord, String> INSTALLED_BY =
      createField(
          "installed_by", org.jooq.impl.SQLDataType.VARCHAR.length(100).nullable(false), this, "");

  /** The column <code>lifetime.schema_version.installed_on</code>. */
  public final TableField<SchemaVersionRecord, Timestamp> INSTALLED_ON =
      createField(
          "installed_on",
          org.jooq.impl.SQLDataType.TIMESTAMP
              .nullable(false)
              .defaultValue(
                  org.jooq.impl.DSL.field(
                      "CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)),
          this,
          "");

  /** The column <code>lifetime.schema_version.execution_time</code>. */
  public final TableField<SchemaVersionRecord, Integer> EXECUTION_TIME =
      createField("execution_time", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");

  /** The column <code>lifetime.schema_version.success</code>. */
  public final TableField<SchemaVersionRecord, Byte> SUCCESS =
      createField("success", org.jooq.impl.SQLDataType.TINYINT.nullable(false), this, "");

  /** Create a <code>lifetime.schema_version</code> table reference */
  public SchemaVersion() {
    this("schema_version", null);
  }

  /** Create an aliased <code>lifetime.schema_version</code> table reference */
  public SchemaVersion(String alias) {
    this(alias, SCHEMA_VERSION);
  }

  private SchemaVersion(String alias, Table<SchemaVersionRecord> aliased) {
    this(alias, aliased, null);
  }

  private SchemaVersion(String alias, Table<SchemaVersionRecord> aliased, Field<?>[] parameters) {
    super(alias, null, aliased, parameters, "");
  }

  /** {@inheritDoc} */
  @Override
  public Schema getSchema() {
    return Lifetime.LIFETIME;
  }

  /** {@inheritDoc} */
  @Override
  public UniqueKey<SchemaVersionRecord> getPrimaryKey() {
    return Keys.KEY_SCHEMA_VERSION_PRIMARY;
  }

  /** {@inheritDoc} */
  @Override
  public List<UniqueKey<SchemaVersionRecord>> getKeys() {
    return Arrays.<UniqueKey<SchemaVersionRecord>>asList(Keys.KEY_SCHEMA_VERSION_PRIMARY);
  }

  /** {@inheritDoc} */
  @Override
  public SchemaVersion as(String alias) {
    return new SchemaVersion(alias, this);
  }

  /** Rename this table */
  public SchemaVersion rename(String name) {
    return new SchemaVersion(name, null);
  }
}
示例#3
0
 @Override
 final Fields<Record1<Integer>> fields0() {
   return new Fields<Record1<Integer>>(DSL.field(name("generate_series"), Integer.class));
 }