Package org.apache.calcite.avatica
Enum SqlType
- All Implemented Interfaces:
Serializable,Comparable<SqlType>,java.lang.constant.Constable
Extends the information in
Types.
The information in the following conversions tables (from the JDBC 4.1 specification) is held in members of this class.
Table B-1: JDBC Types Mapped to Java Types
JDBC Type Java Type ============= ========================= CHAR String VARCHAR String LONGVARCHAR String NUMERIC java.math.BigDecimal DECIMAL java.math.BigDecimal BIT boolean BOOLEAN boolean TINYINT byte SMALLINT short INTEGER int BIGINT long REAL float FLOAT double DOUBLE double BINARY byte[] VARBINARY byte[] LONGVARBINARY byte[] DATE java.sql.Date TIME java.sql.Time TIMESTAMP java.sql.Timestamp CLOB java.sql.Clob BLOB java.sql.Blob ARRAY java.sql.Array DISTINCT mapping of underlying type STRUCT java.sql.Struct REF java.sql.Ref DATALINK java.net.URL JAVA_OBJECT underlying Java class ROWID java.sql.RowId NCHAR String NVARCHAR String LONGNVARCHAR String NCLOB java.sql.NClob SQLXML java.sql.SQLXML
Table B-2: Standard Mapping from Java Types to JDBC Types
Java Type JDBC Type
==================== ==============================================
String CHAR, VARCHAR, LONGVARCHAR, NCHAR, NVARCHAR or
LONGNVARCHAR
java.math.BigDecimal NUMERIC
boolean BIT or BOOLEAN
byte TINYINT
short SMALLINT
int INTEGER
long BIGINT
float REAL
double DOUBLE
byte[] BINARY, VARBINARY, or LONGVARBINARY
java.sql.Date DATE
java.sql.Time TIME
java.sql.Timestamp TIMESTAMP
java.sql.Clob CLOB
java.sql.Blob BLOB
java.sql.Array ARRAY
java.sql.Struct STRUCT
java.sql.Ref REF
java.net.URL DATALINK
Java class JAVA_OBJECT
java.sql.RowId ROWID
java.sql.NClob NCLOB
java.sql.SQLXML SQLXML
TABLE B-3: Mapping from JDBC Types to Java Object Types
JDBC Type Java Object Type ============= ====================== CHAR String VARCHAR String LONGVARCHAR String NUMERIC java.math.BigDecimal DECIMAL java.math.BigDecimal BIT Boolean BOOLEAN Boolean TINYINT Integer SMALLINT Integer INTEGER Integer BIGINT Long REAL Float FLOAT Double DOUBLE Double BINARY byte[] VARBINARY byte[] LONGVARBINARY byte[] DATE java.sql.Date TIME java.sql.Time TIMESTAMP java.sql.Timestamp DISTINCT Object type of underlying type CLOB java.sql.Clob BLOB java.sql.Blob ARRAY java.sql.Array STRUCT java.sql.Struct or java.sql.SQLData REF java.sql.Ref DATALINK java.net.URL JAVA_OBJECT underlying Java class ROWID java.sql.RowId NCHAR String NVARCHAR String LONGNVARCHAR String NCLOB java.sql.NClob SQLXML java.sql.SQLXML
TABLE B-4: Mapping from Java Object Types to JDBC Types
Java Object Type JDBC Type
==================== ===========================================
String CHAR, VARCHAR, LONGVARCHAR, NCHAR, NVARCHAR
or LONGNVARCHAR
java.math.BigDecimal NUMERIC
Boolean BIT or BOOLEAN
Byte TINYINT
Short SMALLINT
Integer INTEGER
Long BIGINT
Float REAL
Double DOUBLE
byte[] BINARY, VARBINARY, or LONGVARBINARY
java.math.BigInteger BIGINT
java.sql.Date DATE
java.sql.Time TIME
java.sql.Timestamp TIMESTAMP
java.sql.Clob CLOB
java.sql.Blob BLOB
java.sql.Array ARRAY
java.sql.Struct STRUCT
java.sql.Ref REF
java.net.URL DATALINK
Java class JAVA_OBJECT
java.sql.RowId ROWID
java.sql.NClob NCLOB
java.sql.SQLXML SQLXML
java.util.Calendar TIMESTAMP
java.util.Date TIMESTAMP
TABLE B-5: Conversions performed by setObject and
setNull between Java object types and target JDBC types
T S I B R F D D N B B C V L B V L D T T A B C S R D J R N N L N S
I M N I E L O E U I O H A O I A O A I I R L L T E A A O C V O C Q
N A T G A O U C M T O A R N N R N T M M R O O R F T V W H A N L L
Y L E I L A B I E L R C G A B G E E E A B B U A A I A R G O X
I L G N T L M R E H V R I V E S Y C L _ D R C N B M
N I E T E A I A A A Y N A T T I O H V L
T N R L C N R R A R A N B A A
T C R B M K J R R
H Y I P C
Java type
==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
String x x x x x x x x x x x x x x x x x x x x . . . . . . . . x x x . .
java.math.BigDecimal x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Boolean x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Byte x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Short x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Integer x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Long x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Float x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
Double x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
byte[] . . . . . . . . . . . . . . x x x . . . . . . . . . . . . . . . .
java.math.BigInteger . . . x . . . . . . . x x x . . . . . . . . . . . . . . . . . . .
java.sql.Date . . . . . . . . . . . x x x . . . x . x . . . . . . . . . . . . .
java.sql.Time . . . . . . . . . . . x x x . . . . x x . . . . . . . . . . . . .
java.sql.Timestamp . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
java.sql.Array . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . . .
java.sql.Blob . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . .
java.sql.Clob . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . .
java.sql.Struct . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . .
java.sql.Ref . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . .
java.net.URL . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . .
Java class . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . .
java.sql.Rowid . . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . .
java.sql.NClob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x .
java.sql.SQLXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
java.util.Calendar . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
java.util.Date . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
TABLE B-6: Use of ResultSet getter methods to
retrieve JDBC data types
T S I B R F D D N B B C V L B V L D T T C B A R D S J R N N L N S
I M N I E L O E U I O H A O I A O A I I L L R E A T A O C V O C Q
N A T G A O U C M T O A R N N R N T M M O O R F T R V W H A N L L
Y L E I L A B I E L R C G A B G E E E B B A A U A I A R G O X
I L G N T L M R E H V R I V E S Y L C _ D R C N B M
N I E T E A I A A A Y N A T I T O H V L
T N R L C N R R A R A N B A A
T C R B M K J R R
H Y I P C
Java type
==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
getByte X x x x x x x x x x x x x . . . . . . . . . . . . . . x . . . . .
getShort x X x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
getInt x x X x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
getLong x x x X x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
getFloat x x x x X x x x x x x x x . . . . . . . . . . . . . . . . . . . .
getDouble x x x x x X X x x x x x x . . . . . . . . . . . . . . . . . . . .
getBigDecimal x x x x x x x X X x x x x . . . . . . . . . . . . . . . . . . . .
getBoolean x x x x x x x x x X x x x . . . . . . . . . . . . . . . . . . . .
getString x x x x x x x x x x x X X x x x x x x x . . . . x . . . x x x . .
getNString x x x x x x x x x x x x x x x x x x x x . . . . x . . . X X x . .
getBytes . . . . . . . . . . . . . . X X x . . . . . . . . . . . . . . . .
getDate . . . . . . . . . . . x x x . . . X . x . . . . . . . . . . . . .
getTime . . . . . . . . . . . x x x . . . . X x . . . . . . . . . . . . .
getTimestamp . . . . . . . . . . . x x x . . . x x X . . . . . . . . . . . x .
getAsciiStream . . . . . . . . . . . x x X x x x . . . x . . . . . . . . . . . x
getBinaryStream . . . . . . . . . . . . . . x x X . . . . x . . . . . . . . . x x
getCharacterStream . . . . . . . . . . . x x X x x x . . . x . . . . . . . x x x x x
getNCharacterStream . . . . . . . . . . . x x x x x x . . . x . . . . . . . x x X x x
getClob . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . . x .
getNClob . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . X .
getBlob . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . . .
getArray . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . .
getRef . . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . .
getURL . . . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . .
getObject x x x x x x x x x x x x x x x x x x x x x x x x x X X x x x x x x
getRowId . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . . . .
getSQLXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ClassDefault Java type for this SQL type, as described in table B-1.static final Map<SqlType.Method,EnumSet<SqlType>> final intType id as appears inTypes, e.g.final ClassClass used internally in Calcite to represent instances of this type.final ClassClass used to serialize values of this type as JSON. -
Method Summary
Modifier and TypeMethodDescriptionReturns the boxed type.static booleancanGet(SqlType.Method method, SqlType sqlType) Returns whetherResultSet.getInt(int)and similar methods can convert a value to a particular SQL type.static booleanReturns whetherPreparedStatement.setObject(int, java.lang.Object, int)andPreparedStatement.setNull(int, int)can assign a value of a particular class to a column of a particular SQL type.Returns the entries in JDBC table B-5.static SqlTypevalueOf(int type) Returns the enum constant of this type with the specified name.static SqlTypeReturns the enum constant of this type with the specified name.static SqlType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BIT
-
BOOLEAN
-
TINYINT
-
SMALLINT
-
INTEGER
-
BIGINT
-
NUMERIC
-
DECIMAL
-
FLOAT
-
REAL
-
DOUBLE
-
DATE
-
TIME
-
TIMESTAMP
-
INTERVAL_YEAR_MONTH
-
INTERVAL_DAY_TIME
-
CHAR
-
VARCHAR
-
LONGVARCHAR
-
BINARY
-
VARBINARY
-
LONGVARBINARY
-
NULL
-
ANY
-
SYMBOL
-
MULTISET
-
ARRAY
-
BLOB
-
CLOB
-
SQLXML
-
MAP
-
DISTINCT
-
STRUCT
-
REF
-
DATALINK
-
JAVA_OBJECT
-
ROWID
-
NCHAR
-
NVARCHAR
-
LONGNVARCHAR
-
NCLOB
-
ROW
-
OTHER
-
CURSOR
-
TIME_WITH_TIMEZONE
-
TIMESTAMP_WITH_TIMEZONE
-
COLUMN_LIST
-
-
Field Details
-
id
public final int idType id as appears inTypes, e.g.Types.INTEGER. -
clazz
Default Java type for this SQL type, as described in table B-1. -
internal
Class used internally in Calcite to represent instances of this type. -
serial
Class used to serialize values of this type as JSON. -
SET_LIST
-
GET_LIST
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
type- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
boxedClass
Returns the boxed type. -
getSetConversions
Returns the entries in JDBC table B-5. -
canSet
Returns whetherPreparedStatement.setObject(int, java.lang.Object, int)andPreparedStatement.setNull(int, int)can assign a value of a particular class to a column of a particular SQL type.The JDBC standard describes the mapping in table B-5.
-
canGet
Returns whetherResultSet.getInt(int)and similar methods can convert a value to a particular SQL type.The JDBC standard describes the mapping in table B-6.
-