Page 1 of 1

6.2.7- Can not access a DML array as a single value

Posted: Mon 14 Sep 2015 17:11
by ecosoft.it
I have tried your sample:
http://blog.devart.com/using-batch-oper ... nents.html

But I have received this error: "Can not access a DML array as a single value"

I have tried INSERT and DELETE code with TUniQuery with SQLServer 2008, Firebird 2.52 and XE8/10 Seattle

Code: Select all

procedure TForm43.ButtonInsClick(Sender: TObject);
var
  i: Integer;
begin
  // describe the SQL query
  Query1.SQL.Text := 'INSERT INTO BATCH_TEST VALUES (:ID, :F_INTEGER, :F_FLOAT, :F_STRING, :F_DATE)';

  // define the parameter types passed to the query :
  Query1.Params[0].DataType := ftInteger;
  Query1.Params[1].DataType := ftInteger;
  Query1.Params[2].DataType := ftFloat;
  Query1.Params[3].DataType := ftWideString;
  Query1.Params[4].DataType := ftDateTime;

  // specify the array dimension:
  Query1.Params.ValueCount := 1000;

  // populate the array with parameter values:
  for i := 0 to Query1.Params.ValueCount - 1 do begin
    Query1.Params[0][i].AsInteger := i + 1;
    Query1.Params[1][i].AsInteger := i + 2000 + 1;
    Query1.Params[2][i].AsFloat := (i + 1) / 12;
    Query1.Params[3][i].AsString := 'Values ' + IntToStr(i + 1);
    Query1.Params[4][i].AsDateTime := Now;
  end;

  // insert 1000 rows into the BATCH_TEST table
  Query1.Execute(1000);
  ShowMessage('ok');
end;

procedure TForm43.ButtonDelClick(Sender: TObject);
var
  i: Integer;
begin
  // describe the SQL query
  Query1.SQL.Text := 'DELETE FROM BATCH_TEST WHERE ID=:ID';

  // define parameter types passed to the query:
  Query1.Params[0].DataType := ftInteger;

  // specify the array dimension
  Query1.Params.ValueCount := 1000;

  // populate the arrays with parameter values
  for i := 0 to 1000 - 1 do
    Query1.Params[0][i].AsInteger := i + 3000 + 1;

  // delete 1000 rows from the BATCH_TEST table
  Query1.Execute(1000);
end;

Thanks
Alessandro

Re: 6.2.7- Can not access a DML array as a single value

Posted: Tue 15 Sep 2015 13:08
by MaximG
We have tested UniDAC on using Batch operations with InterBaseUniProvider and SQLServerUniProvider on Delphi 10 Seattle - and haven't detected any problems.
Please pay attention, we have corrected some inaccuracy in our blog about Batch operations. Try to reproduce the batch samples from http://blog.devart.com/using-batch-oper ... nents.html once again. Send the complete sample reproducing the error to maximg*devart*com

Re: 6.2.7- Can not access a DML array as a single value

Posted: Tue 15 Sep 2015 15:45
by ecosoft.it
I had added a TUniSQLMonitor component on my sample.
If use TUniSQLMonitor.Active = true the my application raise the exception!
If not active all it working.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Wed 16 Sep 2015 07:26
by AlexP
We have already fixed the issue with SQLMonitor. We will upload the fixed version tomorrow.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Tue 22 Sep 2015 13:31
by ecosoft.it
I have installed the 6.2.8 version and I have the same problem with TUniSQLMonitor.Active = true.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Wed 23 Sep 2015 08:27
by AlexP
We have checked this behavior again. SQLMonitor works with Batch operations correctly on the latest version. Please make sure there are no old *.dcu, *.bpl, *.pas files of UniDAC, and *.dcu files of your application.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Wed 23 Sep 2015 21:39
by FredS
AlexP wrote:We have checked this behavior again. SQLMonitor works with Batch operations correctly on the latest version. Please make sure there are no old *.dcu, *.bpl, *.pas files of UniDAC, and *.dcu files of your application.
Hi Alex,

I can confirm this using W10 PRO and XE8. When I turned on the SQL Monitor for another issue I began getting this exact error instead of an Access Violation as per: http://forums.devart.com/viewtopic.php?f=28&t=32505

Re: 6.2.7- Can not access a DML array as a single value

Posted: Thu 24 Sep 2015 08:26
by AlexP
The AV described in your post is not related to SQLMonitor.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Thu 24 Sep 2015 17:06
by FredS
OK, but the error changes depending on TUniSQLMonitor Active.

Code: Select all

TUniSQLMonitor.Active := False
Project PA.exe raised exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.
---------------------------

Code: Select all

TUniSQLMonitor.Active := True
Project PA.exe raised exception class Exception with message 'Can not access a DML array as a single value'.
---------------------------

Re: 6.2.7- Can not access a DML array as a single value

Posted: Fri 25 Sep 2015 12:03
by ViktorV
FredS wrote:OK, but the error changes depending on TUniSQLMonitor Active.

Code: Select all

TUniSQLMonitor.Active := False
Project PA.exe raised exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.
---------------------------

Code: Select all

TUniSQLMonitor.Active := True
Project PA.exe raised exception class Exception with message 'Can not access a DML array as a single value'.
---------------------------
Thank you for the information. We have reproduced the problem. We will fix this bug till the next build of UniDAC.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Fri 25 Sep 2015 16:57
by FredS
ViktorV wrote:We will fix this bug till the next build of UniDAC.
I would appreciate an overnight build when this is done. Can resubmit credentials if needed.

thanks

Fred

Re: 6.2.7- Can not access a DML array as a single value

Posted: Mon 12 Oct 2015 17:52
by FredS
ViktorV wrote: Thank you for the information. We have reproduced the problem. We will fix this bug till the next build of UniDAC.
Do we have an ETA for this yet?

thanks

Fred

Re: 6.2.7- Can not access a DML array as a single value

Posted: Tue 13 Oct 2015 09:59
by ViktorV
We can send you a night build including the fix. For this, please send your license number for UniDAC and the IDE version to viktorv*devart*com.

Re: 6.2.7- Can not access a DML array as a single value

Posted: Mon 19 Oct 2015 20:04
by FredS
ViktorV wrote:We can send you a night build including the fix. For this, please send your license number for UniDAC and the IDE version to viktorv*devart*com.
I've sent you two email with no reply?

Re: 6.2.7- Can not access a DML array as a single value

Posted: Tue 20 Oct 2015 10:22
by ViktorV
We have sent you a night build of UniDAC including the fix to your e-mail.