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.


There is a DBGrid linked to that Query so i can't :(
also i tried to use returning inside the InsertSql statement and it didn't word (i thought maybe it will update the ID field)




--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to