Package org.jooq.impl

Class SQLDataType


  • public final class SQLDataType
    extends java.lang.Object
    The SQL standard data types, as described in Types.

    These types are usually the ones that are referenced by generated source code. Most RDBMS have an almost 1:1 mapping between their vendor-specific types and the ones in this class (except Oracle). Some RDBMS also have extensions, e.g. for geospacial data types. See the dialect-specific data type classes for more information.

    Author:
    Lukas Eder
    • Field Detail

      • VARCHAR

        public static final DataType<java.lang.String> VARCHAR
        The Types.VARCHAR type.
      • CHAR

        public static final DataType<java.lang.String> CHAR
        The Types.CHAR type.
      • LONGVARCHAR

        public static final DataType<java.lang.String> LONGVARCHAR
        The Types.LONGVARCHAR type.
      • CLOB

        public static final DataType<java.lang.String> CLOB
        The Types.CLOB type.
      • NVARCHAR

        public static final DataType<java.lang.String> NVARCHAR
        The Types.NVARCHAR type.
      • NCHAR

        public static final DataType<java.lang.String> NCHAR
        The Types.NCHAR type.
      • LONGNVARCHAR

        public static final DataType<java.lang.String> LONGNVARCHAR
        The Types.LONGNVARCHAR type.
      • NCLOB

        public static final DataType<java.lang.String> NCLOB
        The Types.NCLOB type.
      • BOOLEAN

        public static final DataType<java.lang.Boolean> BOOLEAN
        The Types.BOOLEAN type.
      • BIT

        public static final DataType<java.lang.Boolean> BIT
        The Types.BIT type.
      • TINYINT

        public static final DataType<java.lang.Byte> TINYINT
        The Types.TINYINT type.
      • SMALLINT

        public static final DataType<java.lang.Short> SMALLINT
        The Types.SMALLINT type.
      • INTEGER

        public static final DataType<java.lang.Integer> INTEGER
        The Types.INTEGER type.
      • BIGINT

        public static final DataType<java.lang.Long> BIGINT
        The Types.BIGINT type.
      • DECIMAL_INTEGER

        public static final DataType<java.math.BigInteger> DECIMAL_INTEGER
        The zero-scale Types.DECIMAL type.
      • TINYINTUNSIGNED

        public static final DataType<UByte> TINYINTUNSIGNED
        The unsigned Types.TINYINT type.
      • SMALLINTUNSIGNED

        public static final DataType<UShort> SMALLINTUNSIGNED
        The unsigned Types.SMALLINT type.
      • INTEGERUNSIGNED

        public static final DataType<UInteger> INTEGERUNSIGNED
        The unsigned Types.INTEGER type.
      • BIGINTUNSIGNED

        public static final DataType<ULong> BIGINTUNSIGNED
        The unsigned Types.BIGINT type.
      • DOUBLE

        public static final DataType<java.lang.Double> DOUBLE
        The Types.DOUBLE type.
      • FLOAT

        public static final DataType<java.lang.Double> FLOAT
        The Types.FLOAT type.
      • REAL

        public static final DataType<java.lang.Float> REAL
        The Types.REAL type.
      • NUMERIC

        public static final DataType<java.math.BigDecimal> NUMERIC
        The Types.NUMERIC type.
      • DECIMAL

        public static final DataType<java.math.BigDecimal> DECIMAL
        The Types.DECIMAL type.
      • DATE

        public static final DataType<java.sql.Date> DATE
        The Types.DATE type.
      • TIMESTAMP

        public static final DataType<java.sql.Timestamp> TIMESTAMP
        The Types.TIMESTAMP type.
      • TIME

        public static final DataType<java.sql.Time> TIME
        The Types.TIME type.
      • INTERVAL

        public static final DataType<YearToSecond> INTERVAL
        The SQL standard INTERVAL YEAR TO SECOND data type.
      • INTERVALYEARTOMONTH

        public static final DataType<YearToMonth> INTERVALYEARTOMONTH
        The SQL standard INTERVAL YEAR TO MONTH data type.
      • INTERVALDAYTOSECOND

        public static final DataType<DayToSecond> INTERVALDAYTOSECOND
        The SQL standard INTERVAL DAY TO SECOND data type.
      • LOCALDATE

        public static final DataType<java.time.LocalDate> LOCALDATE
        The Types.DATE type.
      • LOCALTIME

        public static final DataType<java.time.LocalTime> LOCALTIME
        The Types.TIME type.
      • LOCALDATETIME

        public static final DataType<java.time.LocalDateTime> LOCALDATETIME
        The Types.TIMESTAMP type.
      • OFFSETTIME

        public static final DataType<java.time.OffsetTime> OFFSETTIME
        The Types.TIME_WITH_TIMEZONE type.

        The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in ZonedDateTime), other databases support only offsets (as in OffsetDateTime). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g. SQLDialect.ORACLE), others use this type as a synonym for a timestamp in UTC (e.g. SQLDialect.POSTGRES), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.

      • OFFSETDATETIME

        public static final DataType<java.time.OffsetDateTime> OFFSETDATETIME
        The Types.TIMESTAMP_WITH_TIMEZONE type.

        The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in ZonedDateTime), other databases support only offsets (as in OffsetDateTime). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g. SQLDialect.ORACLE), others use this type as a synonym for a timestamp in UTC (e.g. SQLDialect.POSTGRES), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.

      • TIMEWITHTIMEZONE

        public static final DataType<java.time.OffsetTime> TIMEWITHTIMEZONE
        The Types.TIME_WITH_TIMEZONE type.

        An alias for OFFSETTIME

      • TIMESTAMPWITHTIMEZONE

        public static final DataType<java.time.OffsetDateTime> TIMESTAMPWITHTIMEZONE
        The Types.TIMESTAMP_WITH_TIMEZONE type.

        An alias for OFFSETDATETIME

      • INSTANT

        public static final DataType<java.time.Instant> INSTANT
        A Types.TIMESTAMP_WITH_TIMEZONE type that uses UTC as time zone.

        Neither JDBC, nor most SQL databases support the INSTANT data type, which is often the only kind of timestamp which can be expected to behave across all server and client time zone settings. This implementation is backed by the database vendor's TIMESTAMP WITH TIME ZONE data type implementation, which may (e.g. Oracle) or may not (e.g. PostgreSQL) store the timestamp information. Irrespective of that storage, this type will always produce time zone agnostic instants in client code.

      • BINARY

        public static final DataType<byte[]> BINARY
        The Types.BINARY type.
      • VARBINARY

        public static final DataType<byte[]> VARBINARY
        The Types.VARBINARY type.
      • LONGVARBINARY

        public static final DataType<byte[]> LONGVARBINARY
        The Types.LONGVARBINARY type.
      • BLOB

        public static final DataType<byte[]> BLOB
        The Types.BLOB type.
      • OTHER

        public static final DataType<java.lang.Object> OTHER
        The Types.OTHER type.
      • ROWID

        public static final DataType<RowId> ROWID
        The Types.ROWID type.
      • RECORD

        public static final DataType<Record> RECORD
        The Types.STRUCT type.
      • RESULT

        public static final DataType<Result<Record>> RESULT
        The ResultSet type.

        This is not a SQL or JDBC standard. This type emulates REF CURSOR types and similar constructs

      • UUID

        public static final DataType<java.util.UUID> UUID
        The UUID type.

        This is not a SQL or JDBC standard. This type handles UUID types where they are supported

      • JSON

        public static final DataType<JSON> JSON
        The JSON type.

        This is not a SQL or JDBC standard. This type handles JSON types where they are supported.

      • JSONB

        public static final DataType<JSONB> JSONB
        The JSONB type.

        This is not a SQL or JDBC standard. This type handles JSONB types where they are supported

    • Method Detail

      • VARCHAR

        public static final DataType<java.lang.String> VARCHAR​(int length)
        The Types.VARCHAR type.
      • CHAR

        public static final DataType<java.lang.String> CHAR​(int length)
        The Types.CHAR type.
      • LONGVARCHAR

        public static final DataType<java.lang.String> LONGVARCHAR​(int length)
        The Types.LONGVARCHAR type.
      • CLOB

        public static final DataType<java.lang.String> CLOB​(int length)
        The Types.CLOB type.
      • NVARCHAR

        public static final DataType<java.lang.String> NVARCHAR​(int length)
        The Types.NVARCHAR type.
      • NCHAR

        public static final DataType<java.lang.String> NCHAR​(int length)
        The Types.NCHAR type.
      • LONGNVARCHAR

        public static final DataType<java.lang.String> LONGNVARCHAR​(int length)
        The Types.LONGNVARCHAR type.
      • NCLOB

        public static final DataType<java.lang.String> NCLOB​(int length)
        The Types.NCLOB type.
      • DECIMAL_INTEGER

        public static final DataType<java.math.BigInteger> DECIMAL_INTEGER​(int precision)
        The zero-scale Types.DECIMAL type.
      • NUMERIC

        public static final DataType<java.math.BigDecimal> NUMERIC​(int precision)
        The Types.NUMERIC type.
      • NUMERIC

        public static final DataType<java.math.BigDecimal> NUMERIC​(int precision,
                                                                   int scale)
        The Types.NUMERIC type.
      • DECIMAL

        public static final DataType<java.math.BigDecimal> DECIMAL​(int precision)
        The Types.DECIMAL type.
      • DECIMAL

        public static final DataType<java.math.BigDecimal> DECIMAL​(int precision,
                                                                   int scale)
        The Types.DECIMAL type.
      • TIMESTAMP

        public static final DataType<java.sql.Timestamp> TIMESTAMP​(int precision)
        The Types.TIMESTAMP type.
      • TIME

        public static final DataType<java.sql.Time> TIME​(int precision)
        The Types.TIME type.
      • OFFSETTIME

        public static final DataType<java.time.OffsetTime> OFFSETTIME​(int precision)
        The Types.TIME_WITH_TIMEZONE type.

        The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in ZonedDateTime), other databases support only offsets (as in OffsetDateTime). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g. SQLDialect.ORACLE), others use this type as a synonym for a timestamp in UTC (e.g. SQLDialect.POSTGRES), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.

      • OFFSETDATETIME

        public static final DataType<java.time.OffsetDateTime> OFFSETDATETIME​(int precision)
        The Types.TIMESTAMP_WITH_TIMEZONE type.

        The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in ZonedDateTime), other databases support only offsets (as in OffsetDateTime). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g. SQLDialect.ORACLE), others use this type as a synonym for a timestamp in UTC (e.g. SQLDialect.POSTGRES), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.

      • TIMEWITHTIMEZONE

        public static final DataType<java.time.OffsetTime> TIMEWITHTIMEZONE​(int precision)
        The Types.TIME_WITH_TIMEZONE type.

        An alias for OFFSETTIME

      • TIMESTAMPWITHTIMEZONE

        public static final DataType<java.time.OffsetDateTime> TIMESTAMPWITHTIMEZONE​(int precision)
        The Types.TIMESTAMP_WITH_TIMEZONE type.

        An alias for OFFSETDATETIME

      • INSTANT

        public static final DataType<java.time.Instant> INSTANT​(int precision)
        A Types.TIMESTAMP_WITH_TIMEZONE type that uses UTC as time zone.

        Neither JDBC, nor most SQL databases support the INSTANT data type, which is often the only kind of timestamp which can be expected to behave across all server and client time zone settings. This implementation is backed by the database vendor's TIMESTAMP WITH TIME ZONE data type implementation, which may (e.g. Oracle) or may not (e.g. PostgreSQL) store the timestamp information. Irrespective of that storage, this type will always produce time zone agnostic instants in client code.

      • BINARY

        public static final DataType<byte[]> BINARY​(int length)
        The Types.BINARY type.
      • VARBINARY

        public static final DataType<byte[]> VARBINARY​(int length)
        The Types.VARBINARY type.
      • LONGVARBINARY

        public static final DataType<byte[]> LONGVARBINARY​(int length)
        The Types.LONGVARBINARY type.
      • BLOB

        public static final DataType<byte[]> BLOB​(int length)
        The Types.BLOB type.