Problem with duplicated params when using a parameter multiple times in a query text

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ezijp
Posts: 6
Joined: Tue 23 Feb 2016 12:02

Problem with duplicated params when using a parameter multiple times in a query text

Post by ezijp » Tue 16 May 2017 07:30

When I set the SQL text of a TMSQuery component with a SQL statement that uses a parameter multiple times like for example

Code: Select all

select *
from mytable
where COALESCE(DVALIDFROM, :PeriodTo) <= :PeriodTo
then the params property contains the PeriodTo twice. Is this the intended behaviour? Or am I missing a setting? This behaviour differs from the behaviour we are used to from UniDAC.

When the parameters are duplicated I get a 'required parameter not set' error when I try to execute the query.

Kind regards,
Erik

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Problem with duplicated params when using a parameter multiple times in a query text

Post by azyk » Wed 17 May 2017 08:57

The specified dataset parameters behavior in SDAC is correct.

You can leave your suggestion about implementation of SDAC dataset parameters behavior, as in UniDAC at our UserVoice ( http://devart.uservoice.com/forums/1046 ... components ). If the suggestion receives enough votes we will consider its implementation.

ezijp
Posts: 6
Joined: Tue 23 Feb 2016 12:02

Re: Problem with duplicated params when using a parameter multiple times in a query text

Post by ezijp » Thu 18 May 2017 11:44

Thanks for the clarification. I created an item for this at your UserVoice: https://devart.uservoice.com/forums/104 ... a-paramete
This behaviour makes accessing the parameters by name useless when you have a parameter that is used multiple times in a query. The behaviour is also different from the standard TIBQuery and TSQLQuery component that come with Delphi.

As long as this behaviour is not changed SDAC is unusable for us.

Kind regards,
Erik

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Problem with duplicated params when using a parameter multiple times in a query text

Post by azyk » Fri 19 May 2017 09:12

This SDAC behavior is used by many users, therefore we will be able to consider a possibility of its change if there is a sufficient number of votes at UserVoice.

Post Reply