Subject Re: [IBO] Strange Data in my inserts
Author Geoff Worboys
> I have a table with a few varchar fields which have default ''
> and not null specified for them.

Having "default" applied in the table definition will not help you if
you have the field included in the dataset/cursor selection in IBO
(and the field is obviously included if you are using select * from

Server defaults are only used if the field is not explicitly provided
in an insert statement. eg.
create tablea(
fielda varchar(20) default 'a',
fieldb varchar(20) default 'b'

insert into tablea (fielda) values ('c');

will result with fieldb set to its default. Whereas...

insert into tablea (fielda,fieldb) values( 'c', null );

will result with fieldb set to NULL!!!

In IBO, when you use something like "select *", then every field will
be included in the automatically generated insert statement. You can
prevent fields being included in insert/edit requests either by NOT
including them in the select, or by setting them to readonly -
FieldsReadOnly.Add( 'fielda=T' );

If IBO includes the field in its insert statement the Server default
will not get a chance to be applied.

Having said all that... ;-)

> When inserting data I am ending up with strange characters in
> the fields that I do not explicitly set. I would have expected
> them to be set to an empty string.

There is still no reason that IBO should allow strange characters
through to the field. Either IBO will assign NULL (if no value was
provided or if a blank string was provided and the BLANKISNULL
attribute is set), or it will assign a blank string.

Your posting makes me wonder if IBO has mistaken the datatypes of some
of the fields. Do you have SchemaCache defined on your connection?
If so, either clear it or make sure the local cache has been

What version of IBO and Delphi?

Could you post the SQLMonitor output where the statement is prepared,
as well as the definition of table itself - for comparison.

Geoff Worboys
Telesis Computing