PostgreSQL prepared Query bug

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rant801601
Posts: 18
Joined: Wed 25 Jan 2006 09:28

PostgreSQL prepared Query bug

Post by rant801601 » Mon 19 Jan 2009 13:02

Below code is not working only first record is inserted.
When you remove Prepare then all records are saved.

Testing with PostgreSQL 8.3 and Delphi 2007

1. Table definition:

CREATE TABLE test
(
id integer NOT NULL,
name varchar(40),
uptime timestamp,
userno smallint,
CONSTRAINT test_pk PRIMARY KEY (id)
)

2. Delphi procedure:

procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
t: cardinal;
begin
UniConnection1.Open;

UniConnection1.ExecSQL('delete from test', []);

UniQuery1.Prepare;

t := GetTickCount;

for I := 1 to 100 do
begin
UniQuery1.Params[0].Value := i;
UniQuery1.Params[1].Value := 'test' + IntToStr(i);
UniQuery1.Params[2].Value := Now;
UniQuery1.Params[3].Value := 1;
UniQuery1.Execute;
end;
if UniQuery1.Prepared then
UniQuery1.UnPrepare;

ShowMessage(FormatFloat('0', GetTickCount - t));
end;

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 19 Jan 2009 13:08

We have fixed this problem. The fix will be included in the next build of UniDAC.

Post Reply