[Lazarus] SQLQuery

Michael Van Canneyt michael at freepascal.org
Thu Mar 27 14:37:51 CET 2014



On Thu, 27 Mar 2014, Chris Crori wrote:

> Hi guys,
>     i use a SQLQuery in a project to connect to a Firebird database. In my table i use a BEFORE INSERT trigger for
> my primary ID field.
> In the same transaction i have to insert a detail row in another column. How can i find out the ID result after
> post but before commit?

There is currently no way to do this unless you run a second query that uses a unique field to retrieve the ID.

if you are using a manual insert query you can do 
INSERT INTO YOURTABLE (fields) VALUES (yourvalues) RETURNING ID 
and use a OPEN to retrieve the ID.

> ps : i tried ZEOSDB and generators worked like a charm, but using ZEOSDB made my app sluggish

There are some plans to support such a thing but nothing was implemented yet.

Michael.


More information about the Lazarus mailing list