Subject Re: [IBO] KeyLinks and KeyLinksAutoDefine
Author Martijn Tonies
Hi Geoff,

> > I'm using KeyLinksAutoDefine = True to make a dataset editale (I
> > cannot set the keylinks myself).
>
> I assume by this that you are assembling the SQL in code. Given that,

You know what they say about 'assuming'? You make an 'ass' out of
'u' and 'me'... :) (ok, no offence)

Back to the subject:
No, I don't ... I use IBO in InterBase Workbench and people just enter
their SQL statements and press 'run'. So I really have no control over
the key links...

But I guess I can create the variation and put in DB_KEY in the select
myself - but why isn't IBO doing this? When I did my tests with the
statement, I couldn't find DB_KEY in the select list... When does IBO
put DB_KEY in the select (I have seen it happen) and when does it
not? (and why)


--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."




> then there is no reason why you cannot define the keylinks yourself,
> using a variation of the GetKeyLinks code that you have provided.
>
> Get the list of key fields
> IB_Connection.SchemaCache.GetTableKeys( TableName, tmpStrList );
>
> then see if all field names in tmpStrList are in the fields you are
> placing in the select clause. If so assign tmpStrList to KeyLinks, if
> not then put the DB_KEY into the keylinks yourself.