Menu

Get wrong value of BYTE field, if the value is between 128-255

Help
2014-07-07
2014-07-13
  • Zhu GuoFeng

    Zhu GuoFeng - 2014-07-07

    Hi,

    I found an issue that ucanaccess jdbc driver can't convert the access BYTE field correctly.
    The data range of access BYTE field is 0-255.
    However, any value in this field that is larger than 127 is converted to a negative value from ucanaccess jdbc driver.

    How to reproduce it(sorry that I can't upload the access file):
    1 Create a blank database, create a table with NUMBER/BYTE field.
    2 Append a row, set the BYTE field to 255.
    3 Then fetch the value use sql "SELECT * FROM ***", from the ucanaccess sql connection.
    4 You will get -1 for the BYTE field.

    Tested with access 2010 and ucanaccess 2.0.7.

    Can you help me to check this problem?
    Thanks

    zhugf

     
  • Robert Robertino

    yes, sounds like marco used byte instead of unsigned byte. But the problem is that java does not have unsigned byte.

     

    Last edit: Robert Robertino 2014-07-07
  • Marco Amadei

    Marco Amadei - 2014-07-07

    UCanAccess doesn't perform any conversion, jackcess returns a"java primitive byte" which is, as Robert said, a signed byte. Thus the number is misinterpreted.
    I can adapt this behaviour with two mutual conversions(from and to the database) to and from an integer value(and besides, performing some dimensional checks) . Otherwise the client should perform those conversions and this is dirty.
    It will be patched in the 2.0.7.1.
    I hope to publish the 2.0.7.1 this week.
    Cheers Marco

     

    Last edit: Marco Amadei 2014-07-07
  • Zhu GuoFeng

    Zhu GuoFeng - 2014-07-08

    Thank you so much!

     
  • Marco Amadei

    Marco Amadei - 2014-07-13

    Fixed on svn trunk.

     

Log in to post a comment.