Package com.exasol.adapter.metadata
Class DataType
- java.lang.Object
-
- com.exasol.adapter.metadata.DataType
-
public class DataType extends Object
Represents an EXASOL data type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataType.ExaCharsetstatic classDataType.ExaDataTypestatic classDataType.IntervalType
-
Field Summary
Fields Modifier and Type Field Description static intMAX_EXASOL_CHAR_SIZEstatic intMAX_EXASOL_DECIMAL_PRECISIONstatic intMAX_EXASOL_VARCHAR_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataTypecreateBool()Create aBOOLdata typestatic DataTypecreateChar(int size, DataType.ExaCharset charset)Create aCHARdata type with a given size and character setstatic DataTypecreateDate()Create aDATEdata typestatic DataTypecreateDecimal(int precision, int scale)Create aDECIMAL(i.e.static DataTypecreateDouble()Create aDOUBLE(i.e.static DataTypecreateGeometry(int srid)Create aGEOMETRYdata typestatic DataTypecreateHashtype(int byteSize)Create aHASHTYPEdata typestatic DataTypecreateIntervalDaySecond(int precision, int fraction)Create anINTERVAL DAY TO SECONDdata typestatic DataTypecreateIntervalYearMonth(int precision)Create anINTERVAL YEAR TO MONTHdata typestatic DataTypecreateMaximumSizeChar(DataType.ExaCharset charset)Create aCHARdata type with the maximum size supported by Exasolstatic DataTypecreateMaximumSizeVarChar(DataType.ExaCharset charset)Create aVARCHARdata type with the maximum size supported by Exasolstatic DataTypecreateTimestamp(boolean withLocalTimezone)Create aTIMESTAMPdata typestatic DataTypecreateUnsupported()Create anUNSUPPORTEDdata typestatic DataTypecreateVarChar(int size, DataType.ExaCharset charset)Create aVARCHARdata type with a given size and character setbooleanequals(Object o)intgetByteSize()Get the size in bytes.DataType.ExaCharsetgetCharset()Get the character setDataType.ExaDataTypegetExaDataType()Get the Exasol data type without parametersintgetGeometrySrid()Get the Spatial Reference System Identifier (SRID) that was used to encode the geometryintgetIntervalFraction()Get the interval fractionDataType.IntervalTypegetIntervalType()Get the interval typeintgetPrecision()Get the precisionintgetScale()Get the scaleintgetSize()Get the sizeinthashCode()booleanisSupported()Check if the data type is supported.booleanisWithLocalTimezone()Check whether the timestamp uses the local time zoneStringtoString()
-
-
-
Field Detail
-
MAX_EXASOL_CHAR_SIZE
public static final int MAX_EXASOL_CHAR_SIZE
- See Also:
- Constant Field Values
-
MAX_EXASOL_VARCHAR_SIZE
public static final int MAX_EXASOL_VARCHAR_SIZE
- See Also:
- Constant Field Values
-
MAX_EXASOL_DECIMAL_PRECISION
public static final int MAX_EXASOL_DECIMAL_PRECISION
- See Also:
- Constant Field Values
-
-
Method Detail
-
createVarChar
public static DataType createVarChar(int size, DataType.ExaCharset charset)
Create aVARCHARdata type with a given size and character set- Parameters:
size- size of the data type in characterscharset- character set to be used when creating the data type- Returns:
VARCHARtype
-
createMaximumSizeVarChar
public static DataType createMaximumSizeVarChar(DataType.ExaCharset charset)
Create aVARCHARdata type with the maximum size supported by Exasol- Parameters:
charset- character set to be used when creating the data type- Returns:
VARCHARtype
-
createChar
public static DataType createChar(int size, DataType.ExaCharset charset)
Create aCHARdata type with a given size and character set- Parameters:
size- size of the data type in characterscharset- character set to be used when creating the data type- Returns:
CHARtype
-
createMaximumSizeChar
public static DataType createMaximumSizeChar(DataType.ExaCharset charset)
Create aCHARdata type with the maximum size supported by Exasol- Parameters:
charset- character set to be used when creating the data type- Returns:
CHARtype
-
createDecimal
public static DataType createDecimal(int precision, int scale)
Create aDECIMAL(i.e. fixed point value) data type- Parameters:
precision- total number of places before and after the point that an instance of this type can holdscale- number of decimal places behind the point- Returns:
DECIMALdata type
-
createDouble
public static DataType createDouble()
Create aDOUBLE(i.e. double-precision floating point value) data type- Returns:
DOUBLEdata type
-
createDate
public static DataType createDate()
Create aDATEdata type- Returns:
DATEdata type
-
createUnsupported
public static DataType createUnsupported()
Create anUNSUPPORTEDdata type- Returns:
UNSUPPORTEDdata type
-
createTimestamp
public static DataType createTimestamp(boolean withLocalTimezone)
Create aTIMESTAMPdata type- Parameters:
withLocalTimezone- defines whether the timestamp is local time (true) or UTC(false)- Returns:
TIMESTAMPdata type
-
createBool
public static DataType createBool()
Create aBOOLdata type- Returns:
BOOLdata type
-
createGeometry
public static DataType createGeometry(int srid)
Create aGEOMETRYdata type- Parameters:
srid- Spatial Reference System Identifier- Returns:
GEOMETRYdata type- See Also:
- Spatial Reference System Identifier (Wikipedia)
-
createIntervalDaySecond
public static DataType createIntervalDaySecond(int precision, int fraction)
Create anINTERVAL DAY TO SECONDdata type- Parameters:
precision- number of days the interval can spanfraction- decimal places after the point- Returns:
INTERVAL DAY TO SECONDdata type- See Also:
- Interval data type (Exasol documentation)
-
createIntervalYearMonth
public static DataType createIntervalYearMonth(int precision)
Create anINTERVAL YEAR TO MONTHdata type- Parameters:
precision- number of years the interval can span- Returns:
INTERVAL YEAR TO MONTHdata type- See Also:
- Interval data type (Exasol documentation)
-
createHashtype
public static DataType createHashtype(int byteSize)
Create aHASHTYPEdata type- Parameters:
byteSize- size in bytes- Returns:
HASHTYPEdata type
-
getExaDataType
public DataType.ExaDataType getExaDataType()
Get the Exasol data type without parameters- Returns:
- Exasol data type
-
getPrecision
public int getPrecision()
Get the precision- Returns:
- precision
-
getScale
public int getScale()
Get the scale- Returns:
- scale
-
getSize
public int getSize()
Get the size- Returns:
- size
-
getCharset
public DataType.ExaCharset getCharset()
Get the character set- Returns:
- character set
-
isWithLocalTimezone
public boolean isWithLocalTimezone()
Check whether the timestamp uses the local time zone- Returns:
trueif the timestamp uses the local time zone
-
getGeometrySrid
public int getGeometrySrid()
Get the Spatial Reference System Identifier (SRID) that was used to encode the geometry- Returns:
- SRID
- See Also:
- Spatial Reference System Identifier (Wikipedia)
-
getIntervalType
public DataType.IntervalType getIntervalType()
Get the interval type- Returns:
- interval type
-
getIntervalFraction
public int getIntervalFraction()
Get the interval fraction- Returns:
- interval fraction
-
getByteSize
public int getByteSize()
Get the size in bytes.- Returns:
- byte size
-
isSupported
public boolean isSupported()
Check if the data type is supported.- Returns:
trueif the data type is supported by the Virtual Schema.
-
-