Reputation: 4291
I want my C# program to know if the notNULL constraint is set for a specific Firebird database column. Can it be checked dynamically, perhaps by querying the meta data? I find the Firebird documentation to be very sparse.
Also, how does Firebird provide information what columns exist in a specific table?
Upvotes: 1
Views: 2315
Reputation: 28964
You need to request the Firebird metadata for the constraints; all information describing them is stored in system tables. For an example on how to do that see the “List CONSTRAINTs” section on the following page: http://www.alberton.info/firebird_sql_meta_info.html.
Upvotes: 1
Reputation: 2350
To do it manually, use the following statement:
select rdb$null_flag
from rdb$relation_fields
where rdb$relation_name = 'MyTable' and rdb$field_name = 'MyField'
Alternatively you may try exploring FbDataReader.GetSchemaTable()
.
Upvotes: 3