Subject | Re: [IBO] NULL |
---|---|
Author | Geoff Worboys |
Post date | 2001-06-11T02:06:47Z |
> > If I don't assign anything to field and insert a record<...>
> > using TIBOTable the defaults defined in Database are not
> > applied.
> Try modifying the propertyGetServerDefaults will work, but not very efficiently. It retrieves
> TIBOTable.InternalDataset.GetServerDefaults:=True
the default values from the server with every call to get a new
record.
Generally you should use the DefaultValues stringlist property to
setup the the defaults at the client.
Note: Server defined defaults do not work the way that you may
expect.
Given: TABLE_A( Field_A, Field_B, Field C )
INSERT INTO TABLE_A( Field_A ) VALUES( 'a' )
will result in any defaults for Field_B and Field_C being applied.
INSERT INTO TABLE_A( Field_A, Field_B, Field_C ) VALUES( 'a', NULL,
NULL )
will result in NULL being assigned to Field_B and Field_C and the
defaults are ignored.
Now look at what IBO will do with
SELECT Field_A, Field_B, Field_C FROM TABLE_A
By default, the insert that IBO will generate is equivalent to the
second insert above - expressly updating every field selected,
resulting in the server defaults being ignored. If you only wish to
display a field, and dont need to update it, you can define it as
readonly in the FieldsReadOnly stringlist property of the dataset.
This will prevent IBO from including it in the insert, allowing the
server default to be applied.
If you want all the fields to be editable at the client, then the
default must be applied at the client. The most efficient way of
doing that is with the DefaultValues property as indicated above.
HTH
Geoff Worboys
Telesis Computing