Skip to content

Commit

Permalink
[jOOQ#5312] Add SQLDataType.VARCHAR(length) and other methods for con…
Browse files Browse the repository at this point in the history
…venience
  • Loading branch information
lukaseder committed Jul 4, 2016
1 parent acd1fd6 commit 33dc238
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions jOOQ/src/main/java/org/jooq/impl/SQLDataType.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,41 +108,97 @@ public final class SQLDataType {
*/
public static final DataType<String> VARCHAR = new DefaultDataType<String>(null, String.class, "varchar");

/**
* The {@link Types#VARCHAR} type.
*/
public static final DataType<String> VARCHAR(int length) {
return VARCHAR.length(length);
}

/**
* The {@link Types#CHAR} type.
*/
public static final DataType<String> CHAR = new DefaultDataType<String>(null, String.class, "char");

/**
* The {@link Types#CHAR} type.
*/
public static final DataType<String> CHAR(int length) {
return CHAR.length(length);
}

/**
* The {@link Types#LONGVARCHAR} type.
*/
public static final DataType<String> LONGVARCHAR = new DefaultDataType<String>(null, String.class, "longvarchar");

/**
* The {@link Types#LONGVARCHAR} type.
*/
public static final DataType<String> LONGVARCHAR(int length) {
return LONGVARCHAR.length(length);
}

/**
* The {@link Types#CLOB} type.
*/
public static final DataType<String> CLOB = new DefaultDataType<String>(null, String.class, "clob");

/**
* The {@link Types#CLOB} type.
*/
public static final DataType<String> CLOB(int length) {
return CLOB.length(length);
}

/**
* The {@link Types#NVARCHAR} type.
*/
public static final DataType<String> NVARCHAR = new DefaultDataType<String>(null, String.class, "nvarchar");

/**
* The {@link Types#NVARCHAR} type.
*/
public static final DataType<String> NVARCHAR(int length) {
return NVARCHAR.length(length);
}

/**
* The {@link Types#NCHAR} type.
*/
public static final DataType<String> NCHAR = new DefaultDataType<String>(null, String.class, "nchar");

/**
* The {@link Types#NCHAR} type.
*/
public static final DataType<String> NCHAR(int length) {
return NCHAR.length(length);
}

/**
* The {@link Types#LONGNVARCHAR} type.
*/
public static final DataType<String> LONGNVARCHAR = new DefaultDataType<String>(null, String.class, "longnvarchar");

/**
* The {@link Types#LONGNVARCHAR} type.
*/
public static final DataType<String> LONGNVARCHAR(int length) {
return LONGNVARCHAR.length(length);
}

/**
* The {@link Types#NCLOB} type.
*/
public static final DataType<String> NCLOB = new DefaultDataType<String>(null, String.class, "nclob");

/**
* The {@link Types#NCLOB} type.
*/
public static final DataType<String> NCLOB(int length) {
return NCLOB.length(length);
}

// -------------------------------------------------------------------------
// Boolean types
// -------------------------------------------------------------------------
Expand Down Expand Up @@ -238,11 +294,39 @@ public final class SQLDataType {
*/
public static final DataType<BigDecimal> NUMERIC = new DefaultDataType<BigDecimal>(null, BigDecimal.class, "numeric");

/**
* The {@link Types#NUMERIC} type.
*/
public static final DataType<BigDecimal> NUMERIC(int precision) {
return NUMERIC.precision(precision);
}

/**
* The {@link Types#NUMERIC} type.
*/
public static final DataType<BigDecimal> NUMERIC(int precision, int scale) {
return NUMERIC.precision(precision, scale);
}

/**
* The {@link Types#DECIMAL} type.
*/
public static final DataType<BigDecimal> DECIMAL = new DefaultDataType<BigDecimal>(null, BigDecimal.class, "decimal");

/**
* The {@link Types#DECIMAL} type.
*/
public static final DataType<BigDecimal> DECIMAL(int precision) {
return DECIMAL.precision(precision);
}

/**
* The {@link Types#DECIMAL} type.
*/
public static final DataType<BigDecimal> DECIMAL(int precision, int scale) {
return DECIMAL.precision(precision, scale);
}

// -------------------------------------------------------------------------
// Datetime types
// -------------------------------------------------------------------------
Expand Down Expand Up @@ -326,21 +410,49 @@ public final class SQLDataType {
*/
public static final DataType<byte[]> BINARY = new DefaultDataType<byte[]>(null, byte[].class, "binary");

/**
* The {@link Types#BINARY} type.
*/
public static final DataType<byte[]> BINARY(int length) {
return BINARY.length(length);
}

/**
* The {@link Types#VARBINARY} type.
*/
public static final DataType<byte[]> VARBINARY = new DefaultDataType<byte[]>(null, byte[].class, "varbinary");

/**
* The {@link Types#VARBINARY} type.
*/
public static final DataType<byte[]> VARBINARY(int length) {
return VARBINARY.length(length);
}

/**
* The {@link Types#LONGVARBINARY} type.
*/
public static final DataType<byte[]> LONGVARBINARY = new DefaultDataType<byte[]>(null, byte[].class, "longvarbinary");

/**
* The {@link Types#LONGVARBINARY} type.
*/
public static final DataType<byte[]> LONGVARBINARY(int length) {
return LONGVARBINARY.length(length);
}

/**
* The {@link Types#BLOB} type.
*/
public static final DataType<byte[]> BLOB = new DefaultDataType<byte[]>(null, byte[].class, "blob");

/**
* The {@link Types#BLOB} type.
*/
public static final DataType<byte[]> BLOB(int length) {
return BLOB.length(length);
}

// -------------------------------------------------------------------------
// Other types
// -------------------------------------------------------------------------
Expand Down

0 comments on commit 33dc238

Please sign in to comment.