[Lazarus] SQLQuery

Chris Crori crori49 at yahoo.com
Fri Mar 28 02:01:51 CET 2014


Done!
I used the second query method on the beforepost event and it works fine

I would like to try expanding the TSQLQuery to be able to use generator 
fields, can someone help me send the patch after?

Thank you Michael for your help

-----Αρχικό μήνυμα----- 
From: Chris Crori
Sent: Thursday, March 27, 2014 3:53 PM
To: Lazarus mailing list
Subject: Re: [Lazarus] SQLQuery

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
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 





More information about the Lazarus mailing list