Page 1 of 1

Wrong length of inserted data in batch operations

Posted: Tue 29 Mar 2022 08:28
by mika
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.

Re: Wrong length of inserted data in batch operations

Posted: Thu 07 Apr 2022 08:18
by pavelpd
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!

Re: Wrong length of inserted data in batch operations

Posted: Fri 15 Apr 2022 07:43
by mika
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!