[fpc-pascal] How to insert a record and get the primary key withsqldb?

Michael Van Canneyt michael at freepascal.org
Sat Oct 22 17:43:43 CEST 2011



On Sat, 22 Oct 2011, Ludo Brands wrote:

>>> Afaik Zeos manages to abstract this for all these dbs by having a
>>> sequence object.
>>
>> I fail to see how it can do that. E.g. the mechanism by
>> Martin is just a trick to update
>> a field value after an insert/update. That's a fine/useful
>> mechanism, but not what I'd call
>> 'abstracting'.
>>
>> But never mind. I think the trick is useful, and we should
>> look into getting it in SQLDB.
>>
>
> Zeos TZSequence is only supported for Oracle, IB and PostGreSql, ie. the
> databases using sequences. AFAIK, the use of TZSequence is also mutually
> exclusive with a trigger that uses that sequence. When using a trigger the
> RETURNING clause is the solution to use. A very limited abstraction...

... And mainly the reason I think it is not abstractable... :-)

Michael.



More information about the fpc-pascal mailing list