Skip to content

values of UInt8 data types get converted to 125 #70

@girng

Description

@girng

Ran into this little quirk today. i checked with gitter, and pretty sure it's a bug, not entirely sure though

query:

        items2 = db.query_all "select i_hp from rpg_user_items where rpg_character_id = ? and user_id = ? and in_stash = 0", client.selected_characterid, client.user_id, as: {UInt8}
          puts items2[0]

storage type in mysql, set as tinyint, 255, unsigned

if you don't set the length to 255, but keep it unsigned, it will give you a read error:

MySql::ResultSet#read returned a Int8. A UInt8 was expected.

if you set the length to 255, that error is gone. however, now your value gets converted to 125

thanks for reading! special thanks to @dscottboggs_gitlab in gitter for the help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions