Subject Re: [IBO] Re: TIB_Cursor and DB_KEY
Author Lester Caine
clivewalden wrote:

>>Question:
>>Is there some other property that will suppress the DB_KEY field as a
>>column OR is it safe to use ibCursor.FieldCount-2 in the iteration?
>
> Seems it is NOT safe!

Correct - DB_KEY is only included when *YOU* do not provide a valid way
of identifying the records of the table!

> If I have a simple one table SQL query then I can find no way to avoid
> the DB_KEY field being returned through TIB_Cursor properties.
> However, a joined SQL query does NOT bring back any DB_KEY field
> (which makes sense).
>
> Anyway, I found a work around by using a dedicated TIB_Transaction and
> setting it to ReadOnly := True.
>
> It seems it should be settable at the TIB_Cursor level by the
> developer, not just IBObjects (Y/N)??

In order for IBO to update a record it must be uniquely identified, so
needs a valid 'keylinks'. This will normally be the primary key of the
table you are accessing, but if no primary key is set, or the query does
not use the primary key, then by default DB_KEY is used.

In order to remove DB_KEY you really need to set up your data so that
records can be identified. DB_KEY is a useful backstop in situations
where 'keylinks' are not available but not the ideal way of working ;)

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php