Subject RE: [IBO] Foreign key
Author Malcolm Smith
Helen,


The error was "ID is a required field".

But your answer solved the problem. Thanks again.


Malcolm Smith
MJ Freelancing
ABN: 30 671 763 146
http://www.mjfreelancing.com

CORintel
ABN: 30 336 110 329


-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Tuesday, 20 August 2002 10:59
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Foreign key


At 10:45 AM 20-08-02 +1000, you wrote:
>Helen,
>
>I don't even know what the 'FOR UPDATE' does. I saw it in another demo.
>
>The master table only has two columns, an ID and a DESCRIPTION. I
currently
>have SELECT* only because I'm getting an error relating to the fact the
>field is a required field in a key link.

What's the error?


>Additionally I have a trigger/generator on the ID field. When I add a new
>record I get an exception raised. Is this where I need to explicitly
define
>an InsertSQL command - to trigger the trigger (no pun intended) - I've put
>one in and it works so I guess this is correct.

No. You only need to set xxxxxSQL properties yourself if your DML
operations have to be out of the ordinary - for example, calling a stored
procedure to insert rows into multiple tables.

Set GeneratorLinks to have IBO fetch a generator value for your PK in (or
any other col that uses a generator) in inserts, e.g.

MyCol=MyGen

You need to change your BI trigger so that it tests for null, otherwise
you'll get "double-dipping" on the generator...

...
active before insert as
begin
if (new.MyCol is null) then
new.MyCol = gen_id(MyGen, 1);
end

Helen



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/