Required fields vs. NotNull fields

Marcel

Member
I want to use the "required" property of a database field (Oracle Not Null fieldproperty) in my Delphi application for adjusting controlproperties (backgroundcolor=yellow for required fields).

When I use an OracleDataset and don't use persistent fields I can read the Required property from the field. If the not-null status changes in the database, it changes in the application, which works fine.

BUT when I make the fields in the OracleDataset persistent (I have to when using lookupfields and calculated fields), the Required property becomes fixed. If the not-null fieldproperty in Oracle changes, the dataset still remembers the old status while I want to follow the real oracle-notnull property.

Is there a way of checking the "real" required (not-null) property in the database through the OracleDataset?
 
It may be a good idea to derive your own TOracleDataSet descendant, and override (for example) the DoAfterOpen method to override the Required properties of the fields.

You can use the protected InternalQuery property to determine which fields are optional (TOracleQuery.FieldOptional).

------------------
Marco Kalter
Allround Automations
 
Back
Top