regression - bug preparing statement

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

regression - bug preparing statement

Post by albourgz » Fri 29 Mar 2019 08:17

Using c++ builder XE 10.2, unidac 7.4.12, vcl, connection to oracle 12.2 EE in direct mode.
TUniQuery: When sql statement is modified, calling "Prepare()" method doesn't add params array if property ParamCheck is false.

On a form, drop a TOracleUniProvider, a TUniConnection, connect it to an oracle database, direct mode, UnicodeEnvironment=true.
Drop a TUniQuery with sql: select * from cec.natures where id=1 (use the table you want). Set ParamCheck to false.
Drop a TUniButton, set this code in OnClick event:

Code: Select all

    UniQuery1->SQL->Text="SELECT * from cec.natures WHERE ID=:1";
    UniQuery1->Prepare();
    UniQuery1->Params->Items[0]->AsInteger=1;
    UniQuery1->Active=true;
You will get an error when clicking button: Project Project102.exe raised exception class EArgumentOutOfRangeException with message 'Argument out of range'. We didn't get this issue with previous releases.

However, if sql is not modified: so set SELECT * from cec.NATURES WHERE ID=:1 in component and remove the UniQuery1->SQL->Text=..., Prepare() works and statement can be run!

I agree that params should not be added automatically when statement is changed but Prepare() should create the parameters array in this case, no????

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: regression - bug preparing statement

Post by MaximG » Tue 02 Apr 2019 14:51

The behavior you describe is correct. When working with queries containing parameters in UniQuery, Params array will be either created automatically (when ParamCheck=True), or each parameter of the query should be created manually (when ParamCheck=False). For more information, please refer to:
https://www.devart.com/unidac/docs/deva ... mcheck.htm

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: regression - bug preparing statement

Post by albourgz » Wed 03 Apr 2019 07:56

It is correct to say that array will not be created when changing statement.
What is not correct is that when calling Prepare(), it should be created, as it was in previous releases.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: regression - bug preparing statement

Post by MaximG » Tue 09 Apr 2019 13:37

Please specify the previous version of our components in which the prepare method worked as you described.

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: regression - bug preparing statement

Post by albourgz » Wed 10 Apr 2019 08:29

7.3.10 and earlier.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: regression - bug preparing statement

Post by MaximG » Wed 10 Apr 2019 10:04

We tested the work of UniDAC 7.2.7 according to your description and found no problems. Please compose and send us the simplest full sample that demonstrates the ParamCheck behavior. You can send the sample using the contact form at our site: https://www.devart.com/company/contactform.html

Post Reply