Package org.firebirdsql.jdbc.metadata
Class TypeMetadata
- java.lang.Object
-
- org.firebirdsql.jdbc.metadata.TypeMetadata
-
public class TypeMetadata extends java.lang.ObjectHelper class to determine type metadata conforming to expectations ofDatabaseMetaData.- Since:
- 4.0
- Author:
- Mark Rotteveel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTypeMetadata.Builderstatic classTypeMetadata.TypeBehaviour
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TypeMetadata.Builderbuilder(FirebirdSupportInfo supportInfo)Creates type metadata builder.java.lang.IntegergetCharOctetLength()java.lang.IntegergetColumnSize()Returns the column size (precision) of the type.static intgetDataType(int sqlType, int sqlSubType, int sqlScale, int characterSetId)Derives the JDBC data type fromTypesorJaybirdTypeCodesfrom metadata information.static java.lang.StringgetDataTypeName(int sqlType, int sqlSubType, int sqlScale)Derives the JDBC/SQL type name from metadata information.intgetJdbcType()java.lang.IntegergetLength()intgetRadix()java.lang.IntegergetScale()Returns the scale of the field.java.lang.StringgetSqlTypeName()
-
-
-
Method Detail
-
getJdbcType
public int getJdbcType()
- Returns:
- The
TypesorJaybirdTypeCodescode for this datatype
-
getSqlTypeName
public java.lang.String getSqlTypeName()
- Returns:
- The SQL datatype name, returns
"NULL"if the type is unknown
-
getColumnSize
public java.lang.Integer getColumnSize()
Returns the column size (precision) of the type.The value returned follows the definition used in
DatabaseMetaData, as established inDatabaseMetaData.getColumns(String, String, String, String)forCOLUMN_SIZE. The same definition is used for database metadata columnsPRECISIONin, among others,DatabaseMetaData.getFunctionColumns(String, String, String, String).This method will also return any non-zero precision information stored for other datatypes than those listed in the
COLUMN_SIZEdefinition in the JDBC API.- Returns:
- The column size as defined in
DatabaseMetaData, ornull.
-
getLength
public java.lang.Integer getLength()
- Returns:
- The field length in bytes
-
getScale
public java.lang.Integer getScale()
Returns the scale of the field.For numerical types, returns a zero or positive scale. For types without scale, it returns
null, for types that have a non-zero scale in the Firebird metadata, it returns the scale as stored.- Returns:
- The scale of a field, or
null.
-
getRadix
public int getRadix()
- Returns:
- The radix of numerical precision (either
2or10; returns10for non-numerical, non-boolean types.
-
getCharOctetLength
public java.lang.Integer getCharOctetLength()
- Returns:
- The maximum number of bytes for a character type column,
nullotherwise
-
builder
public static TypeMetadata.Builder builder(FirebirdSupportInfo supportInfo)
Creates type metadata builder.- Parameters:
supportInfo- Firebird support info- Returns:
- Builder for type metadata
-
getDataType
public static int getDataType(int sqlType, int sqlSubType, int sqlScale, int characterSetId)Derives the JDBC data type fromTypesorJaybirdTypeCodesfrom metadata information.- Parameters:
sqlType- Firebird type code as used in the metadata tablessqlSubType- Firebird sub-type code as used in the metadata tablessqlScale- Firebird scale as used in the metadata tablescharacterSetId- Character set id as used in the metadata tables- Returns:
- JDBC data type code.
-
getDataTypeName
public static java.lang.String getDataTypeName(int sqlType, int sqlSubType, int sqlScale)Derives the JDBC/SQL type name from metadata information.- Parameters:
sqlType- Firebird type code as used in the metadata tablessqlSubType- Firebird sub-type code as used in the metadata tablessqlScale- Firebird scale as used in the metadata tables- Returns:
- JDBC/SQL type name
-
-