How to get the DEFAULT value of a column from metadata?
Posted: Thu 22 Apr 2010 08:33
In my application, actually Firebird 2.1 and Fb 2.5 RC i8n test, I have some fields that are defined NOT NULL and on a "DEFAULT 0" user defined domain.
I'm using query and update objects,through a TCustomClientdataset derived component.
When I add record to a query, at POST the fields are defined as Required because of the "NOT NULL" definition but I'm not able to get that they are also DEFAULTed so to keep appropriate action in i.e. BeforePost event.
In BDE a required field is defined as NOT NULL and NOT DEFAULTed (AFAIU my Delphi 7 vcl sources) and that seems right, because post don't need to check for a field NOT NULL that has a default when there are update objects to keep track of server errors in ApplyUpdates.
Perhaps the model under ClientDataSet doesn't support that?
Anyway I need to know how recognize when a field has a default defined (and eventually) get that value to assign to the params in the insert query of the update object.
Are there any solution or hint?
Many thanks in advance.
Mimmo.
I'm using query and update objects,through a TCustomClientdataset derived component.
When I add record to a query, at POST the fields are defined as Required because of the "NOT NULL" definition but I'm not able to get that they are also DEFAULTed so to keep appropriate action in i.e. BeforePost event.
In BDE a required field is defined as NOT NULL and NOT DEFAULTed (AFAIU my Delphi 7 vcl sources) and that seems right, because post don't need to check for a field NOT NULL that has a default when there are update objects to keep track of server errors in ApplyUpdates.
Perhaps the model under ClientDataSet doesn't support that?
Anyway I need to know how recognize when a field has a default defined (and eventually) get that value to assign to the params in the insert query of the update object.
Are there any solution or hint?
Many thanks in advance.
Mimmo.