Duplicated Params in SDAC

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Lisichkin

Duplicated Params in SDAC

Post by Lisichkin » Fri 08 Apr 2005 07:56

Help to understand with a problem.
I use SDAC v.3.0 Delphi 6.0
The Simplified example:

TMSSQL1:

Code: Select all

BEGIN
  SET PARAM2:=PARAM1+1
END

Code: Select all

BEGIN
  MSSQL1.ParamByName('PARAM1').Value := 1;
  MSSQL1.Execute;
  ShowMessage(MSSQL1.ParamByName('PARAM2').Value); // Результат 2
END;
TMSSQL2:

Code: Select all

BEGIN
  SET PARAM1:=PARAM1+1
END

Code: Select all

BEGIN
  MSSQL2.ParamByName('PARAM1').Value := 1;
  MSSQL2.Execute;
  ShowMessage(MSSQL2.ParamByName('PARAM1').Value); // Результат 1
END;
In both cases PARAM1 and PARAM2 - int, IN/OUT.
The problem in the duplicated parameter.
How to overcome it???

Lisichkin

Sorry

Post by Lisichkin » Fri 08 Apr 2005 08:00

Sorry, I was sealed up

TMSSQL1:

Code: Select all

BEGIN 
  SET :PARAM2 = :PARAM1+1 
END 
TMSSQL2:

Code: Select all

BEGIN 
  SET :PARAM1 = :PARAM1+1 
END 

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 08 Apr 2005 09:06

It is a common VCL behaviour - parameters with the same names get the same values.

Lisichkin

Re: Ikar

Post by Lisichkin » Fri 08 Apr 2005 09:21

"It is a common VCL behaviour - parameters with the same names get the same values"

Is this the basic approach, or it will be changed in following versions (can even with v 3.5)?
When I used DOA components for connection to Oracle I could write freely PL/SQL code manipulating one parameter many times, and in the end I receiving result from it.

(Excuse me for my awful English)

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 08 Apr 2005 11:02

Once SDAC supported a separate setting of values for the same named parameters, but then by users' requests we approached behaviour to BDE.

Post Reply