Hello,
I'm using Lazarus 0.9.23-20070602 runing under Linux with fpc 2.0.4.
I've got table called 'groups' at PostgresQL 8.2 server, with two fields:
- 'id' which is definied as primary key serial
- 'descr' which is definied as varchar(40)
When I insert data into this table I'd like to know what was the 'id' value assigned to freshly added record. In pure SQL (from the pgsql CLI level) it's quite trivial:
INSERT INTO groups(descr) VALUES ('this is test') RETRUNING id;
and it returns what I need:
id
___
1
(1 row)
So I've tried to grab it in lazarus giving to TSQLQuery object SQL property following value: 'INSERT INTO groups(descr) VALUES ('this is test') RETRUNING id INTO :WYN;
'
The problem is that at run-time my app says: 'pq: Unknown fieldtype for parameter "WYN"'. After googling a bit I've tried the following:
TSQLQuery1.Params[0].AsIntereger := 0;
and
TSQLQuery1.Params.ParamByName('WYN').AsInteger := 0;
but it doesn't help. There were no run-time errors on thouse lines, they compiled and run fine - but still when I was trying to catch returning value of INSERT systems says: 'pq: Unknown fieldtype for parameter "WYN"'
What I'm doing wrong? Any suggestions? Flames? Obvious RTFM FAQ pointers? :wink:
TIA,
Cezar