Menu

#852 Tinyints display errors

Squirrel SQL
closed-fixed
5
2015-01-08
2010-04-03
Pat F
No

I have a MYQL database with 3 tinyint fields. If the value stored in any of
those fields is greater than 127, then SQuirrel 3.1 displays as error.
I'm running MySQL 4.0.12 and it's worked for years. I just downloaded
SQLYog and it displays correctly.

The tables show in Squirrel as "tinyint unsigned" yet any value greater than 127 displays an error.
Obviously,It's treating it as signed.

Thanks

Discussion

  • Pat F

    Pat F - 2010-04-03

    Displayed Field Type

     
  • Rob Manning

    Rob Manning - 2010-04-03

    OK - how do you insert those values since they are not legal values
    according to MySQL ?

    Rob

     
  • Rob Manning

    Rob Manning - 2010-04-03
    • milestone: --> All
    • assigned_to: nobody --> manningr
     
  • Pat F

    Pat F - 2010-04-03

    Squirrel display of fields greater and less than 127.

     
  • Nobody/Anonymous

    I execute the following without error and a successful update:
    UPDATE rr_users SET blue='150' WHERE id='1';
    This will display blue in Squirrel as <error> after the update and as 150 when displayed via SQLyog.
    Note I executed the UPDATE from Squirrel without error. It is an unsigned tinyint after all, but it just does not display 150 but instead <error>.
    Now when I execute:
    UPDATE rr_users SET blue='100' WHERE id='1';
    Squirrel updates without error AND displays 100.
    -P

     
  • Rob Manning

    Rob Manning - 2010-04-04

    Oh, tinyint (unsigned) - the summary misled me and I missed that in the details section. I don't see the same result (see attached screenshot). Do you have any errors/exceptions in the log ?

    Rob

     
  • Rob Manning

    Rob Manning - 2010-04-04

    No issues with displaying values less than or greater than 127

     
  • Pat F

    Pat F - 2010-04-04

    Yes, you are correct, if I run SELECT red from rr_users then I get all values <127 and values > 127 print correctly just like you do.

    But if you display your table via Objects Tab (using the Content tab), how does
    your 150 display ? (As 150 or <error>)

    I get <error> for anything greater than 127.

    Thanks
    -P

     
  • Rob Manning

    Rob Manning - 2010-04-04

    OK, now I see the problem. We call getByte() on the result because the JDBC Driver reports the column type as byte (-6). Unfortunately JDBC doesn't specify a type code for unsigned tinyint, and the MySQL driver has no choice but to throw an exception when we attempt to get the value of the field as a byte, when the value exceeds 127. One possible way to work around this is override the default data type component for -6 (TINYINT) to use DataTypeShort rather than DataTypeByte. Will look into this.

    Rob

     
  • Rob Manning

    Rob Manning - 2010-04-04

    Fixed in Subversion. The change will be available in the next snapshot and/or stable release.

     
  • Rob Manning

    Rob Manning - 2010-04-04
    • status: open --> closed-fixed
     

Log in to post a comment.