Module org.firebirdsql.jaybird
Package org.firebirdsql.jdbc

# Class AbstractFieldMetaData

java.lang.Object
org.firebirdsql.jdbc.AbstractFieldMetaData

All Implemented Interfaces:
  `Wrapper`

Direct Known Subclasses:
  `FBParameterMetaData`, `FBResultSetMetaData`

@InternalApi public abstract class AbstractFieldMetaData extends Object implements Wrapper
Base class for `FBResultSetMetaData` and `FBParameterMetaData` for methods common to both implementations.

This class is internal API of Jaybird. Future versions may radically change, move, or make inaccessible this type.

Since:
  3.0
Author:
  David Jencks, Nickolay Samofatov, Mark Rotteveel

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static final record`
`AbstractFieldMetaData.ExtendedFieldInfo`
Stores additional information about fields in a database.
`protected static final record`
`AbstractFieldMetaData.FieldKey`
A composite key for internal field mapping structures.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractFieldMetaData(RowDescriptor rowDescriptor, FBConnection connection)`

## Method Summary

Modifier and Type
Method
Description
`protected final int`
`estimateFixedPrecision(int fieldIndex)`
`protected abstract Map<AbstractFieldMetaData.FieldKey,AbstractFieldMetaData.ExtendedFieldInfo>`
`getExtendedFieldInfo(FBConnection connection)`
This method retrieves extended information from the system tables in a database.
`protected final AbstractFieldMetaData.ExtendedFieldInfo`
`getExtFieldInfo(int columnIndex)`
`protected final String`
`getFieldClassName(int field)`
`protected final int`
`getFieldCount()`
Retrieves the number of fields in the object for which this `AbstractFieldMetaData` object contains information.
`protected final FieldDescriptor`
`getFieldDescriptor(int fieldIndex)`
The `FieldDescriptor` of the field with index `fieldIndex`.
`protected final int`
`getFieldType(int field)`
`protected final String`
`getFieldTypeName(int field)`
`protected final int`
`getPrecisionInternal(int field)`
Retrieves the designated parameter's specified column size.
`protected final RowDescriptor`
`getRowDescriptor()`
`protected final int`
`getScaleInternal(int field)`
Retrieves the designated field's number of digits to right of the decimal point.
`protected final boolean`
`isSignedInternal(int field)`
Retrieves whether values for the designated field can be signed numbers.
`final boolean`
`isWrapperFor(Class<?> iface)`
`final <T> T`
`unwrap(Class<T> iface)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AbstractFieldMetaData

protected AbstractFieldMetaData(RowDescriptor rowDescriptor, FBConnection connection)

## Method Details

### isWrapperFor

public final boolean isWrapperFor(Class<?> iface) throws SQLException

Specified by:
  `isWrapperFor` in interface `Wrapper`
Throws:
  `SQLException`

### unwrap

public final <T> T unwrap(Class<T> iface) throws SQLException

Specified by:
  `unwrap` in interface `Wrapper`
Throws:
  `SQLException`

### getRowDescriptor

protected final RowDescriptor getRowDescriptor()

Returns:
  The row descriptor.

### getFieldCount

protected final int getFieldCount()
Retrieves the number of fields in the object for which this `AbstractFieldMetaData` object contains information.

Returns:
  the number of fields

### getFieldDescriptor

protected final FieldDescriptor getFieldDescriptor(int fieldIndex)
The `FieldDescriptor` of the field with index `fieldIndex`.

Parameters:
  `fieldIndex` - 1-based index of a field in this metadata object
Returns:
  field descriptor

### isSignedInternal

protected final boolean isSignedInternal(int field)
Retrieves whether values for the designated field can be signed numbers.

Parameters:
  `field` - the first field is 1, the second is 2, ...
Returns:
  `true` if so; `false` otherwise

### getScaleInternal

protected final int getScaleInternal(int field)
Retrieves the designated field's number of digits to right of the decimal point.

0 is returned for data types where the scale is not applicable.

Parameters:
  `field` - the first field is 1, the second is 2, ...
Returns:
  scale

### getFieldClassName

protected final String getFieldClassName(int field) throws SQLException

Throws:
  `SQLException`

### getFieldTypeName

protected final String getFieldTypeName(int field)

### getFieldType

protected final int getFieldType(int field)

### getPrecisionInternal

protected final int getPrecisionInternal(int field) throws SQLException
Retrieves the designated parameter's specified column size.

The returned value represents the maximum column size for the given parameter. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. 0 is returned for data types where the column size is not applicable.

Parameters:
  `field` - the first field is 1, the second is 2, ...
Returns:
  precision
Throws:
  `SQLException` - if a database access error occurs

### estimateFixedPrecision

protected final int estimateFixedPrecision(int fieldIndex)

### getExtFieldInfo

protected final AbstractFieldMetaData.ExtendedFieldInfo getExtFieldInfo(int columnIndex) throws SQLException

Throws:
  `SQLException`

### getExtendedFieldInfo

protected abstract Map<AbstractFieldMetaData.FieldKey,AbstractFieldMetaData.ExtendedFieldInfo> getExtendedFieldInfo(FBConnection connection) throws SQLException
This method retrieves extended information from the system tables in a database. Since this method is expensive, use it with care.

Returns:
  mapping between `AbstractFieldMetaData.FieldKey` instances and `AbstractFieldMetaData.ExtendedFieldInfo` instances, or an empty Map if the metadata implementation does not support extended info.
Throws:
  `SQLException` - if a database error occurs while obtaining extended field information.