public class BasicSqlType extends AbstractSqlType
isNullable, typeNamedigest, fieldListPRECISION_NOT_SPECIFIED, SCALE_NOT_SPECIFIED| Constructor and Description |
|---|
BasicSqlType(RelDataTypeSystem typeSystem,
SqlTypeName typeName)
Constructs a type with no parameters.
|
BasicSqlType(RelDataTypeSystem typeSystem,
SqlTypeName typeName,
int precision)
Constructs a type with precision/length but no scale.
|
BasicSqlType(RelDataTypeSystem typeSystem,
SqlTypeName typeName,
int precision,
int scale)
Constructs a type with precision/length and scale.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
generateTypeString(StringBuilder sb,
boolean withDetail)
Generates a string representation of this type.
|
Charset |
getCharset()
Gets this type's character set, or null if this type cannot carry a
character set or has no character set defined.
|
SqlCollation |
getCollation()
Gets this type's collation, or null if this type cannot carry a collation
or has no collation defined.
|
Object |
getLimit(boolean sign,
SqlTypeName.Limit limit,
boolean beyond)
Returns a value which is a limit for this type.
|
int |
getPrecision()
Gets the JDBC-defined precision for values of this type.
|
int |
getScale()
Gets the scale of this type.
|
getFamily, getPrecedenceList, getSqlTypeName, isNullablecomputeDigest, equals, extra, getComparability, getComponentType, getField, getFieldCount, getFieldList, getFieldNames, getFullTypeString, getIntervalQualifier, getKeyType, getSqlIdentifier, getValueType, hashCode, isStruct, proto, proto, proto, proto, toStringpublic BasicSqlType(RelDataTypeSystem typeSystem, SqlTypeName typeName)
typeName - Type namepublic BasicSqlType(RelDataTypeSystem typeSystem, SqlTypeName typeName, int precision)
typeName - Type namepublic BasicSqlType(RelDataTypeSystem typeSystem, SqlTypeName typeName, int precision, int scale)
typeName - Type namepublic int getPrecision()
RelDataTypeReturns RelDataType.PRECISION_NOT_SPECIFIED (-1) if precision is not
applicable for this type.
getPrecision in interface RelDataTypegetPrecision in class RelDataTypeImplpublic int getScale()
RelDataTypeRelDataType.SCALE_NOT_SPECIFIED (-1) if
scale is not valid for this type.getScale in interface RelDataTypegetScale in class RelDataTypeImplpublic Charset getCharset()
RelDataTypegetCharset in interface RelDataTypegetCharset in class RelDataTypeImplpublic SqlCollation getCollation()
RelDataTypegetCollation in interface RelDataTypegetCollation in class RelDataTypeImplprotected void generateTypeString(StringBuilder sb, boolean withDetail)
RelDataTypeImplgenerateTypeString in class RelDataTypeImplsb - StringBuffer into which to generate the stringwithDetail - when true, all detail information needed to compute a
unique digest (and return from getFullTypeString) should
be included;public Object getLimit(boolean sign, SqlTypeName.Limit limit, boolean beyond)
For example,
| 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 limitCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.