Package org.firebirdsql.gds.ng.fields
Class FieldDescriptor
java.lang.Object
org.firebirdsql.gds.ng.fields.FieldDescriptor
The class
FieldDescriptor contains the column metadata of the XSQLVAR server
data structure used to describe one column for input or output.
FieldDescriptor is an immutable type, the value of a field is maintained separately in RowValue.
- Version:
- 3.0
- Author:
- Mark Rotteveel
-
Constructor Summary
ConstructorsConstructorDescriptionFieldDescriptor(int position, DatatypeCoder datatypeCoder, int type, int subType, int scale, int length, String fieldName, String tableAlias, String originalName, String originalTableName, String ownerName) Constructor for metadata FieldDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintThe length in characters of this field.intintintgetScale()intintgetType()inthashCode()booleanisDbKey()Determines if this is a db-key (RDB$DB_KEY) of a table.booleanisFbType(int fbType) Check if the type of this field is the specified Firebird data type.booleanbooleantoString()booleantypeEquals(FieldDescriptor other) Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.
-
Constructor Details
-
FieldDescriptor
public FieldDescriptor(int position, DatatypeCoder datatypeCoder, int type, int subType, int scale, int length, String fieldName, String tableAlias, String originalName, String originalTableName, String ownerName) Constructor for metadata FieldDescriptor.- Parameters:
position- Position of this field (0-based), or-1if position is not known (eg for test code)datatypeCoder- Instance of DatatypeCoder to use when decoding column data (note that another instance may be derived internally, which then will be returned bygetDatatypeCoder())type- Column SQL typesubType- Column subtypescale- Column scalelength- Column defined lengthfieldName- Column alias nametableAlias- Column table aliasoriginalName- Column original nameoriginalTableName- Column original tableownerName- Owner of the column/table
-
-
Method Details
-
getPosition
public int getPosition()- Returns:
- The 0-based position of this field (or
-1)
-
getDatatypeCoder
- Returns:
- The
DatatypeCoderto use when decoding field data.
-
getEncodingFactory
- Returns:
- The
IEncodingFactoryfor the associated connection.
-
getType
public int getType()- Returns:
- The Firebird type of this field
-
getSubType
public int getSubType()- Returns:
- The Firebird subtype of this field
-
getScale
public int getScale()- Returns:
- The scale of this field
-
getLength
public int getLength()- Returns:
- The declared (maximum) length of this field
-
getFieldName
- Returns:
- The (aliased) field name
-
getTableAlias
- Returns:
- The (aliased) table name
-
getOriginalName
- Returns:
- The original name of the field (eg the column name in the table)
-
getOriginalTableName
- Returns:
- The original table name
-
getOwnerName
- Returns:
- The owner
-
isVarying
public boolean isVarying()- Returns:
trueif the type is variable length (ieISCConstants.SQL_VARYING).
-
isFbType
public boolean isFbType(int fbType) Check if the type of this field is the specified Firebird data type.This method assumes the not-nullable data type is passed, on checking the nullable bit of
getType()is set to0.- Parameters:
fbType- One of theSQL_data type identifier values- Returns:
trueif the type is the same as the type of this field
-
isNullable
public boolean isNullable()- Returns:
trueif this field is nullable.
-
isDbKey
public boolean isDbKey()Determines if this is a db-key (RDB$DB_KEY) of a table.NOTE: Technically it could also be a normal
CHAR CHARACTER SET OCTETScolumn calledDB_KEY.- Returns:
trueif the field is a RDB$DB_KEY- Since:
- 4.0
-
getCharacterLength
public int getCharacterLength()The length in characters of this field.This takes into account the max bytes per character of the character set.
- Returns:
- Character length, or
-1for non-character types (including blobs)
-
typeEquals
Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.The fields checked are:
- type
- subType
- scale
- length
- Parameters:
other- Field descriptor to check- Returns:
truewhenotheris not null and has the same type definition as this instance,falseotherwise.
-
toString
-
equals
-
hashCode
public int hashCode()
-