ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
190 stars 151 forks source link

ibm_db v2.7.3 "support for Array Insert" is loading invalid characters to the integer columns #879

Closed AngularRaj closed 2 years ago

AngularRaj commented 2 years ago

@siva-srini When size of data in array is different, you should pass Lenght:<maxDataLength> in the data object. It causes correct data insertion. In your test program, just define the COL4 data as below and verify. { ParamType: 'ARRAY', DataType: 1, Length:4, Data: [ 'DEV', 'IMP', 'PERF', 'DEV', 'IMP', 'INFR', 'PERF', 'DEV', 'IMP' ] }, Thanks.

_Originally posted by @bimalkjha in https://github.com/ibmdb/node-ibm_db/issues/660#issuecomment-667589329_

AngularRaj commented 2 years ago

For the integer column also facing issue like, Case 1 - If not passing the length some junk entry happening

Case 2 - If we pass the length, data cropped. Ex: If we pass length as 2 for integer Then we get result as 12 for the number 1234 etc Do we need to change datatype instead of 1 ? Could you help on this.

AngularRaj commented 2 years ago

@bimalkjha Could you please help on this

bimalkjha commented 2 years ago

@AngularRaj Please share the test program to reproduce the problem. Length is required for character/binary data only. For fixed length data, Length is ignored. Update database connection info in ibm_db\test\config.testConnectionStrings.json file and then run node test\test-array-insert.js. You can refer this test file to see how different types of integer and decimal values get inserted as array. Follow this test file and if issue exist, please share test program to reproduce the problem. Thanks.

bimalkjha commented 2 years ago

@AngularRaj Any update about this issue? Can we close it? Thanks.

AngularRaj commented 2 years ago

Sorry for the delay. For integer also I have passed the length as mentioned below to fix the issue. Here length is range. Ex: Smallint range is -32768 to +32767 so need to pass length as 5 instead of 2.