Subject Re: [IBO] When is KeyRelation necessary?
Author Helen Borrie (TeamIBO)
At 12:02 PM 12-03-02 +0100, Nando Dessena wrote:
>Hello,
>I am using a TIBOQuery with a somewhat complex SQL statement (a left
>join and a "where exists" clause). The dataset is not editable unless I
>set KeyRelation. I thought that it was required when using implicit join
>syntax only, while I am using explicit syntax.

You are getting confused with JoinLinks, I think.

>Does anyone have a definitive reference on when is KeyRelation
>necessary?

"Necessary" - not at all. But it can be used to set the (one) table in the
joined dataset that can be updated by the standard Insert, Edit and Delete
behaviours. It's not useful if you need to update multiple tables - in
that case you would not use KeyRelation, but would call stored procs by way
of you custom SQL props (InsertSQL, etc.)

>The query is something like that:
>
>select a.*, b.id
>from a left join b on (a.id = b.id)
>where exists (select s.id from some_stored_procedure(:a_param) s where
>s.id = a.id)
>order by a.id
>
>I have set KeyLinks to 'a.id', and thought that would be enough.
>Setting KeyRelation to 'a' does work well, so it's not really an issue
>for me, just a curiosity.

What does it *do* when it "works well"?


regards,
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
www.ibobjects.com