[#566] Add support for INTERVAL data types - initial implementation for the Postgres dialect
This commit is contained in:
parent
c3640ea846
commit
3c242dd05d
@ -8,7 +8,7 @@ package org.jooq.test.oracle.generatedclasses.test.tables;
|
||||
*/
|
||||
public class TDates extends org.jooq.impl.UpdatableTableImpl<org.jooq.test.oracle.generatedclasses.test.tables.records.TDatesRecord> {
|
||||
|
||||
private static final long serialVersionUID = 2000943673;
|
||||
private static final long serialVersionUID = -745318463;
|
||||
|
||||
/**
|
||||
* The singleton instance of TEST.T_DATES
|
||||
@ -63,12 +63,12 @@ public class TDates extends org.jooq.impl.UpdatableTableImpl<org.jooq.test.oracl
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public final org.jooq.TableField<org.jooq.test.oracle.generatedclasses.test.tables.records.TDatesRecord, org.jooq.types.YearToMonth> I_Y = createField("I_Y", org.jooq.impl.SQLDataType.INTERVAL_YEAR_TO_MONTH, this);
|
||||
public final org.jooq.TableField<org.jooq.test.oracle.generatedclasses.test.tables.records.TDatesRecord, org.jooq.types.YearToMonth> I_Y = createField("I_Y", org.jooq.impl.SQLDataType.INTERVALYEARTOMONTH, this);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public final org.jooq.TableField<org.jooq.test.oracle.generatedclasses.test.tables.records.TDatesRecord, org.jooq.types.DayToSecond> I_D = createField("I_D", org.jooq.impl.SQLDataType.INTERVAL_DAY_TO_SECOND, this);
|
||||
public final org.jooq.TableField<org.jooq.test.oracle.generatedclasses.test.tables.records.TDatesRecord, org.jooq.types.DayToSecond> I_D = createField("I_D", org.jooq.impl.SQLDataType.INTERVALDAYTOSECOND, this);
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
|
||||
@ -40,6 +40,7 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
import static org.jooq.SQLDialect.SQLSERVER;
|
||||
import static org.jooq.SQLDialect.SYBASE;
|
||||
import static org.jooq.util.postgres.PGIntervalConverter.toPGInterval;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
@ -221,13 +222,23 @@ class DefaultBindContext extends AbstractBindContext {
|
||||
else if (type == Timestamp.class) {
|
||||
stmt.setTimestamp(nextIndex(), (Timestamp) value);
|
||||
}
|
||||
|
||||
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
else if (type == YearToMonth.class) {
|
||||
stmt.setString(nextIndex(), value.toString());
|
||||
if (dialect == POSTGRES) {
|
||||
stmt.setObject(nextIndex(), toPGInterval((YearToMonth) value));
|
||||
}
|
||||
else {
|
||||
stmt.setString(nextIndex(), value.toString());
|
||||
}
|
||||
}
|
||||
else if (type == DayToSecond.class) {
|
||||
stmt.setString(nextIndex(), value.toString());
|
||||
if (dialect == POSTGRES) {
|
||||
stmt.setObject(nextIndex(), toPGInterval((DayToSecond) value));
|
||||
}
|
||||
else {
|
||||
stmt.setString(nextIndex(), value.toString());
|
||||
}
|
||||
}
|
||||
else if (UNumber.class.isAssignableFrom(type)) {
|
||||
stmt.setString(nextIndex(), value.toString());
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.impl.Factory.getNewFactory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -87,6 +88,7 @@ import org.jooq.util.hsqldb.HSQLDBDataType;
|
||||
import org.jooq.util.ingres.IngresDataType;
|
||||
import org.jooq.util.mysql.MySQLDataType;
|
||||
import org.jooq.util.oracle.OracleDataType;
|
||||
import org.jooq.util.postgres.PGIntervalConverter;
|
||||
import org.jooq.util.postgres.PGobjectParser;
|
||||
import org.jooq.util.postgres.PostgresDataType;
|
||||
import org.jooq.util.sqlite.SQLiteDataType;
|
||||
@ -380,12 +382,24 @@ public final class FieldTypeHelper {
|
||||
return (T) getTimestamp(ctx.getDialect(), rs, index);
|
||||
}
|
||||
else if (type == YearToMonth.class) {
|
||||
String string = rs.getString(index);
|
||||
return (T) (string == null ? null : YearToMonth.valueOf(string));
|
||||
if (ctx.getDialect() == POSTGRES) {
|
||||
Object object = rs.getObject(index);
|
||||
return (T) (object == null ? null : PGIntervalConverter.toYearToMonth(object));
|
||||
}
|
||||
else {
|
||||
String string = rs.getString(index);
|
||||
return (T) (string == null ? null : YearToMonth.valueOf(string));
|
||||
}
|
||||
}
|
||||
else if (type == DayToSecond.class) {
|
||||
String string = rs.getString(index);
|
||||
return (T) (string == null ? null : DayToSecond.valueOf(string));
|
||||
if (ctx.getDialect() == POSTGRES) {
|
||||
Object object = rs.getObject(index);
|
||||
return (T) (object == null ? null : PGIntervalConverter.toDayToSecond(object));
|
||||
}
|
||||
else {
|
||||
String string = rs.getString(index);
|
||||
return (T) (string == null ? null : DayToSecond.valueOf(string));
|
||||
}
|
||||
}
|
||||
else if (type == UByte.class) {
|
||||
String string = rs.getString(index);
|
||||
@ -653,12 +667,24 @@ public final class FieldTypeHelper {
|
||||
return (T) stmt.getTimestamp(index);
|
||||
}
|
||||
else if (type == YearToMonth.class) {
|
||||
String string = stmt.getString(index);
|
||||
return (T) (string == null ? null : YearToMonth.valueOf(string));
|
||||
if (ctx.getDialect() == POSTGRES) {
|
||||
Object object = stmt.getObject(index);
|
||||
return (T) (object == null ? null : PGIntervalConverter.toYearToMonth(object));
|
||||
}
|
||||
else {
|
||||
String string = stmt.getString(index);
|
||||
return (T) (string == null ? null : YearToMonth.valueOf(string));
|
||||
}
|
||||
}
|
||||
else if (type == DayToSecond.class) {
|
||||
String string = stmt.getString(index);
|
||||
return (T) (string == null ? null : DayToSecond.valueOf(string));
|
||||
if (ctx.getDialect() == POSTGRES) {
|
||||
Object object = stmt.getObject(index);
|
||||
return (T) (object == null ? null : PGIntervalConverter.toDayToSecond(object));
|
||||
}
|
||||
else {
|
||||
String string = stmt.getString(index);
|
||||
return (T) (string == null ? null : DayToSecond.valueOf(string));
|
||||
}
|
||||
}
|
||||
else if (type == UByte.class) {
|
||||
String string = stmt.getString(index);
|
||||
|
||||
@ -250,12 +250,12 @@ public final class SQLDataType<T> extends AbstractDataType<T> {
|
||||
/**
|
||||
* The SQL standard <code>INTERVAL YEAR TO MONTH</code> data type
|
||||
*/
|
||||
public static final SQLDataType<YearToMonth> INTERVAL_YEAR_TO_MONTH = new SQLDataType<YearToMonth>(YearToMonth.class, "interval_year_to_month");
|
||||
public static final SQLDataType<YearToMonth> INTERVALYEARTOMONTH = new SQLDataType<YearToMonth>(YearToMonth.class, "interval year to month");
|
||||
|
||||
/**
|
||||
* The SQL standard <code>INTERVAL DAY TO SECOND</code> data type
|
||||
*/
|
||||
public static final SQLDataType<DayToSecond> INTERVAL_DAY_TO_SECOND = new SQLDataType<DayToSecond>(DayToSecond.class, "interval_day_to_second");
|
||||
public static final SQLDataType<DayToSecond> INTERVALDAYTOSECOND = new SQLDataType<DayToSecond>(DayToSecond.class, "interval day to second");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Binary types
|
||||
|
||||
@ -38,6 +38,7 @@ package org.jooq.types;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jooq.tools.Convert;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
/**
|
||||
@ -53,7 +54,7 @@ public final class DayToSecond implements Interval<DayToSecond> {
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = -3853596481984643811L;
|
||||
private static final Pattern PATTERN = Pattern.compile("(\\+|-)?(\\d+) (\\d+):(\\d+):(\\d+)\\.(\\d+)");
|
||||
private static final Pattern PATTERN = Pattern.compile("(\\+|-)?(?:(\\d+) )?(\\d+):(\\d+):(\\d+)(?:\\.(\\d+))?");
|
||||
|
||||
private final boolean negative;
|
||||
private final int days;
|
||||
@ -98,6 +99,26 @@ public final class DayToSecond implements Interval<DayToSecond> {
|
||||
}
|
||||
|
||||
private DayToSecond(int days, int hours, int minutes, int seconds, int nano, boolean negative) {
|
||||
|
||||
// Perform normalisation. Specifically, Postgres may return intervals
|
||||
// such as 24:00:00, 25:13:15, etc...
|
||||
if (nano >= 1000000000) {
|
||||
seconds += (nano / 1000000000);
|
||||
nano %= 1000000000;
|
||||
}
|
||||
if (seconds >= 60) {
|
||||
minutes += (seconds / 60);
|
||||
seconds %= 60;
|
||||
}
|
||||
if (minutes >= 60) {
|
||||
hours += (minutes / 60);
|
||||
minutes %= 60;
|
||||
}
|
||||
if (hours >= 24) {
|
||||
days += (hours / 24);
|
||||
hours %= 24;
|
||||
}
|
||||
|
||||
this.negative = negative;
|
||||
this.days = days;
|
||||
this.hours = hours;
|
||||
@ -120,11 +141,11 @@ public final class DayToSecond implements Interval<DayToSecond> {
|
||||
|
||||
if (matcher.find()) {
|
||||
boolean negative = "-".equals(matcher.group(1));
|
||||
int days = Integer.parseInt(matcher.group(2));
|
||||
int hours = Integer.parseInt(matcher.group(3));
|
||||
int minutes = Integer.parseInt(matcher.group(4));
|
||||
int seconds = Integer.parseInt(matcher.group(5));
|
||||
int nano = Integer.parseInt(StringUtils.rightPad(matcher.group(6), 9, "0"));
|
||||
int days = Convert.convert(matcher.group(2), int.class);
|
||||
int hours = Convert.convert(matcher.group(3), int.class);
|
||||
int minutes = Convert.convert(matcher.group(4), int.class);
|
||||
int seconds = Convert.convert(matcher.group(5), int.class);
|
||||
int nano = Convert.convert(StringUtils.rightPad(matcher.group(6), 9, "0"), int.class);
|
||||
|
||||
return new DayToSecond(days, hours, minutes, seconds, nano, negative);
|
||||
}
|
||||
@ -147,6 +168,26 @@ public final class DayToSecond implements Interval<DayToSecond> {
|
||||
return new DayToSecond(days, hours, minutes, seconds, nano, false);
|
||||
}
|
||||
|
||||
public final int getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public final int getHours() {
|
||||
return hours;
|
||||
}
|
||||
|
||||
public final int getMinutes() {
|
||||
return minutes;
|
||||
}
|
||||
|
||||
public final int getSeconds() {
|
||||
return seconds;
|
||||
}
|
||||
|
||||
public final int getNano() {
|
||||
return nano;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX Comparable and Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -72,6 +72,14 @@ public final class YearToMonth implements Interval<YearToMonth> {
|
||||
}
|
||||
|
||||
private YearToMonth(int years, int months, boolean negative) {
|
||||
|
||||
// Perform normalisation. Specifically, Postgres may return intervals
|
||||
// such as 0-13
|
||||
if (months >= 12) {
|
||||
years += (months / 12);
|
||||
months %= 12;
|
||||
}
|
||||
|
||||
this.negative = negative;
|
||||
this.years = years;
|
||||
this.months = months;
|
||||
@ -115,6 +123,14 @@ public final class YearToMonth implements Interval<YearToMonth> {
|
||||
return new YearToMonth(years, months, false);
|
||||
}
|
||||
|
||||
public final int getYears() {
|
||||
return years;
|
||||
}
|
||||
|
||||
public final int getMonths() {
|
||||
return months;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX Comparable and Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -62,84 +62,84 @@ public class OracleDataType<T> extends AbstractDataType<T> {
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = -5677365115109672781L;
|
||||
private static final long serialVersionUID = -5677365115109672781L;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Default SQL data types and synonyms thereof
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final OracleDataType<BigDecimal> NUMBER = new OracleDataType<BigDecimal>(SQLDataType.NUMERIC, "number", true);
|
||||
public static final OracleDataType<BigDecimal> NUMERIC = new OracleDataType<BigDecimal>(SQLDataType.NUMERIC, "numeric", true);
|
||||
public static final OracleDataType<BigDecimal> DECIMAL = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "decimal", true);
|
||||
public static final OracleDataType<BigDecimal> DEC = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "dec", true);
|
||||
public static final OracleDataType<String> VARCHAR2 = new OracleDataType<String>(SQLDataType.VARCHAR, "varchar2", "varchar2(4000)");
|
||||
public static final OracleDataType<String> VARCHAR = new OracleDataType<String>(SQLDataType.VARCHAR, "varchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> CHAR = new OracleDataType<String>(SQLDataType.CHAR, "char", "varchar2(4000)");
|
||||
public static final OracleDataType<String> CLOB = new OracleDataType<String>(SQLDataType.CLOB, "clob");
|
||||
public static final OracleDataType<String> NVARCHAR2 = new OracleDataType<String>(SQLDataType.NVARCHAR, "nvarchar2", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NVARCHAR = new OracleDataType<String>(SQLDataType.NVARCHAR, "nvarchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NCHAR = new OracleDataType<String>(SQLDataType.NCHAR, "nchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NCLOB = new OracleDataType<String>(SQLDataType.NCLOB, "nclob");
|
||||
public static final OracleDataType<Date> DATE = new OracleDataType<Date>(SQLDataType.DATE, "date");
|
||||
public static final OracleDataType<Timestamp> TIMESTAMP = new OracleDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp");
|
||||
public static final OracleDataType<byte[]> BLOB = new OracleDataType<byte[]>(SQLDataType.BLOB, "blob");
|
||||
public static final OracleDataType<YearToMonth> INTERVALYEARTOMONTH = new OracleDataType<YearToMonth>(SQLDataType.INTERVAL_YEAR_TO_MONTH, "interval year to month");
|
||||
public static final OracleDataType<DayToSecond> INTERVALDAYTOSECOND = new OracleDataType<DayToSecond>(SQLDataType.INTERVAL_DAY_TO_SECOND, "interval day to second");
|
||||
public static final OracleDataType<BigDecimal> NUMBER = new OracleDataType<BigDecimal>(SQLDataType.NUMERIC, "number", true);
|
||||
public static final OracleDataType<BigDecimal> NUMERIC = new OracleDataType<BigDecimal>(SQLDataType.NUMERIC, "numeric", true);
|
||||
public static final OracleDataType<BigDecimal> DECIMAL = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "decimal", true);
|
||||
public static final OracleDataType<BigDecimal> DEC = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "dec", true);
|
||||
public static final OracleDataType<String> VARCHAR2 = new OracleDataType<String>(SQLDataType.VARCHAR, "varchar2", "varchar2(4000)");
|
||||
public static final OracleDataType<String> VARCHAR = new OracleDataType<String>(SQLDataType.VARCHAR, "varchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> CHAR = new OracleDataType<String>(SQLDataType.CHAR, "char", "varchar2(4000)");
|
||||
public static final OracleDataType<String> CLOB = new OracleDataType<String>(SQLDataType.CLOB, "clob");
|
||||
public static final OracleDataType<String> NVARCHAR2 = new OracleDataType<String>(SQLDataType.NVARCHAR, "nvarchar2", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NVARCHAR = new OracleDataType<String>(SQLDataType.NVARCHAR, "nvarchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NCHAR = new OracleDataType<String>(SQLDataType.NCHAR, "nchar", "varchar2(4000)");
|
||||
public static final OracleDataType<String> NCLOB = new OracleDataType<String>(SQLDataType.NCLOB, "nclob");
|
||||
public static final OracleDataType<Date> DATE = new OracleDataType<Date>(SQLDataType.DATE, "date");
|
||||
public static final OracleDataType<Timestamp> TIMESTAMP = new OracleDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp");
|
||||
public static final OracleDataType<byte[]> BLOB = new OracleDataType<byte[]>(SQLDataType.BLOB, "blob");
|
||||
public static final OracleDataType<YearToMonth> INTERVALYEARTOMONTH = new OracleDataType<YearToMonth>(SQLDataType.INTERVALYEARTOMONTH, "interval year to month");
|
||||
public static final OracleDataType<DayToSecond> INTERVALDAYTOSECOND = new OracleDataType<DayToSecond>(SQLDataType.INTERVALDAYTOSECOND, "interval day to second");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Compatibility types for supported SQLDataTypes
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected static final OracleDataType<byte[]> __BINARY = new OracleDataType<byte[]>(SQLDataType.BINARY, "blob");
|
||||
protected static final OracleDataType<Long> __BIGINT = new OracleDataType<Long>(SQLDataType.BIGINT, "number", "number(19)");
|
||||
protected static final OracleDataType<Boolean> __BIT = new OracleDataType<Boolean>(SQLDataType.BIT, "number", "number(1)");
|
||||
protected static final OracleDataType<Boolean> __BOOLEAN = new OracleDataType<Boolean>(SQLDataType.BOOLEAN, "number", "number(1)");
|
||||
protected static final OracleDataType<Double> __DOUBLE = new OracleDataType<Double>(SQLDataType.DOUBLE, "number");
|
||||
protected static final OracleDataType<Double> __FLOAT = new OracleDataType<Double>(SQLDataType.FLOAT, "number");
|
||||
protected static final OracleDataType<Integer> __INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "number", "number(10)");
|
||||
protected static final OracleDataType<byte[]> __LONGVARBINARY = new OracleDataType<byte[]>(SQLDataType.LONGVARBINARY, "blob");
|
||||
protected static final OracleDataType<String> __LONGVARCHAR = new OracleDataType<String>(SQLDataType.LONGVARCHAR, "varchar2", "varchar2(4000)");
|
||||
protected static final OracleDataType<String> __LONGNVARCHAR = new OracleDataType<String>(SQLDataType.LONGNVARCHAR, "varchar2", "varchar2(4000)");
|
||||
protected static final OracleDataType<Float> __REAL = new OracleDataType<Float>(SQLDataType.REAL, "number");
|
||||
protected static final OracleDataType<Short> __SMALLINT = new OracleDataType<Short>(SQLDataType.SMALLINT, "number", "number(5)");
|
||||
protected static final OracleDataType<Time> __TIME = new OracleDataType<Time>(SQLDataType.TIME, "timestamp");
|
||||
protected static final OracleDataType<Byte> __TINYINT = new OracleDataType<Byte>(SQLDataType.TINYINT, "number", "number(3)");
|
||||
protected static final OracleDataType<byte[]> __VARBINARY = new OracleDataType<byte[]>(SQLDataType.VARBINARY, "blob");
|
||||
protected static final OracleDataType<byte[]> __BINARY = new OracleDataType<byte[]>(SQLDataType.BINARY, "blob");
|
||||
protected static final OracleDataType<Long> __BIGINT = new OracleDataType<Long>(SQLDataType.BIGINT, "number", "number(19)");
|
||||
protected static final OracleDataType<Boolean> __BIT = new OracleDataType<Boolean>(SQLDataType.BIT, "number", "number(1)");
|
||||
protected static final OracleDataType<Boolean> __BOOLEAN = new OracleDataType<Boolean>(SQLDataType.BOOLEAN, "number", "number(1)");
|
||||
protected static final OracleDataType<Double> __DOUBLE = new OracleDataType<Double>(SQLDataType.DOUBLE, "number");
|
||||
protected static final OracleDataType<Double> __FLOAT = new OracleDataType<Double>(SQLDataType.FLOAT, "number");
|
||||
protected static final OracleDataType<Integer> __INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "number", "number(10)");
|
||||
protected static final OracleDataType<byte[]> __LONGVARBINARY = new OracleDataType<byte[]>(SQLDataType.LONGVARBINARY, "blob");
|
||||
protected static final OracleDataType<String> __LONGVARCHAR = new OracleDataType<String>(SQLDataType.LONGVARCHAR, "varchar2", "varchar2(4000)");
|
||||
protected static final OracleDataType<String> __LONGNVARCHAR = new OracleDataType<String>(SQLDataType.LONGNVARCHAR, "varchar2", "varchar2(4000)");
|
||||
protected static final OracleDataType<Float> __REAL = new OracleDataType<Float>(SQLDataType.REAL, "number");
|
||||
protected static final OracleDataType<Short> __SMALLINT = new OracleDataType<Short>(SQLDataType.SMALLINT, "number", "number(5)");
|
||||
protected static final OracleDataType<Time> __TIME = new OracleDataType<Time>(SQLDataType.TIME, "timestamp");
|
||||
protected static final OracleDataType<Byte> __TINYINT = new OracleDataType<Byte>(SQLDataType.TINYINT, "number", "number(3)");
|
||||
protected static final OracleDataType<byte[]> __VARBINARY = new OracleDataType<byte[]>(SQLDataType.VARBINARY, "blob");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Compatibility types for supported Java types
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected static final OracleDataType<BigInteger> __BIGINTEGER = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "number");
|
||||
protected static final OracleDataType<BigInteger> __BIGINTEGER = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "number");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Dialect-specific data types and synonyms thereof
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final OracleDataType<Result<Record>> REF_CURSOR = new OracleDataType<Result<Record>>(SQLDataType.RESULT, "ref cursor");
|
||||
public static final OracleDataType<Result<Record>> REF_CURSOR = new OracleDataType<Result<Record>>(SQLDataType.RESULT, "ref cursor");
|
||||
|
||||
public static final OracleDataType<String> LONG = new OracleDataType<String>(SQLDataType.CLOB, "long");
|
||||
public static final OracleDataType<byte[]> RAW = new OracleDataType<byte[]>(SQLDataType.BLOB, "raw");
|
||||
public static final OracleDataType<byte[]> LONGRAW = new OracleDataType<byte[]>(SQLDataType.BLOB, "longraw");
|
||||
public static final OracleDataType<byte[]> BFILE = new OracleDataType<byte[]>(SQLDataType.BLOB, "bfile");
|
||||
public static final OracleDataType<String> LONG = new OracleDataType<String>(SQLDataType.CLOB, "long");
|
||||
public static final OracleDataType<byte[]> RAW = new OracleDataType<byte[]>(SQLDataType.BLOB, "raw");
|
||||
public static final OracleDataType<byte[]> LONGRAW = new OracleDataType<byte[]>(SQLDataType.BLOB, "longraw");
|
||||
public static final OracleDataType<byte[]> BFILE = new OracleDataType<byte[]>(SQLDataType.BLOB, "bfile");
|
||||
|
||||
// PL/SQL data types
|
||||
public static final OracleDataType<Integer> BINARY_INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "binary_integer");
|
||||
public static final OracleDataType<Integer> PLS_INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "pls_integer");
|
||||
public static final OracleDataType<Integer> NATURAL = new OracleDataType<Integer>(SQLDataType.INTEGER, "natural");
|
||||
public static final OracleDataType<Integer> NATURALN = new OracleDataType<Integer>(SQLDataType.INTEGER, "naturaln");
|
||||
public static final OracleDataType<Integer> POSITIVE = new OracleDataType<Integer>(SQLDataType.INTEGER, "positive");
|
||||
public static final OracleDataType<Integer> POSITIVEN = new OracleDataType<Integer>(SQLDataType.INTEGER, "positiven");
|
||||
public static final OracleDataType<Integer> SIGNTYPE = new OracleDataType<Integer>(SQLDataType.INTEGER, "signtype");
|
||||
public static final OracleDataType<Double> REAL = new OracleDataType<Double>(SQLDataType.DOUBLE, "real");
|
||||
public static final OracleDataType<Double> DOUBLE_PRECISION = new OracleDataType<Double>(SQLDataType.DOUBLE, "double_precision");
|
||||
public static final OracleDataType<Double> BINARY_DOUBLE = new OracleDataType<Double>(SQLDataType.DOUBLE, "binary_double");
|
||||
public static final OracleDataType<BigDecimal> FLOAT = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "float");
|
||||
public static final OracleDataType<BigDecimal> BINARY_FLOAT = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "binary_float");
|
||||
public static final OracleDataType<BigInteger> INTEGER = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "integer");
|
||||
public static final OracleDataType<BigInteger> INT = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "int");
|
||||
public static final OracleDataType<BigInteger> SMALLINT = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "smallint");
|
||||
public static final OracleDataType<Boolean> BOOLEAN = new OracleDataType<Boolean>(SQLDataType.BOOLEAN, "boolean");
|
||||
public static final OracleDataType<Integer> BINARY_INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "binary_integer");
|
||||
public static final OracleDataType<Integer> PLS_INTEGER = new OracleDataType<Integer>(SQLDataType.INTEGER, "pls_integer");
|
||||
public static final OracleDataType<Integer> NATURAL = new OracleDataType<Integer>(SQLDataType.INTEGER, "natural");
|
||||
public static final OracleDataType<Integer> NATURALN = new OracleDataType<Integer>(SQLDataType.INTEGER, "naturaln");
|
||||
public static final OracleDataType<Integer> POSITIVE = new OracleDataType<Integer>(SQLDataType.INTEGER, "positive");
|
||||
public static final OracleDataType<Integer> POSITIVEN = new OracleDataType<Integer>(SQLDataType.INTEGER, "positiven");
|
||||
public static final OracleDataType<Integer> SIGNTYPE = new OracleDataType<Integer>(SQLDataType.INTEGER, "signtype");
|
||||
public static final OracleDataType<Double> REAL = new OracleDataType<Double>(SQLDataType.DOUBLE, "real");
|
||||
public static final OracleDataType<Double> DOUBLE_PRECISION = new OracleDataType<Double>(SQLDataType.DOUBLE, "double_precision");
|
||||
public static final OracleDataType<Double> BINARY_DOUBLE = new OracleDataType<Double>(SQLDataType.DOUBLE, "binary_double");
|
||||
public static final OracleDataType<BigDecimal> FLOAT = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "float");
|
||||
public static final OracleDataType<BigDecimal> BINARY_FLOAT = new OracleDataType<BigDecimal>(SQLDataType.DECIMAL, "binary_float");
|
||||
public static final OracleDataType<BigInteger> INTEGER = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "integer");
|
||||
public static final OracleDataType<BigInteger> INT = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "int");
|
||||
public static final OracleDataType<BigInteger> SMALLINT = new OracleDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "smallint");
|
||||
public static final OracleDataType<Boolean> BOOLEAN = new OracleDataType<Boolean>(SQLDataType.BOOLEAN, "boolean");
|
||||
|
||||
private OracleDataType(SQLDataType<T> sqlDataType, String typeName) {
|
||||
this(sqlDataType, typeName, false);
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed to you under the Apache License, Version 2.0
|
||||
* (the "License"); You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* . Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* . Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* . Neither the name "jOOQ" nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.jooq.util.postgres;
|
||||
|
||||
import static org.jooq.tools.reflect.Reflect.on;
|
||||
|
||||
import org.jooq.tools.reflect.Reflect;
|
||||
import org.jooq.types.DayToSecond;
|
||||
import org.jooq.types.YearToMonth;
|
||||
|
||||
/**
|
||||
* A converter for <code>org.postgresql.util.PGInterval</code>
|
||||
* <p>
|
||||
* Postgres returns an undisclosed internal type for intervals. This converter
|
||||
* takes care of converting the internal type to jOOQ's interval data types
|
||||
* {@link DayToSecond} and {@link YearToMonth}
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
public class PGIntervalConverter {
|
||||
|
||||
public static Object toPGInterval(DayToSecond interval) {
|
||||
return on("org.postgresql.util.PGInterval").create(0, 0,
|
||||
interval.getDays(),
|
||||
interval.getHours(),
|
||||
interval.getMinutes(),
|
||||
interval.getSeconds() +
|
||||
interval.getNano() / 1000000000.0).get();
|
||||
}
|
||||
|
||||
public static Object toPGInterval(YearToMonth interval) {
|
||||
return on("org.postgresql.util.PGInterval").create(
|
||||
interval.getYears(),
|
||||
interval.getMonths(),
|
||||
0, 0, 0, 0.0).get();
|
||||
}
|
||||
|
||||
public static DayToSecond toDayToSecond(Object pgInterval) {
|
||||
Reflect i = on(pgInterval);
|
||||
Double seconds = i.call("getSeconds").<Double>get();
|
||||
return new DayToSecond(
|
||||
i.call("getDays").<Integer>get(),
|
||||
i.call("getHours").<Integer>get(),
|
||||
i.call("getMinutes").<Integer>get(),
|
||||
seconds.intValue(),
|
||||
(int) (1000000000 * (seconds - seconds.intValue())));
|
||||
}
|
||||
|
||||
public static YearToMonth toYearToMonth(Object pgInterval) {
|
||||
Reflect i = on(pgInterval);
|
||||
return new YearToMonth(
|
||||
i.call("getYears").<Integer>get(),
|
||||
i.call("getMonths").<Integer>get());
|
||||
}
|
||||
}
|
||||
@ -48,6 +48,8 @@ import org.jooq.Result;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.impl.AbstractDataType;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.types.DayToSecond;
|
||||
import org.jooq.types.YearToMonth;
|
||||
|
||||
/**
|
||||
* Supported data types for the {@link SQLDialect#POSTGRES} dialect
|
||||
@ -66,82 +68,84 @@ public class PostgresDataType<T> extends AbstractDataType<T> {
|
||||
// Default SQL data types and synonyms thereof
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final PostgresDataType<Short> SMALLINT = new PostgresDataType<Short>(SQLDataType.SMALLINT, "smallint");
|
||||
public static final PostgresDataType<Short> INT2 = new PostgresDataType<Short>(SQLDataType.SMALLINT, "int2");
|
||||
public static final PostgresDataType<Integer> INT = new PostgresDataType<Integer>(SQLDataType.INTEGER, "int");
|
||||
public static final PostgresDataType<Integer> INTEGER = new PostgresDataType<Integer>(SQLDataType.INTEGER, "integer");
|
||||
public static final PostgresDataType<Integer> INT4 = new PostgresDataType<Integer>(SQLDataType.INTEGER, "int4");
|
||||
public static final PostgresDataType<Long> BIGINT = new PostgresDataType<Long>(SQLDataType.BIGINT, "bigint");
|
||||
public static final PostgresDataType<Long> INT8 = new PostgresDataType<Long>(SQLDataType.BIGINT, "int8");
|
||||
public static final PostgresDataType<Double> DOUBLEPRECISION = new PostgresDataType<Double>(SQLDataType.DOUBLE, "double precision");
|
||||
public static final PostgresDataType<Double> FLOAT8 = new PostgresDataType<Double>(SQLDataType.FLOAT, "float8");
|
||||
public static final PostgresDataType<Float> REAL = new PostgresDataType<Float>(SQLDataType.REAL, "real");
|
||||
public static final PostgresDataType<Float> FLOAT4 = new PostgresDataType<Float>(SQLDataType.REAL, "float4");
|
||||
public static final PostgresDataType<Boolean> BOOLEAN = new PostgresDataType<Boolean>(SQLDataType.BOOLEAN, "boolean");
|
||||
public static final PostgresDataType<Boolean> BOOL = new PostgresDataType<Boolean>(SQLDataType.BOOLEAN, "bool");
|
||||
public static final PostgresDataType<BigDecimal> NUMERIC = new PostgresDataType<BigDecimal>(SQLDataType.NUMERIC, "numeric");
|
||||
public static final PostgresDataType<BigDecimal> DECIMAL = new PostgresDataType<BigDecimal>(SQLDataType.DECIMAL, "decimal");
|
||||
public static final PostgresDataType<String> VARCHAR = new PostgresDataType<String>(SQLDataType.VARCHAR, "varchar");
|
||||
public static final PostgresDataType<String> CHARACTERVARYING = new PostgresDataType<String>(SQLDataType.VARCHAR, "character varying");
|
||||
public static final PostgresDataType<String> CHAR = new PostgresDataType<String>(SQLDataType.CHAR, "char");
|
||||
public static final PostgresDataType<String> CHARACTER = new PostgresDataType<String>(SQLDataType.CHAR, "character");
|
||||
public static final PostgresDataType<String> TEXT = new PostgresDataType<String>(SQLDataType.CLOB, "text");
|
||||
public static final PostgresDataType<Date> DATE = new PostgresDataType<Date>(SQLDataType.DATE, "date");
|
||||
public static final PostgresDataType<Time> TIME = new PostgresDataType<Time>(SQLDataType.TIME, "time");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMP = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp");
|
||||
public static final PostgresDataType<byte[]> BYTEA = new PostgresDataType<byte[]>(SQLDataType.BLOB, "bytea");
|
||||
public static final PostgresDataType<Short> SMALLINT = new PostgresDataType<Short>(SQLDataType.SMALLINT, "smallint");
|
||||
public static final PostgresDataType<Short> INT2 = new PostgresDataType<Short>(SQLDataType.SMALLINT, "int2");
|
||||
public static final PostgresDataType<Integer> INT = new PostgresDataType<Integer>(SQLDataType.INTEGER, "int");
|
||||
public static final PostgresDataType<Integer> INTEGER = new PostgresDataType<Integer>(SQLDataType.INTEGER, "integer");
|
||||
public static final PostgresDataType<Integer> INT4 = new PostgresDataType<Integer>(SQLDataType.INTEGER, "int4");
|
||||
public static final PostgresDataType<Long> BIGINT = new PostgresDataType<Long>(SQLDataType.BIGINT, "bigint");
|
||||
public static final PostgresDataType<Long> INT8 = new PostgresDataType<Long>(SQLDataType.BIGINT, "int8");
|
||||
public static final PostgresDataType<Double> DOUBLEPRECISION = new PostgresDataType<Double>(SQLDataType.DOUBLE, "double precision");
|
||||
public static final PostgresDataType<Double> FLOAT8 = new PostgresDataType<Double>(SQLDataType.FLOAT, "float8");
|
||||
public static final PostgresDataType<Float> REAL = new PostgresDataType<Float>(SQLDataType.REAL, "real");
|
||||
public static final PostgresDataType<Float> FLOAT4 = new PostgresDataType<Float>(SQLDataType.REAL, "float4");
|
||||
public static final PostgresDataType<Boolean> BOOLEAN = new PostgresDataType<Boolean>(SQLDataType.BOOLEAN, "boolean");
|
||||
public static final PostgresDataType<Boolean> BOOL = new PostgresDataType<Boolean>(SQLDataType.BOOLEAN, "bool");
|
||||
public static final PostgresDataType<BigDecimal> NUMERIC = new PostgresDataType<BigDecimal>(SQLDataType.NUMERIC, "numeric");
|
||||
public static final PostgresDataType<BigDecimal> DECIMAL = new PostgresDataType<BigDecimal>(SQLDataType.DECIMAL, "decimal");
|
||||
public static final PostgresDataType<String> VARCHAR = new PostgresDataType<String>(SQLDataType.VARCHAR, "varchar");
|
||||
public static final PostgresDataType<String> CHARACTERVARYING = new PostgresDataType<String>(SQLDataType.VARCHAR, "character varying");
|
||||
public static final PostgresDataType<String> CHAR = new PostgresDataType<String>(SQLDataType.CHAR, "char");
|
||||
public static final PostgresDataType<String> CHARACTER = new PostgresDataType<String>(SQLDataType.CHAR, "character");
|
||||
public static final PostgresDataType<String> TEXT = new PostgresDataType<String>(SQLDataType.CLOB, "text");
|
||||
public static final PostgresDataType<Date> DATE = new PostgresDataType<Date>(SQLDataType.DATE, "date");
|
||||
public static final PostgresDataType<Time> TIME = new PostgresDataType<Time>(SQLDataType.TIME, "time");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMP = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp");
|
||||
public static final PostgresDataType<byte[]> BYTEA = new PostgresDataType<byte[]>(SQLDataType.BLOB, "bytea");
|
||||
public static final PostgresDataType<YearToMonth> INTERVALYEARTOMONTH = new PostgresDataType<YearToMonth>(SQLDataType.INTERVALYEARTOMONTH, "interval year to month");
|
||||
public static final PostgresDataType<DayToSecond> INTERVALDAYTOSECOND = new PostgresDataType<DayToSecond>(SQLDataType.INTERVALDAYTOSECOND, "interval day to second");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Compatibility types for supported SQLDataTypes
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected static final PostgresDataType<byte[]> __BINARY = new PostgresDataType<byte[]>(SQLDataType.BINARY, "bytea");
|
||||
protected static final PostgresDataType<Boolean> __BIT = new PostgresDataType<Boolean>(SQLDataType.BIT, "boolean");
|
||||
protected static final PostgresDataType<byte[]> __LONGVARBINARY = new PostgresDataType<byte[]>(SQLDataType.LONGVARBINARY, "bytea");
|
||||
protected static final PostgresDataType<String> __LONGVARCHAR = new PostgresDataType<String>(SQLDataType.LONGVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<String> __NCHAR = new PostgresDataType<String>(SQLDataType.NCHAR, "char");
|
||||
protected static final PostgresDataType<String> __NCLOB = new PostgresDataType<String>(SQLDataType.NCLOB, "text");
|
||||
protected static final PostgresDataType<String> __LONGNVARCHAR = new PostgresDataType<String>(SQLDataType.LONGNVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<String> __NVARCHAR = new PostgresDataType<String>(SQLDataType.NVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<Byte> __TINYINT = new PostgresDataType<Byte>(SQLDataType.TINYINT, "smallint");
|
||||
protected static final PostgresDataType<byte[]> __VARBINARY = new PostgresDataType<byte[]>(SQLDataType.VARBINARY, "bytea");
|
||||
protected static final PostgresDataType<byte[]> __BINARY = new PostgresDataType<byte[]>(SQLDataType.BINARY, "bytea");
|
||||
protected static final PostgresDataType<Boolean> __BIT = new PostgresDataType<Boolean>(SQLDataType.BIT, "boolean");
|
||||
protected static final PostgresDataType<byte[]> __LONGVARBINARY = new PostgresDataType<byte[]>(SQLDataType.LONGVARBINARY, "bytea");
|
||||
protected static final PostgresDataType<String> __LONGVARCHAR = new PostgresDataType<String>(SQLDataType.LONGVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<String> __NCHAR = new PostgresDataType<String>(SQLDataType.NCHAR, "char");
|
||||
protected static final PostgresDataType<String> __NCLOB = new PostgresDataType<String>(SQLDataType.NCLOB, "text");
|
||||
protected static final PostgresDataType<String> __LONGNVARCHAR = new PostgresDataType<String>(SQLDataType.LONGNVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<String> __NVARCHAR = new PostgresDataType<String>(SQLDataType.NVARCHAR, "varchar");
|
||||
protected static final PostgresDataType<Byte> __TINYINT = new PostgresDataType<Byte>(SQLDataType.TINYINT, "smallint");
|
||||
protected static final PostgresDataType<byte[]> __VARBINARY = new PostgresDataType<byte[]>(SQLDataType.VARBINARY, "bytea");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Compatibility types for supported Java types
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected static final PostgresDataType<BigInteger> __BIGINTEGER = new PostgresDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "decimal");
|
||||
protected static final PostgresDataType<BigInteger> __BIGINTEGER = new PostgresDataType<BigInteger>(SQLDataType.DECIMAL_INTEGER, "decimal");
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Dialect-specific data types and synonyms thereof
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static final PostgresDataType<Integer> SERIAL = new PostgresDataType<Integer>(SQLDataType.INTEGER, "serial");
|
||||
public static final PostgresDataType<Integer> SERIAL4 = new PostgresDataType<Integer>(SQLDataType.INTEGER, "serial4");
|
||||
public static final PostgresDataType<Long> BIGSERIAL = new PostgresDataType<Long>(SQLDataType.BIGINT, "bigserial");
|
||||
public static final PostgresDataType<Long> SERIAL8 = new PostgresDataType<Long>(SQLDataType.BIGINT, "serial8");
|
||||
public static final PostgresDataType<BigDecimal> MONEY = new PostgresDataType<BigDecimal>(SQLDataType.DECIMAL, "money");
|
||||
public static final PostgresDataType<String> BITVARYING = new PostgresDataType<String>(SQLDataType.VARCHAR, "bit varying");
|
||||
public static final PostgresDataType<String> VARBIT = new PostgresDataType<String>(SQLDataType.VARCHAR, "varbit");
|
||||
public static final PostgresDataType<String> BIT = new PostgresDataType<String>(SQLDataType.CHAR, "bit");
|
||||
public static final PostgresDataType<String> BPCHAR = new PostgresDataType<String>(SQLDataType.CHAR, "bpchar");
|
||||
public static final PostgresDataType<Time> TIMEWITHOUTTIMEZONE = new PostgresDataType<Time>(SQLDataType.TIME, "time without time zone");
|
||||
public static final PostgresDataType<Time> TIMEWITHTIMEZONE = new PostgresDataType<Time>(SQLDataType.TIME, "time with time zone");
|
||||
public static final PostgresDataType<Time> TIMETZ = new PostgresDataType<Time>(SQLDataType.TIME, "timetz");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPWITHOUTTIMEZONE = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp without time zone");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPWITHTIMEZONE = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp with time zone");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPTZ = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamptz");
|
||||
public static final PostgresDataType<Result<Record>> REFCURSOR = new PostgresDataType<Result<Record>>(SQLDataType.RESULT, "refcursor");
|
||||
public static final PostgresDataType<Integer> SERIAL = new PostgresDataType<Integer>(SQLDataType.INTEGER, "serial");
|
||||
public static final PostgresDataType<Integer> SERIAL4 = new PostgresDataType<Integer>(SQLDataType.INTEGER, "serial4");
|
||||
public static final PostgresDataType<Long> BIGSERIAL = new PostgresDataType<Long>(SQLDataType.BIGINT, "bigserial");
|
||||
public static final PostgresDataType<Long> SERIAL8 = new PostgresDataType<Long>(SQLDataType.BIGINT, "serial8");
|
||||
public static final PostgresDataType<BigDecimal> MONEY = new PostgresDataType<BigDecimal>(SQLDataType.DECIMAL, "money");
|
||||
public static final PostgresDataType<String> BITVARYING = new PostgresDataType<String>(SQLDataType.VARCHAR, "bit varying");
|
||||
public static final PostgresDataType<String> VARBIT = new PostgresDataType<String>(SQLDataType.VARCHAR, "varbit");
|
||||
public static final PostgresDataType<String> BIT = new PostgresDataType<String>(SQLDataType.CHAR, "bit");
|
||||
public static final PostgresDataType<String> BPCHAR = new PostgresDataType<String>(SQLDataType.CHAR, "bpchar");
|
||||
public static final PostgresDataType<Time> TIMEWITHOUTTIMEZONE = new PostgresDataType<Time>(SQLDataType.TIME, "time without time zone");
|
||||
public static final PostgresDataType<Time> TIMEWITHTIMEZONE = new PostgresDataType<Time>(SQLDataType.TIME, "time with time zone");
|
||||
public static final PostgresDataType<Time> TIMETZ = new PostgresDataType<Time>(SQLDataType.TIME, "timetz");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPWITHOUTTIMEZONE = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp without time zone");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPWITHTIMEZONE = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamp with time zone");
|
||||
public static final PostgresDataType<Timestamp> TIMESTAMPTZ = new PostgresDataType<Timestamp>(SQLDataType.TIMESTAMP, "timestamptz");
|
||||
public static final PostgresDataType<Result<Record>> REFCURSOR = new PostgresDataType<Result<Record>>(SQLDataType.RESULT, "refcursor");
|
||||
|
||||
// Meta-table types
|
||||
public static final PostgresDataType<Long> OID = new PostgresDataType<Long>(SQLDataType.BIGINT, "oid");
|
||||
public static final PostgresDataType<Long> OIDVECTOR = new PostgresDataType<Long>(SQLDataType.BIGINT, "oidvector");
|
||||
public static final PostgresDataType<Long> XID = new PostgresDataType<Long>(SQLDataType.BIGINT, "xid");
|
||||
public static final PostgresDataType<Long> TID = new PostgresDataType<Long>(SQLDataType.BIGINT, "tid");
|
||||
public static final PostgresDataType<Long> CID = new PostgresDataType<Long>(SQLDataType.BIGINT, "cid");
|
||||
public static final PostgresDataType<String> ACLITEM = new PostgresDataType<String>(SQLDataType.VARCHAR, "aclitem");
|
||||
public static final PostgresDataType<String> NAME = new PostgresDataType<String>(SQLDataType.VARCHAR, "name");
|
||||
public static final PostgresDataType<String> REGPROC = new PostgresDataType<String>(SQLDataType.VARCHAR, "regproc");
|
||||
public static final PostgresDataType<Long> OID = new PostgresDataType<Long>(SQLDataType.BIGINT, "oid");
|
||||
public static final PostgresDataType<Long> OIDVECTOR = new PostgresDataType<Long>(SQLDataType.BIGINT, "oidvector");
|
||||
public static final PostgresDataType<Long> XID = new PostgresDataType<Long>(SQLDataType.BIGINT, "xid");
|
||||
public static final PostgresDataType<Long> TID = new PostgresDataType<Long>(SQLDataType.BIGINT, "tid");
|
||||
public static final PostgresDataType<Long> CID = new PostgresDataType<Long>(SQLDataType.BIGINT, "cid");
|
||||
public static final PostgresDataType<String> ACLITEM = new PostgresDataType<String>(SQLDataType.VARCHAR, "aclitem");
|
||||
public static final PostgresDataType<String> NAME = new PostgresDataType<String>(SQLDataType.VARCHAR, "name");
|
||||
public static final PostgresDataType<String> REGPROC = new PostgresDataType<String>(SQLDataType.VARCHAR, "regproc");
|
||||
|
||||
|
||||
private PostgresDataType(SQLDataType<T> sqlDataType, String typeName) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user