|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.reltype.RelDataTypeImpl org.eigenbase.sql.type.AbstractSqlType org.eigenbase.sql.type.BasicSqlType
public class BasicSqlType
BasicSqlType represents a standard atomic SQL type (excluding interval types).
Field Summary | |
---|---|
private SqlCollation |
collation
|
private int |
precision
|
static int |
PRECISION_NOT_SPECIFIED
|
private int |
scale
|
static int |
SCALE_NOT_SPECIFIED
|
private SerializableCharset |
wrappedCharset
|
Fields inherited from class org.eigenbase.sql.type.AbstractSqlType |
---|
isNullable, typeName |
Fields inherited from class org.eigenbase.reltype.RelDataTypeImpl |
---|
digest, fieldList, fields |
Constructor Summary | |
---|---|
BasicSqlType(SqlTypeName typeName)
Constructs a type with no parameters. |
|
BasicSqlType(SqlTypeName typeName,
int precision)
Constructs a type with precision/length but no scale. |
|
BasicSqlType(SqlTypeName typeName,
int precision,
int scale)
Constructs a type with precision/length and scale. |
Method Summary | |
---|---|
(package private) BasicSqlType |
createWithCharsetAndCollation(Charset charset,
SqlCollation collation)
Constructs a type with charset and collation |
(package private) BasicSqlType |
createWithNullability(boolean nullable)
Constructs a type with nullablity |
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. |
Methods inherited from class org.eigenbase.sql.type.AbstractSqlType |
---|
getFamily, getPrecedenceList, getSqlTypeName, isNullable |
Methods inherited from class org.eigenbase.reltype.RelDataTypeImpl |
---|
computeDigest, equals, getComparability, getComponentType, getField, getFieldCount, getFieldList, getFieldOrdinal, getFields, getFullTypeString, getIntervalQualifier, getSqlIdentifier, hashCode, isStruct, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SCALE_NOT_SPECIFIED
public static final int PRECISION_NOT_SPECIFIED
private int precision
private int scale
private SqlCollation collation
private SerializableCharset wrappedCharset
Constructor Detail |
---|
public BasicSqlType(SqlTypeName typeName)
typeName
- Type namepublic BasicSqlType(SqlTypeName typeName, int precision)
typeName
- Type namepublic BasicSqlType(SqlTypeName typeName, int precision, int scale)
typeName
- Type nameMethod Detail |
---|
BasicSqlType createWithNullability(boolean nullable)
BasicSqlType createWithCharsetAndCollation(Charset charset, SqlCollation collation)
public int getPrecision()
RelDataType
getPrecision
in interface RelDataType
getPrecision
in class RelDataTypeImpl
public int getScale()
RelDataType
getScale
in interface RelDataType
getScale
in class RelDataTypeImpl
public Charset getCharset() throws RuntimeException
RelDataType
getCharset
in interface RelDataType
getCharset
in class RelDataTypeImpl
RuntimeException
public SqlCollation getCollation() throws RuntimeException
RelDataType
getCollation
in interface RelDataType
getCollation
in class RelDataTypeImpl
RuntimeException
protected void generateTypeString(StringBuilder sb, boolean withDetail)
RelDataTypeImpl
generateTypeString
in class RelDataTypeImpl
sb
- 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 limit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |