UNSIGNED8 values not deserialized correctly from XML source

Description

Any UNISIGNED8 value that is in excess of the maximum positive INTEGER8 value is deserialized as the maximum INTEGER8 value (9223372036854775807).

 

This was first witnessed by  when making a SOAPCALL to a Boca Roxie service that returned UNSIGNED8 values.

 

produced this simple ECL to illustrate the more generic issue:

 

OutRecord :=

    RECORD

        UNSIGNED8 id;

        string val{xpath('id')};

    END;

 

rec := FROMXML(OutRecord,'<Row><id>18196239629641154791</id></Row>');

OUTPUT(rec, NAMED('FromXML'), NOXPATH);

 

OUTPUT(PROJECT(DATASET(rec), TRANSFORM(OutRecord,SELF.id := (UNSIGNED8)LEFT.val; SELF := LEFT)), NAMED('proj'), NOXPATH);

Conclusion

None

Activity

Show:

Gavin Halliday March 22, 2019 at 3:49 PM

Workaround for 7.0.x is to read as a string, and then convert to an unsigned.

 

Richard Chapman March 22, 2019 at 11:28 AM

Generated code is

*((unsigned long long *)(crSelf.row() + 0U)) = (unsigned long long)row->getInt("id");

There is no getUInt method in IColumnProvider

getInt ultimately calls _atoi64 which seems to return MAX_INT on overflow

I suspect it will need a change to the IColumnProvider interface and the generate code to address this

Any comment?

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Fix versions

Affects versions

Created March 22, 2019 at 12:50 AM
Updated July 16, 2020 at 2:44 PM
Resolved March 22, 2019 at 3:48 PM