Hi,
I have problem with query with parameters, it is generating integer overflow error. I'm using Delphi 2009, PostgreSQL 14.
I've tried the same code with Delphi 11 and 7.2.4-stable and it is working.
db.connect;
qr := TZQuery.Create(self);
try
qr.Connection := db;
qr.ParamCheck := true;
zap := 'insert into tab.monitoring(opis) values('+
':param_opis)';
qr.SQL.Add(zap);
qr.Params.CreateParam(ftString, 'param_opis', ptInput);
qr.Params.ParamByName('param_opis').AsString := 'blblblb';
try
qr.ExecSQL;
except
end;
finally
qr.Free;
end;
In the attachment is the demo project.
I know what is wrong. There should be:
qr.Params.CreateParam(ftString, 'param_opis', ptInput);
qr.SQL.Add(zap);
I didn't know order is important in this case. So there is a workaround, but in my opinion this error is a bug.
Why do you doing CreateParam? It creates automatically, after SQL.add. Try remove shis line:
qr.Params.CreateParam(ftString, 'param_opis', ptInput);