Subject Re: [IBO] Getting field constraints from TIB_Query
Author Helen Borrie
At 12:26 PM 07-09-01 +0200, you wrote:
>I used to work with IBX to access my IB Database. Now I'm migrating to IBO.
>Because IBX Table and IBX Query both inherit from TDataSet I encounter a
>I'm using TDataSet.Fields[x] to get hold of a fieldconstraint 'Required'.
>Since IBO Query and Table don't have a shared ancestor (dataset) I don't
>have access to the IBQuery.Fields[x] property.
>How can I obtain fieldconstraints from a IBOQuery is my question.

...and now I just noticed that there is confusion. The subject of your posting refers to TIB_Query, while the body refers to "IBO Query and Table". So it's not clear which series of components you question really relates to.

There are TIBO* components - these are TDataset descendants. And there are TIB_* components, which are "native IB Objects". There is no TIB_Table.

TIB_* doesn't use TFields to encapsulate database column behaviour - it uses TIB_Column. This is the class where you will find and/or set the data properties for the column. TIB_Row, the foundation class encapsulating a row in an output set, is an array of TIB_Column. IB_Column is a "supersmart" class that combines the behaviours of both TField and TParam.

You can access a TIB_Column through the Fields[] property of the dataset (or, more precisely, of the TIB_Statement class) or as FieldByName. Columns returned from stored procedures are also addressed through Fields[]. Input parameters for all SQL statements are addressed through the Params[] and ParamByName properties.

You can, for example, have a statement like this:

If Fields['aColumn'].Required then...

Actually, quite a lot of the native IB_* smarts can be accessed in the TIBO* classes, through the InternalDataset property.


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