I want to list all domains, their datatypes, and size.
Background
I've managed to do the query, based on this SO answer.
The basic code takes all fields:
SELECT
*
FROM
rdb$fields
I found that I could get fields from rdb$fields:
- filter fields from this request by
RDB$FIELD_NAME - get field type code from
RDB$FIELD_TYPE - get field length from
RDB$FIELD_LENGTH
Reference:
Question
How to combine all this to list all domains, their datatypes, and size?
I want to get only domains created by users, not automatic ones.
The code:
Also interesting, I could not find a system table with datatypes. Had to hardcode them from the reference.
Thanks for the help in comments:
@MarkRotteveel
RDB$TYPEcontains types, but names them differently:Need to use field
RDB$CHARACTER_LENGTHinstead ofRDB$FIELD_LENGTH.I needed the length of varchars only but appears RDB$FIELD_LENGTH = RDB$CHARACTER_LENGTH, 1 byte = 1 char for 1 byte character set.
@Arioch
The most reliable way to get user domains: