Subject Re: [IBO] Re: Default values not defaulting (newbie)
Author Helen Borrie (TeamIBO)
At 06:08 AM 11-04-02 +0000, bhata wrote:

>I am using IBOQuery with the latest IBO4Gc. I looked at the TI sheet
>but didn't see any reference to ColumnAttributes or InternalDataset.

InternalDataset, no, because this is simply the TIB_BDataset that wraps
around the TIBOQuery. You can access (relevant) properties of this wrapper
through InternalDataset...including ColumnAttributes. You can get at
DefaultValues through your IBODatabase object's DefaultValues: just
include the table, for example

aTable.SomeColumn='I am a default value'

>If I understand you correctly, if I use Insert() TIBOQuery will
>either send a NULL or a value I set in DefaultValues.

If you use the standard Insert(), yes. You can cause the insert statement
to be whatever you like by setting a custom statement in the InsertSQL
property - then IBO will use that instead of composing one itself based on
the Fields[] array.

>Doesn't this
>defeat the ability to have the server set the default values?

"Defeat"? Hardly. If you want to, you can compose your own insertsql and
have the server exercise the constraints without intervention from the
client. However, since Delphi/IBO or any client development software
doesn't know about most of the server constraints, your app program has to
be aware of it.

With IBO, you can use the ib_connection's GetServerDefaults property to
make IBO query the server for them. All very well in concept, but it means
an extra query = more network overhead. So IBO helps you by letting you
install the defaults on the client side and thus avoid that overhead.

If you have been used to desktop databases, it's a bit of mindshift to get
used to a client/server database being a kind of remote, abstract beast
that communicates with applications only at arm's length. Clients have to
send messages to the server (through the client library gds) and, having
done so, they have to react to messages sent back by the server.

What IBO does for you is to provide ways to pre-empt error conditions, if
you want to. On a network, this is generally preferable to waiting for the
error to occur and then reacting to it.

>The field that I am having problems with is defined as:

Then just lodge the default value in the DefaultValues array and forget
about it from here on.

That doesn't mean you should simply bypass the server-based
attributes. They provide backup to ensure that the constraints are met
regardless of where new data and changes originate from.

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at