Subject Re: [IBO] Posting nulls into NOT NULL fields.
Author Helen Borrie
At 04:35 PM 14-10-01 +0200, you wrote:
>With the versions > 4.2 Ee I have the following problem:
>With TIBOQuery I can post null values into fields defined in InterBase as

I believe that you will discover that no nulls have been posted. In TDataset, all "empty" fields are made to be zero-equivalent - zero in numerics and dates, empty string (#0) in character fields.

To post a null, you have to do one of two things:

a) exclude the field in question from your update SQL statement. IOW, if you are using the standard Insert() method on a dataset that selects your non-nullable field, Delphi will post a zero-equivalent
b) explicitly make the field's value null by calling Clear, e.g.

>With TIB_Query I solved this problem with ColumnAttributes

The BLANKISNULL attribute forces (b) above on the field it applies to.

>How it is possible that InterBase not null fields accept null values ?

It isn't possible. If you wish to post nulls, you must do a) or b) above and also set CheckRequired false on that field.


>Thanks for help
>Peter Czarnecki
>Eustachio SA
>Your use of Yahoo! Groups is subject to

All for Open and Open for All
InterBase Developer Initiative ยท