Subject Re: [IBO] Problem with TIBOQuery and TIB_Query
Author Daniel Rail
Hi,

At September 14, 2004, 19:28, Jason Wharton wrote:


> Turn off KeyLinksAutoDefine and the DB_KEY will go away.
> Or, better still, put in the correct KeyLinks entries.
> TIB_Cursor isn't buffered so it doesn't need to know KeyLinks for many
> reasons.

After a goodnight sleep, something comes to mind. And, here's what I
found. If in the query I use the table name in front of the PK field
name, the DB_KEY field pops up. But if I don't use the table name in
front of the PK field name, then the DB_KEY field doesn't show up.

Here are the examples, and in both ITEM_NO is the primary key:

1) In this example, DB_KEY is added to the field list.
SELECT ORDER_ITEMS.ITEM_NO
, ORDER_ITEMS.ORDERNO
FROM ORDER_ITEMS
WHERE ORDER_ITEMS.ORDERNO=10
ORDER BY ORDER_ITEMS.ITEM_NO

Fields in result set:
ITEM_NO
ORDERNO
DB_KEY

2) In this example, DB_KEY is NOT added to the field list.
SELECT ITEM_NO
, ORDER_ITEMS.ORDERNO
FROM ORDER_ITEMS
WHERE ORDER_ITEMS.ORDERNO=10
ORDER BY ORDER_ITEMS.ITEM_NO

Fields in result set:
ITEM_NO
ORDERNO

Yet, for both above examples, the UPDATE DML generated by IBO is:
UPDATE ORDER_ITEMS SET
ITEM_NO = :ITEM_NO, /*PK*/
ORDERNO = :ORDERNO
WHERE
ITEM_NO = :OLD_ITEM_NO

So, I think this is a bug when defining the KeyLinks property, when
KeyLinksAutoDefine is set to True.

For now, as a work around, I'll set KeyLinksAutoDefine to False, since
I don't need it for reporting purposes.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)