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

Ludo Brands ludo.brands at free.fr
Sat Oct 22 17:21:25 CEST 2011


> > 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...

Ludo




More information about the fpc-pascal mailing list