Subject RE: [IBO] Basic question about inserting using TIBOTable
Author Svein Erling Tysvær
> Thanks Dmitry.
>
> I'm still new to IBO. You write
>
>>
>> 1) Before insert trigger must be defined for table for generate unique ID for each row
>>
>
> There is already a trigger defined in the database:
>
> CENSUBNO_CENSUB_TRIG
> Active BEFORE INSERT trigger for CENSUB at position 0
>
> It seems the trigger isn't trigged :-) Do I need to define the fields in the TIBOTable object?
> In BDE you don't have to define the fields before using a TTable object.

Hei Jacob!

Generally, Firebird is a client/server database, something that is very different from desktop databases. Triggers operate on the server and what happens there is unknown to IBO and your program. So, yes, the trigger should update the table, but it will not be visible in your program until you load the table again. If you want values to be assigned at the client (your program), you may set GeneratorLinks, just write <MyField>=<MyGenerator> in that property.

If you come from Paradox or Access or other desktop databases, then I'd recommend you to rewrite your program rather than to 'just switch' database. I think Firebird by far is superior to Paradox/Access, but using it as if it was one of them is a bit like working with distributing mail in a town from childhood and when you change from walking/using a bicycle to getting your own car, then you continue to use the pavements rather than drive on the road! You risk reaching the conclusion that bicycles are far superior to cars! If you'd already used the BDE with Firebird in your program, then replacing TTable with TIBOTable would be a quick way to get up and running. Changing both database and driver simultaneously is a big step, and you ought to at least consider not just replacing TTable with TIBOTable, but take it a bit further, forget tables, start thinking datasets and use TIB_DSQL, TIB_Cursor and TIB_Query (native components) rather than TIBOTable (TDataset compatible components). The big difference between datasets and tables is that datasets only contain records and fields of interest for the current task, whereas tables also contains lots of data that you're not currently using. And why should Jørgen Havkrogs address be visible when I'm looking for Jacob Havkrogs telephone number?

HTH,
Set