Page 1 of 2

Malfunction in parametrized query

Posted: Sun 09 Mar 2014 12:34
by radub
Hello,

PgDac 4.2.6, Delphi 7, Win 7 x64.
I have a very strange situation.
In a form with PgConnection, Provider, PgQuery and a ClientDataset, with a parametrized query.
Below is the source code:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
  PgConnection1.Connected:=true;
  with ClientDataset1 do begin
    if Active then Close;
    CommandText:=
'      select 5 where :a >0'+#13#10+
'      union all'+#13#10+
'      select 590 where :a >0 and :b <0 ';
    for i:=0 to Params.Count-1 do begin
      Params[i].ParamType:=ptInput;
      Params[i].DataType:=ftInteger;
      if Params[i].Name='a' then Params[i].Value:=1;
      if Params[i].Name='b' then Params[i].Value:=-1;
    end;
    Open;
  end;
end;
Obviously, the result should be 2 rows the first with 5 and the 2nd with 590, but is only the first row, with 5.
More odd, if either of parameter is eliminated or the where clause in the 2nd select is changed like ' :b <5' and the value of b is set to 2 or is change like ' :b >0' (!!!), it'll show the correct result.

I need a solution, because this situation appears in a report with a huge and complex query in production.

Thank you,
Radu B.

PS
The culprit is the number of parameters, which has to be equal in all the select statement of the union.
A temporary workaround would be placing the second parameter in the first select.
Unfortunately, in my case isn't functioning because in the first select I have a bunch of parameters which appears in the select list and they have to be paired with the subsequent selects.

Re: Malfunction in parametrized query

Posted: Tue 11 Mar 2014 10:31
by AlexP
Hello,

We have already fixed the problem. In the next PgDAC version, the TPgQuery.Options.DistinctParams option will be added, and setting it to False will allow to support such queries in ClientDataset

Re: Malfunction in parametrized query

Posted: Tue 11 Mar 2014 11:06
by radub
Can I get the modifications?
It's urgent, because a lot of reports aren't working in production.

Thank you,
Radu B.

Re: Malfunction in parametrized query

Posted: Wed 12 Mar 2014 15:49
by AlexP
Please send us the license number and an e-mail address where I can send you the fixed version to alexp*devart*com, also specify the used IDE

Re: Malfunction in parametrized query

Posted: Thu 13 Mar 2014 18:39
by radub
Hello,

I've sent via email the information you asked for, but I received no answer.
Did the email arrived?

Thank you,
Radu B.

Re: Malfunction in parametrized query

Posted: Fri 14 Mar 2014 10:02
by AlexP
I've sent you the fixed STD version.

Re: Malfunction in parametrized query

Posted: Fri 14 Mar 2014 11:57
by radub
It seems that something isn't working well.
After installation completed, Delphi reports some errors and didn't load the PgDac components.

The error is:

The procedure entry point @Craccess@TCRRecordSet@CheckedFetched$qqrpvp18Memdata@TFieldDesc could not be located in the dynamic library dac70.bpl.

I wait for the correct module.

Thank you,
Radu B.

Re: Malfunction in parametrized query

Posted: Fri 14 Mar 2014 14:08
by AlexP
Please make sure you have no other products installed, and that you have fully removed the previous PgDAC version.

Re: Malfunction in parametrized query

Posted: Fri 14 Mar 2014 16:01
by radub
Of course I have!
ODAC 9.2 and SDAC 6.9, latest versions.

And sure I don't want to upgrade those, because the last time when I did it, all the implementations with SDAC/ODAC experienced more or less serious problems in productions.

So, please send me a working kit which is compatible with the other DACs.

We have all 3 platforms installed, Oracle, MsSQL and PostreSQL and is more than 3 months since I cannot update all the implementations in production.

Thank you for your understanding,
Radu B.

Re: Malfunction in parametrized query

Posted: Mon 17 Mar 2014 22:12
by radub
...still no kit.

Re: Malfunction in parametrized query

Posted: Wed 19 Mar 2014 13:23
by AlexP
Our products use the same common engine, and since this behavior fixing changes were made at the common level as well, you have to update versions of all the used products

Re: Malfunction in parametrized query

Posted: Wed 19 Mar 2014 13:46
by radub
Ok.
I wait for the SDAC/ODAC kits.
I am on hold.

Re: Malfunction in parametrized query

Posted: Thu 20 Mar 2014 08:37
by radub
Hello,

When can I receive the updated SDAC/ODAC?
I want to emphasize that I am still in the position to not be able to deploy the PostgreSQL business logic server and therefore I have some very upset clients.

Please make it as soon as you can.

Thank you,
Radu B.

Re: Malfunction in parametrized query

Posted: Tue 25 Mar 2014 08:11
by AlexP
I have sent you the fixed versions, please check your e-mail.

Re: Malfunction in parametrized query

Posted: Wed 09 Apr 2014 05:49
by radub
Thank you,

Case closed.