Subject Re: [ib-support] more questions on use of generators
Author Ann W. Harrison
At 12:04 AM 11/12/2002 +0800, Jon Perez wrote:
>In isql, why is:
>
>select gen_id(GENNAME, 0) as GenVal from RDB$Database
>
>needed to get the value of a generator instead
>of a simple:
>
>select gen_id(GENNAME, 0)
>
>as is the case with MySQL...?

Because select requires a data source and
gen_id is a value expression. A select
without a from is like a faucet without a
water main?

>Also, when using SQL embedded in another language (I'm
>using Python kinterbasdb), if one wants to be able to
>know what number was generated, is it recommended to get
>this value first via the above method and then manually
>include it in an insert instead of using a before insert
>trigger to do it automatically?

See below.


>Or is there a way to use the before insert trigger method
>and still be able to get the last generated value
>reliably even in a multi-user environment?

No.


Regards,

Ann
www.ibphoenix.com
We have answers.