Package org.apache.arrow.adapter.jdbc
Class JdbcFieldInfo
java.lang.Object
org.apache.arrow.adapter.jdbc.JdbcFieldInfo
This class represents the information about a JDBC ResultSet Field that is needed to construct an
ArrowType
. Currently, this is:
- The JDBC
Types
type. - The nullability.
- The field's precision (used for
Types.DECIMAL
andTypes.NUMERIC
types). - The field's scale (used for
Types.DECIMAL
andTypes.NUMERIC
types).
-
Constructor Summary
ConstructorDescriptionJdbcFieldInfo
(int jdbcType) Builds aJdbcFieldInfo
using only theTypes
type.JdbcFieldInfo
(int jdbcType, int precision, int scale) Builds aJdbcFieldInfo
from theTypes
type, precision, and scale.JdbcFieldInfo
(int jdbcType, int nullability, int precision, int scale) Builds aJdbcFieldInfo
from theTypes
type, nullability, precision, and scale.Builds aJdbcFieldInfo
from the corresponding row from aDatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
ResultSet.JdbcFieldInfo
(ResultSetMetaData rsmd, int column) Builds aJdbcFieldInfo
from the correspondingResultSetMetaData
column. -
Method Summary
Modifier and TypeMethodDescriptionint
The column index for query column.int
The max number of characters for the column.int
TheTypes
type.int
The numeric precision, forTypes.NUMERIC
andTypes.DECIMAL
types.int
getScale()
The numeric scale, forTypes.NUMERIC
andTypes.DECIMAL
types.The type name as reported by the database.int
The nullability.
-
Constructor Details
-
JdbcFieldInfo
public JdbcFieldInfo(int jdbcType) Builds aJdbcFieldInfo
using only theTypes
type. Do not use this constructor if the field type isTypes.DECIMAL
orTypes.NUMERIC
; the precision and scale will be set to0
.- Parameters:
jdbcType
- TheTypes
type.- Throws:
IllegalArgumentException
- if jdbcType isTypes.DECIMAL
orTypes.NUMERIC
.
-
JdbcFieldInfo
public JdbcFieldInfo(int jdbcType, int precision, int scale) Builds aJdbcFieldInfo
from theTypes
type, precision, and scale. Use this constructor forTypes.DECIMAL
andTypes.NUMERIC
types.- Parameters:
jdbcType
- TheTypes
type.precision
- The field's numeric precision.scale
- The field's numeric scale.
-
JdbcFieldInfo
public JdbcFieldInfo(int jdbcType, int nullability, int precision, int scale) Builds aJdbcFieldInfo
from theTypes
type, nullability, precision, and scale.- Parameters:
jdbcType
- TheTypes
type.nullability
- The nullability. Must be one ofResultSetMetaData.columnNoNulls
,ResultSetMetaData.columnNullable
, orResultSetMetaData.columnNullableUnknown
.precision
- The field's numeric precision.scale
- The field's numeric scale.
-
JdbcFieldInfo
Builds aJdbcFieldInfo
from the correspondingResultSetMetaData
column.- Parameters:
rsmd
- TheResultSetMetaData
to get the field information from.column
- The column to get the field information for (on a 1-based index).- Throws:
SQLException
- If the column information cannot be retrieved.NullPointerException
- ifrsmd
isnull
.IllegalArgumentException
- ifcolumn
is out of bounds.
-
JdbcFieldInfo
Builds aJdbcFieldInfo
from the corresponding row from aDatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
ResultSet.- Parameters:
rs
- TheResultSet
to get the field information from.- Throws:
SQLException
- If the column information cannot be retrieved.
-
-
Method Details
-
getJdbcType
public int getJdbcType()TheTypes
type. -
isNullable
public int isNullable()The nullability. -
getPrecision
public int getPrecision()The numeric precision, forTypes.NUMERIC
andTypes.DECIMAL
types. -
getScale
public int getScale()The numeric scale, forTypes.NUMERIC
andTypes.DECIMAL
types. -
getColumn
public int getColumn()The column index for query column. -
getTypeName
The type name as reported by the database. -
getDisplaySize
public int getDisplaySize()The max number of characters for the column.
-