Subject unsubscribe
Author Ion Silvestru
Hello Artur,

Wednesday, April 17, 2002, 1:18:53 PM, you wrote:

AA> radevo:

AA> That's the way Id's work: they don't need to be sequential, just
AA> incremental. What's the problem of loosing some? You are not using
AA> generators to keep a sequential number range, are you? If so, pls take a
AA> look at this document:


AA> You may ask yourself why this is done by IBO on 'new record' instead of
AA> 'before post', and I think this is done to allow the user to know that value
AA> at anytime, allowing for example this id to be use in a master/detail
AA> relation ship (but Jason or Helen could explain better the reasons to you).

AA> But the client should know that value before it sends it to the server, so
AA> he can pick up just that row, instead of all query.

AA> Your code in trigger:
>> If (new.primary_id is null) then new.primary_id = Gen_ID(...).
AA> is a very efficient, that keeps that rule also in the server, so you can use
AA> another application (such as ibconsole, for example) to insert data into the
AA> database with the same rule.

AA> There is a 'feature request' post from Jason to Firebird that will resolve
AA> this problem: a syntax in Firebird that will allow something like 'INSERT
AA> .... INTO .... RETURNING :....' (I'm not sure if this is the syntax that
AA> Jason ask for). This will allow to insert values returning another one, that
AA> will simplify this problem.

AA> I hope this helps.

AA> Artur

AA> ----- Original Message -----
AA> From: "radevojvodic" <rvojvodic@...>
AA> To: <>
AA> Sent: Wednesday, April 17, 2002 9:28 AM

>> Hi All,
>> I'm thinking about GeneratorLink usage and i find it unefficient. For
>> example if you set this property for a primary key and you put your
>> query in insert state generator is called imedietly. So you
>> incremented generator value. Then You cancel insert and your
>> generator value is still incremented.
>> For some tables in database i wrote trigger with
>> If (new.primary_id is null) then new.primary_id = Gen_ID(...).
>> Now if you set you Insert statement in IBO_query to
>> INSERT INTO *TABLE*( primary_id, ... ) Values (null,...);
>> then your generator will be incremented only when you actually post
>> your record to database and you are still able to enter your own
>> value for that field without incrementing generator. Of course if you
>> cancel transaction after you posted record generator will stay
>> incremented but how often do you cancel transaction after you posted
>> record.
>> The only problem with this kind of solution is with refreshing query
>> because new value is not shown until you refresh query.

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

AA> Your use of Yahoo! Groups is subject to

Best regards,
Ion M. Silvestru,
Sr. Software Engineer
National Informatics Centre/MoldData/MoldInfoLex
Chisinau, Moldova
Tel.: +3732 542509
GSM: +373 9445526