Wrong length of inserted data in batch operations

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mika
Posts: 20
Joined: Thu 08 May 2014 06:15

Wrong length of inserted data in batch operations

Post by mika » Tue 29 Mar 2022 08:28

Hi,
I have unidac 9.1.1, I'm trying to batch insert using ODBC provider to Actian Zen.
My problems is that data is stored with wrong length, typically length of first record value

Code: Select all

    aq.sql.Text := 'insert into ashakuterm (hakuasiakasnro, hakusana) values (:n, :s)';
    aq.params[0].DataType := ftInteger;
    aq.params[1].DataType := ftString;
    aq.Params.ValueCount := apuLista.Count; //apuLista=tstringlist
    for i := 0 to apuLista.count -1 do
    begin
      aq.Params[0][i].AsInteger := aasiakasnro;
      aq.params[1][i].asstring  := apuLista.strings[i];
      codesite.send('%d / %s',[aasiakasnro, apulista.Strings[i]);
    end;
    aq.execute(apuLista.count);
hakuasiakasnro is an integer , hakusana is varchar(40)

This is the codesite output of parameters

Code: Select all

8 / 8
8 / SKJ SYSTEMS LTD OY
8 / SKJ
8 / SYSTEMS
8 / LTD
8 / OY
8 / KUOPIO
8 / MÖTTÖNEN MAKE
8 / MÖTTÖNEN
8 / MAKE
8 / PENTTI HIRVONEN
8 / PENTTI
8 / HIRVONEN
And this is output of query select hakuasiakasnro, hakusana from ashakuterm where hakuasiakasnro=8

Code: Select all

8	8
8	S
8	L
8	O
8	K
8	M
8	P
8	H
If I do it without batch, it works ok.

pavelpd
Devart Team
Posts: 109
Joined: Thu 06 Jan 2022 14:16

Re: Wrong length of inserted data in batch operations

Post by pavelpd » Thu 07 Apr 2022 08:18

Hi,

Kindly be informed that we have reproduced the described issue with Ansi ODBC Driver for Actian ZEN, unfortunately this is related to the driver itself and we cannot influence it.

The example you provided uses Unicode characters.
To work with them correctly, please, use the appropriate driver: "Pervasive ODBC Unicode Interface".
For this:
- create a new DSN with the "Pervasive ODBC Unicode Interface" driver supplied with Actian ZEN
- specify this DSN in the connection settings
Please, let us know about the results.
Looking forward to hear from you!

mika
Posts: 20
Joined: Thu 08 May 2014 06:15

Re: Wrong length of inserted data in batch operations

Post by mika » Fri 15 Apr 2022 07:43

Hi, Awesome that you find the issue.
Sorry for delay, I tought I had email notification turned on but looks like I didn't have.

Actually my example wasn't really using unicode characters.
I also tried with datasample containing pure ascii characters and got same results and handling all strings as ansistrings.
But with this information I can use batchs if customer has unicode interface.

Thanks!

Post Reply