public enum SqlTypeName extends Enum<SqlTypeName>
Types
does not include all SQL2003 data-types;
Modifier and Type | Class and Description |
---|---|
static class |
SqlTypeName.Limit
Limit.
|
Modifier and Type | Field and Description |
---|---|
static List<SqlTypeName> |
ALL_TYPES |
static List<SqlTypeName> |
APPROX_TYPES |
static List<SqlTypeName> |
BINARY_TYPES |
static List<SqlTypeName> |
BOOLEAN_TYPES |
static List<SqlTypeName> |
CHAR_TYPES |
static List<SqlTypeName> |
DATETIME_TYPES |
static Set<SqlTypeName> |
DAY_INTERVAL_TYPES |
static int |
DEFAULT_INTERVAL_FRACTIONAL_SECOND_PRECISION |
static int |
DEFAULT_INTERVAL_START_PRECISION |
static List<SqlTypeName> |
EXACT_TYPES |
static List<SqlTypeName> |
FRACTIONAL_TYPES |
static List<SqlTypeName> |
INT_TYPES |
static Set<SqlTypeName> |
INTERVAL_TYPES |
static int |
MAX_DATETIME_PRECISION |
static int |
MAX_INTERVAL_FRACTIONAL_SECOND_PRECISION |
static int |
MAX_INTERVAL_START_PRECISION |
static int |
MIN_INTERVAL_FRACTIONAL_SECOND_PRECISION |
static int |
MIN_INTERVAL_START_PRECISION |
static List<SqlTypeName> |
NUMERIC_TYPES |
static List<SqlTypeName> |
STRING_TYPES |
static Set<SqlTypeName> |
YEAR_INTERVAL_TYPES |
Modifier and Type | Method and Description |
---|---|
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() |
SqlLiteral |
createLiteral(Object o,
SqlParserPos pos) |
static SqlTypeName |
get(String name)
Looks up a type name from its name.
|
int |
getDefaultScale() |
org.apache.calcite.avatica.util.TimeUnit |
getEndUnit()
Returns
SECOND for both HOUR TO SECOND and
SECOND . |
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 |
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.
|
org.apache.calcite.avatica.util.TimeUnit |
getStartUnit()
Returns
HOUR for HOUR TO SECOND and
HOUR , SECOND for SECOND . |
boolean |
isSpecial() |
boolean |
isYearMonth() |
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 are declared.
|
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 TIME_WITH_LOCAL_TIME_ZONE
public static final SqlTypeName TIMESTAMP
public static final SqlTypeName TIMESTAMP_WITH_LOCAL_TIME_ZONE
public static final SqlTypeName INTERVAL_YEAR
public static final SqlTypeName INTERVAL_YEAR_MONTH
public static final SqlTypeName INTERVAL_MONTH
public static final SqlTypeName INTERVAL_DAY
public static final SqlTypeName INTERVAL_DAY_HOUR
public static final SqlTypeName INTERVAL_DAY_MINUTE
public static final SqlTypeName INTERVAL_DAY_SECOND
public static final SqlTypeName INTERVAL_HOUR
public static final SqlTypeName INTERVAL_HOUR_MINUTE
public static final SqlTypeName INTERVAL_HOUR_SECOND
public static final SqlTypeName INTERVAL_MINUTE
public static final SqlTypeName INTERVAL_MINUTE_SECOND
public static final SqlTypeName INTERVAL_SECOND
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 ARRAY
public static final SqlTypeName MAP
public static final SqlTypeName DISTINCT
public static final SqlTypeName STRUCTURED
public static final SqlTypeName ROW
public static final SqlTypeName OTHER
public static final SqlTypeName CURSOR
public static final SqlTypeName COLUMN_LIST
public static final SqlTypeName DYNAMIC_STAR
public static final SqlTypeName GEOMETRY
public static final int MAX_DATETIME_PRECISION
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
public static final List<SqlTypeName> ALL_TYPES
public static final List<SqlTypeName> BOOLEAN_TYPES
public static final List<SqlTypeName> BINARY_TYPES
public static final List<SqlTypeName> INT_TYPES
public static final List<SqlTypeName> EXACT_TYPES
public static final List<SqlTypeName> APPROX_TYPES
public static final List<SqlTypeName> NUMERIC_TYPES
public static final List<SqlTypeName> FRACTIONAL_TYPES
public static final List<SqlTypeName> CHAR_TYPES
public static final List<SqlTypeName> STRING_TYPES
public static final List<SqlTypeName> DATETIME_TYPES
public static final Set<SqlTypeName> YEAR_INTERVAL_TYPES
public static final Set<SqlTypeName> DAY_INTERVAL_TYPES
public static final Set<SqlTypeName> INTERVAL_TYPES
public static 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 nameNullPointerException
- if the argument is nullpublic 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 specificationpublic boolean isSpecial()
public int getJdbcOrdinal()
Types
corresponding to this
SqlTypeNamepublic int getDefaultScale()
public SqlTypeFamily getFamily()
public static SqlTypeName getNameForJdbcType(int jdbcType)
jdbcType
- the JDBC type of interestpublic 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 applicablepublic int getMinPrecision()
public int getMinScale()
public org.apache.calcite.avatica.util.TimeUnit getStartUnit()
HOUR
for HOUR TO SECOND
and
HOUR
, SECOND
for SECOND
.public org.apache.calcite.avatica.util.TimeUnit getEndUnit()
SECOND
for both HOUR TO SECOND
and
SECOND
.public boolean isYearMonth()
public SqlLiteral createLiteral(Object o, SqlParserPos pos)
public String getName()
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.