|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<SqlTypeName> org.eigenbase.sql.type.SqlTypeName
public enum SqlTypeName
Enumeration of the type names which can be used to construct a SQL type. Rationale for this class's existence (instead of just using the standard java.sql.Type ordinals):
Nested Class Summary | |
---|---|
static class |
SqlTypeName.Limit
|
private static interface |
SqlTypeName.PrecScale
Flags indicating precision/scale combinations. |
Method Summary | |
---|---|
boolean |
allowsNoPrecNoScale()
|
boolean |
allowsPrec()
|
boolean |
allowsPrecNoScale()
|
boolean |
allowsPrecScale(boolean precision,
boolean scale)
Returns whether this type can be specified with a given combination of precision and scale. |
boolean |
allowsScale()
|
private static SqlTypeName[] |
combine(SqlTypeName[] array0,
SqlTypeName[] array1)
|
SqlLiteral |
createLiteral(Object o,
SqlParserPos pos)
|
static SqlTypeName |
get(String name)
Looks up a type name from its name. |
int |
getDefaultPrecision()
|
int |
getDefaultScale()
|
SqlTypeFamily |
getFamily()
Gets the SqlTypeFamily containing this SqlTypeName. |
int |
getJdbcOrdinal()
|
Object |
getLimit(boolean sign,
SqlTypeName.Limit limit,
boolean beyond,
int precision,
int scale)
Returns the limit of this datatype. |
int |
getMaxPrecision()
Returns the maximum precision (or length) allowed for this type, or -1 if precision/length are not applicable for this type. |
int |
getMaxScale()
Returns the maximum scale (or fractional second precision in the case of intervals) allowed for this type, or -1 if precision/length are not applicable for this type. |
int |
getMinPrecision()
Returns the minimum precision (or length) allowed for this type, or -1 if precision/length are not applicable for this type. |
int |
getMinScale()
Returns the minimum scale (or fractional second precision in the case of intervals) allowed for this type, or -1 if precision/length are not applicable for this type. |
String |
getName()
|
static SqlTypeName |
getNameForJdbcType(int jdbcType)
Gets the SqlTypeName corresponding to a JDBC type. |
private BigDecimal |
getNumericLimit(int radix,
int exponent,
boolean sign,
SqlTypeName.Limit limit,
boolean beyond)
|
boolean |
isSpecial()
|
private static void |
setNameForJdbcType(int jdbcType,
SqlTypeName name)
|
static SqlTypeName |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static SqlTypeName[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final SqlTypeName BOOLEAN
public static final SqlTypeName TINYINT
public static final SqlTypeName SMALLINT
public static final SqlTypeName INTEGER
public static final SqlTypeName BIGINT
public static final SqlTypeName DECIMAL
public static final SqlTypeName FLOAT
public static final SqlTypeName REAL
public static final SqlTypeName DOUBLE
public static final SqlTypeName DATE
public static final SqlTypeName TIME
public static final SqlTypeName TIMESTAMP
public static final SqlTypeName INTERVAL_YEAR_MONTH
public static final SqlTypeName INTERVAL_DAY_TIME
public static final SqlTypeName CHAR
public static final SqlTypeName VARCHAR
public static final SqlTypeName BINARY
public static final SqlTypeName VARBINARY
public static final SqlTypeName NULL
public static final SqlTypeName ANY
public static final SqlTypeName SYMBOL
public static final SqlTypeName MULTISET
public static final SqlTypeName DISTINCT
public static final SqlTypeName STRUCTURED
public static final SqlTypeName ROW
public static final SqlTypeName CURSOR
public static final SqlTypeName COLUMN_LIST
Field Detail |
---|
public static final SqlTypeName[] EMPTY_ARRAY
private static SqlTypeName[] jdbcTypeToName
public static final int MIN_JDBC_TYPE
public static final int MAX_JDBC_TYPE
public static final int MAX_DATETIME_PRECISION
public static final int MAX_NUMERIC_PRECISION
public static final int MAX_NUMERIC_SCALE
public static final int MAX_CHAR_LENGTH
public static final int MAX_BINARY_LENGTH
public static final int DEFAULT_INTERVAL_START_PRECISION
public static final int DEFAULT_INTERVAL_FRACTIONAL_SECOND_PRECISION
public static final int MIN_INTERVAL_START_PRECISION
public static final int MIN_INTERVAL_FRACTIONAL_SECOND_PRECISION
public static final int MAX_INTERVAL_START_PRECISION
public static final int MAX_INTERVAL_FRACTIONAL_SECOND_PRECISION
private static final Map<String,SqlTypeName> VALUES_MAP
public static final SqlTypeName[] allTypes
public static final SqlTypeName[] booleanTypes
public static final SqlTypeName[] binaryTypes
public static final SqlTypeName[] intTypes
public static final SqlTypeName[] exactTypes
public static final SqlTypeName[] approxTypes
public static final SqlTypeName[] numericTypes
public static final SqlTypeName[] fractionalTypes
public static final SqlTypeName[] charTypes
public static final SqlTypeName[] stringTypes
public static final SqlTypeName[] datetimeTypes
public static final SqlTypeName[] timeIntervalTypes
public static final SqlTypeName[] multisetTypes
public static final SqlTypeName[] cursorTypes
public static final SqlTypeName[] columnListTypes
private final int signatures
private final boolean special
ANY
, NULL
and SYMBOL
private final int jdbcOrdinal
Method Detail |
---|
public static final SqlTypeName[] values()
for(SqlTypeName c : SqlTypeName.values()) System.out.println(c);
public static SqlTypeName valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified namepublic static SqlTypeName get(String name)
public boolean allowsNoPrecNoScale()
public boolean allowsPrecNoScale()
public boolean allowsPrec()
public boolean allowsScale()
public boolean allowsPrecScale(boolean precision, boolean scale)
Varchar.allowsPrecScale(true, false)
returns
true
, because the VARCHAR type allows a precision parameter, as in
VARCHAR(10)
.Varchar.allowsPrecScale(true, true)
returns
true
, because the VARCHAR type does not allow a precision and a
scale parameter, as in VARCHAR(10, 4)
.allowsPrecScale(false, true)
returns false
for every type.
precision
- Whether the precision/length field is part of the type
specificationscale
- Whether the scale field is part of the type specification
public boolean isSpecial()
public int getJdbcOrdinal()
Types
corresponding to this
SqlTypeNameprivate static SqlTypeName[] combine(SqlTypeName[] array0, SqlTypeName[] array1)
public int getDefaultPrecision()
public int getDefaultScale()
public SqlTypeFamily getFamily()
public static SqlTypeName getNameForJdbcType(int jdbcType)
jdbcType
- the JDBC type of interest
private static void setNameForJdbcType(int jdbcType, SqlTypeName name)
public Object getLimit(boolean sign, SqlTypeName.Limit limit, boolean beyond, int precision, int scale)
Datatype | sign | limit | beyond | precision | scale | Returns |
---|---|---|---|---|---|---|
Integer | true | true | false | -1 | -1 | 2147483647 (2 ^ 31 -1 = MAXINT) |
Integer | true | true | true | -1 | -1 | 2147483648 (2 ^ 31 = MAXINT + 1) |
Integer | false | true | false | -1 | -1 | -2147483648 (-2 ^ 31 = MININT) |
Boolean | true | true | false | -1 | -1 | TRUE |
Varchar | true | true | false | 10 | -1 | 'ZZZZZZZZZZ' |
sign
- If true, returns upper limit, otherwise lower limitlimit
- If true, returns value at or near to overflow; otherwise
value at or near to underflowbeyond
- If true, returns the value just beyond the limit, otherwise
the value at the limitprecision
- Precision, or -1 if not applicablescale
- Scale, or -1 if not applicable
public int getMaxPrecision()
public int getMaxScale()
public int getMinPrecision()
public int getMinScale()
private BigDecimal getNumericLimit(int radix, int exponent, boolean sign, SqlTypeName.Limit limit, boolean beyond)
public SqlLiteral createLiteral(Object o, SqlParserPos pos)
public String getName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |