Jump to content


Photo
- - - - -

[Linqpad] Bug: With Iq Driver, Integer Columns In Sqlite Are Always Mapped As Int32, Which Can Cause Overflows


  • Please log in to reply
2 replies to this topic

#1 Thomas Levesque

Thomas Levesque

    New Member

  • Members
  • Pip
  • 9 posts

Posted 01 March 2012 - 01:46 AM

When you connect to a SQLite database with the IQ driver, all integer columns are mapped as Int32. But some values in the column may be outside the range of an Int32, and in that case the value silently overflows, giving incorrect results.

I realize that SQLite doesn't provide enough information to decide whether the column should be Int32, Int64 or something else (since there is only one storage class for all integer types), so to avoid this kind of issue, integer values should be mapped as Int64. Unsigned values larger than Int64.MaxValue shouldn't never occur, since SQLite only stores signed integers up to 8 bytes (http://sqlite.org/datatype3.html)

(LINQPad beta 4.38.04)

Edited by Thomas Levesque, 01 March 2012 - 01:50 AM.


#2 darkniobe

darkniobe

    New Member

  • Members
  • Pip
  • 1 posts

Posted 17 October 2012 - 04:10 PM

This bug is fixed in the most recent release of the IQ driver. You now have the option in the connection configuration screen to select "Map all integers to 64bit longs".

#3 Thomas Levesque

Thomas Levesque

    New Member

  • Members
  • Pip
  • 9 posts

Posted 18 October 2012 - 12:09 AM

This bug is fixed in the most recent release of the IQ driver. You now have the option in the connection configuration screen to select "Map all integers to 64bit longs".

Cool, thanks !




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users