Subject Re: [IBO] KeyLinks/JoinLinks and RequestLive
Author Helen Borrie
At 03:10 PM 12-03-01 +0000, you wrote:
>Is the point of KeyLinks and JoinLinks so that I can have a JOIN in
>my SQL and still have editable data sets with ReqestLive=TRUE ? Or
>am I way off beam.
>
>If it is, can someone please explain how to set it up, or point me to
>where in the help file it tells you.

The point of KeyLinks (which is required for ALL datasets, not just joined ones) is to provide IBO with a unique row identity column for the dataset.

The point of JoinLinks is to provide a workaround for implicit joins, which are highly undesirable in IBO. This is an implicit join:

SELECT a.Col1, a.Col2, a.Col3, b.Col0, b.Col1 from aTable a, bTable b
where a.Col1 = b.Col0 /* this is a join criterion */
and a.Col4 <= 'TODAY' /* this a WHERE criterion */
and b.Col9 = 'French' /* this a WHERE criterion */

In this statement, you would remove the join criterion from the statement and place it in your JoinLinks as
aTable.Col1=bTable.Col0

If you use the (recommended) explicit join syntax, you don't need (and should not use) JoinLinks, i.e.

SELECT a.Col1, a.Col2, a.Col3, b.Col0, b.Col1 from aTable
JOIN bTable b
ON a.Col1 = b.Col0
WHERE a.Col4 <= 'TODAY'
and b.Col9 = 'French'

When using a joined dataset, set the KeyRelation property to the name of the table which you wish to be affected by edits, inserts and deletes. If you want IBO to work out what the statements should be for these operations, set RequestLive to True. If you need custom SQL for these ops, enter it in the EditSQL, InsertSQL and DeleteSQL properties.

Note: DO make certain that your KeyLinks contains all the columns necessary in both tables to uniquely identify a row.

Cheers,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________