Subject | Re: [Firebird-Java] Additional metadata from ResultSet |
---|---|
Author | Mark Rotteveel |
Post date | 2018-01-10T12:05:25Z |
On 10-1-2018 12:26, hugo.larson@... [Firebird-Java] wrote:
- Position is the 0-based position of the column (JDBC itself uses
1-based positions), so you already have this information when accessing
columns in `ResultSetMetaData`
- FieldName is `getColumnLabel` (unless FieldName is null, then it is
OriginalName)
- TableAlias is `getTableAlias` (defined in `FirebirdResultSetMetaData`)
- Type, SubType and Scale is translated to the appropriate JDBC type,
and can - partially - be retrieved using `getColumnTypeName`
- The nullable bit of Type can be retrieved using `isNullable` (500
means it is a SMALLINT NOT NULL, and 501 means that it is a nullable
SMALLINT)
- Type and SubType are not directly retrievable
- Scale can be retrieved using `getScale` (contrary to the requirements
of JDBC, Jaybird currently always returns scale, this may change in the
future).
- Length is the number of bytes of a column (8 for blobs), it is not
immediately accessible (but is used to derive `getColumnDisplaySize` and
`getPrecision` for (var)char columns
- OriginalName is `getColumnName` (except when connection property
columnLabelForName is set, then it returns the same as `getColumnLabel`)
- OriginalTableName is `getTableName` (might not always be available, eg
calculated values, UNION selects)
Mark
--
Mark Rotteveel
> The Jaybird Class FieldDescriptor contains very interesting information.Most of them:
>
> FieldDescriptor:[Position=29,FieldName=ID_PC,TableAlias=PC,Type=501,SubType=0,Scale=0,Length=2,OriginalName=ID,OriginalTableName=PRODUCTCATEGORY,OwnerName=SYSDBA]
>
>
> Is it possible to access these values from ResultsetMetadata?
- Position is the 0-based position of the column (JDBC itself uses
1-based positions), so you already have this information when accessing
columns in `ResultSetMetaData`
- FieldName is `getColumnLabel` (unless FieldName is null, then it is
OriginalName)
- TableAlias is `getTableAlias` (defined in `FirebirdResultSetMetaData`)
- Type, SubType and Scale is translated to the appropriate JDBC type,
and can - partially - be retrieved using `getColumnTypeName`
- The nullable bit of Type can be retrieved using `isNullable` (500
means it is a SMALLINT NOT NULL, and 501 means that it is a nullable
SMALLINT)
- Type and SubType are not directly retrievable
- Scale can be retrieved using `getScale` (contrary to the requirements
of JDBC, Jaybird currently always returns scale, this may change in the
future).
- Length is the number of bytes of a column (8 for blobs), it is not
immediately accessible (but is used to derive `getColumnDisplaySize` and
`getPrecision` for (var)char columns
- OriginalName is `getColumnName` (except when connection property
columnLabelForName is set, then it returns the same as `getColumnLabel`)
- OriginalTableName is `getTableName` (might not always be available, eg
calculated values, UNION selects)
Mark
--
Mark Rotteveel