UniDAC. PostgreSQL. How to use RETURNING in Query

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
pru
Posts: 1
Joined: Mon 25 Oct 2010 13:49

UniDAC. PostgreSQL. How to use RETURNING in Query

Post by pru » Mon 25 Oct 2010 14:00

I'm read:
http://www.devart.com/forums/viewtopic. ... =returning
and
http://www.devart.com/forums/viewtopic. ... =returning
But this not work in UniDac :(

How to use RETURNING in Query?

Example:
INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
RETURNING did;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 26 Oct 2010 07:12

hello,

In UniDAC the RETURNING statment works correctly as it does in PgDAC.
For example:

CREATE TABLE test
(
id numeric NOT NULL DEFAULT 1,
txt character(50)
)

add the following code to TUniQuery:

INSERT INTO test1(id, txt) VALUES (DEFAULT, 'XYZ Widgets UNI')
RETURNING id

and execute the following commands:

UniQuery1.Open;
ShowMessage(UniQuery1.FieldByName('id').AsString);

you should see a message with the following text: '1'

Post Reply