mysql max integer value

  1. ‹ Older
  2. 4 months ago

    Alexandre C

    May 16 Pre-Release Testers, Xojo Pro Brazil

    @Jared F I think that the issue that Alexandre is running into is this:

    for i as UInt8 = 10 downto 0
      system.debuglog str(i)
      if i = 255 then exit  // Will loop endlessly without an exit
    next

    After i reaches 0 it loops back around to 255 (or 65535 in the case of UInt16), so the for loop will run endlessly.
    Now, i'm not sure if this is an inherent limitation of trying to use unsigned integers in for loops that iterate down to 0, or if it is a specifically a Xojo bug.

    thank you so much.

    I thought I was so stupid that I could not even discover a bug so unacceptable.

  3. Alexandre C

    May 16 Pre-Release Testers, Xojo Pro Brazil

    @Dave S Yes really... making a statement without supporting it does nobody any good. If they were so obviously "broken" then there would be a fire-storm of complaints...
    So without that , I am forced to assume one of 3 things.

    • there is nothing wrong
    • you did in fact find an "edge case" that has not affected others in the past
    • you don't understand how/what is supposed to be happening ... we already identified that there probably is an issue with the database interface... but you last statement was very specific to "UInt"....

    Nothing wrong????

    Really?

    Did you tried to "max(id)" from a mysql database where this id are unsigned tinyint??…

    Did you?…

    Do you think i'm here wasting my time?

    Believe me, i have a lot of more important things to do than beg for you (xojo.inc) to correct an absurd bug, and the only workaround would be change all the columns on mysql to INT

    Nothing wrong…?!?!??!?!

  4. Albin K

    May 16 Europe (Sweden)
    Edited 4 months ago

    @Alexandre C Nothing wrong????

    Really?

    Did you tried to "max(id)" from a mysql database where this id are unsigned tinyint??…

    Did you?…

    Do you think i'm here wasting my time?

    Believe me, i have a lot of more important things to do than beg for you (xojo.inc) to correct an absurd bug, and the only workaround would be change all the columns on mysql to INT

    Nothing wrong…?!?!??!?!

    This is not productive.

  5. Alexandre C

    May 16 Pre-Release Testers, Xojo Pro Brazil

    I created the feedback on 2015 about the "infinite for next" but

    Now i discovered another bug, now with mysql unsigned tinyint.

    It's much more problematic than the other. The older one, it's simple. just put an if inside the "for next". Done

    But the mysql problem is really serious. it's insane i think i'll need to change my mysql structures, relations, indexes because a xojo bug!

    No way!

  6. Emile S

    May 17 Europe (France, Strasbourg)

    Care to explain why you use UInt8 in a loop ?

    Is there’s a difference in your application using UInt8 instead of Integer ?
    (or for your user)

  7. Dave S

    May 17 San Diego, California USA

    @Jared F I think that the issue that Alexandre is running into is this:

    for i as UInt8 = 10 downto 0
      system.debuglog str(i)
      if i = 255 then exit  // Will loop endlessly without an exit
    next

    After i reaches 0 it loops back around to 255 (or 65535 in the case of UInt16), so the for loop will run endlessly.
    Now, i'm not sure if this is an inherent limitation of trying to use unsigned integers in for loops that iterate down to 0, or if it is a specifically a Xojo bug.

    If you think about how FOR/NEXT works. this result is in no way surprising.....
    The DOWNTO loop terminates, when at the NEXT the value of I is LESS than the specified end.
    it can be expressed this way

    i=10
    while I>=0 
      system.debuglog str(i)
      if i = 255 then exit  // Will loop endlessly without an exit
    i=i-1  ///  ZERO - 1 causes the roll over, hence endless loop, as I can never be less than zero
    wend

    This is NOT a bug, this is how Xojo and any other language would react in the same circumstance

  8. Tim H

    May 17 Pre-Release Testers Portland, OR USA

    @Jared F Now, i'm not sure if this is an inherent limitation of trying to use unsigned integers in for loops that iterate down to 0, or if it is a specifically a Xojo bug.

    This is an inherent limitation of unsigned integers in for loops that iterate down to 0. It qualifies as a coding error, not a bug in the framework. I cannot comment on the database related issues.

  9. Tim H

    May 17 Pre-Release Testers Portland, OR USA

    You'd encounter the same kind of error with this loop, too.

    for n as uint8 = 0 to 255
        ...
    next

    The loop doesn't exit until n is greater than 255, which it cannot ever be.

  10. Christian S

    May 18 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    That is the reason why I made feature request to check condition before increment.
    It fixes those nasty bugs we can run into.

  11. Jason P

    May 18 Xojo Inc http://xojo.com/

    @Alexandre C Now i discovered another bug, now with mysql unsigned tinyint.

    You might be able to use CAST to convert to a larger unsigned something like:

    select cast(max(id) as unsigned) as id from zendesk
  12. Alexandre C

    May 18 Pre-Release Testers, Xojo Pro Brazil

    @Dave S This is NOT a bug, this is how Xojo and any other language would react in the same circumstance

    yes, it is a bug.
    it works perfectly on uint32 or uint64.

    And the problem aren't talked here, when i get a value from mysql (unsigned tinyint) it's buggy!
    this is the big problem. I CAN'T CHANGE MY MYSQL STRUCTURE because of a XOJO bug dealing with unsigned values from mysql

  13. Dave S

    May 18 San Diego, California USA

    Ok..... you think it is a bug, despite having multiple people explain exactly what is happening, then there is nothing more to say.

    But I do suggest you study Boolean Arithmetic.....

    I'm done here, and removing this topic....

  14. Tim H

    May 18 Pre-Release Testers Portland, OR USA

    I think you guys are talking past each other, partly because there are 2 distinct and unrelated issues being discussed.

    1. Unsigned int in a for loop - not a bug.
    2. Unsigned smallint in a mysql database doesn't return an unsigned value - sounds like a bug.
  15. Hans-Norbert G

    is not verified May 19 Pre-Release Testers, Xojo Pro

    Good to hear this!
    Got mad searching an error in my source...
    Just changed from MS SQL Server to MySQL and found that annoying error...

    Had to use .StringValue and convert it then in Xojo.

    Thanks a lot for discussing and clarifying this!

  16. Alexandre C

    May 19 Pre-Release Testers, Xojo Pro Brazil

    @Hans-NorbertGratzal Had to use .StringValue and convert it then in Xojo.

    hummm… i'll try this workaround!

  17. Alexandre C

    May 19 Pre-Release Testers, Xojo Pro Brazil

    @Dave S Ok..... you think it is a bug, despite having multiple people explain exactly what is happening, then there is nothing more to say.

    But I do suggest you study Boolean Arithmetic.....

    I'm done here, and removing this topic....

    hummm…

    so the for uint16=1 downto 0 on your concept, it's ok to loop forever?…

    and i need to study boolean arithmetic?…

    hummm…

    please, try this and tell me if this sounds "logic" for you…
    uint8 and uint16 have bugs and uint32 and uint64 runs just fine…

    dim ui8 as UInt8
    for ui8=1 DownTo 0
      if ui8>1 then
        MsgBox "uint8 bug"
        exit for ui8
      end if
    next
    
    dim ui16 as UInt16
    for ui16=1 DownTo 0
      if ui16>1 then
        MsgBox "uint16 bug"
        exit for ui16
      end if
    next
    
    dim ui32 as UInt32
    for ui32=1 DownTo 0
      if ui32>1 then
        MsgBox "uint32 bug"
        exit for ui32
      end if
    next
    
    dim ui64 as UInt64
    for ui64=1 DownTo 0
      if ui64>1 then
        MsgBox "uint64 bug"
        exit for ui64
      end if
    next
  18. Alexandre C

    May 19 Pre-Release Testers, Xojo Pro Brazil

    @Jason P You might be able to use CAST to convert to a larger unsigned something like:
    select cast(max(id) as unsigned) as id from zendesk

    ok. i'll try this too.

    thank you!

  19. Alexandre C

    May 21 Pre-Release Testers, Xojo Pro Brazil

    How do i CAST…

    session.g_db.GetInsertID ?

  20. Jason P

    May 21 Xojo Inc http://xojo.com/

    Something like:

    select cast(max(LAST_INSERT_ID()) as unsigned)

    should work.

  21. Alexandre C

    May 21 Pre-Release Testers, Xojo Pro Brazil

    ohh… of course! tks

or Sign Up to reply!