Sqlite3-ruby 64bit bug

Hey all,

It appears that I have found a bug in sqlite3-ruby relating to 64bit
integer inserts.

    http://rubyforge.org/tracker/index.php?func=detail&aid=18087&group_id=254&atid=1043

I figured I should say something here in case someone else hits it too. There
is a patch attached to the above ticket that works for me, but may not be the
best solution for the issue.

If you are inserting into a column, and the value is greater than a C 'int' but
still a Ruby Fixnum, you will see an exception.

I've attached a program that you can use to test to see if you are affected.

    $ ruby sqlite-64bit-test.rb
    Ruby : 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]
    system maximumn 'int' : 1073741823
    Last Fixnum : 4611686018427387903 is a Fixnum
    First Bignum : 4611686018427387904 is a Bignum
    Insert 1073741823 into sqlite : Succeeded (returned 1073741823 as a String)
    Insert 4611686018427387904 into sqlite : Succeeded (returned 4611686018427387904 as a String)
    Insert 4611686018427387903 into sqlite : Failed because integer 4611686018427387903 too big to convert to `int'

enjoy,

-jeremy

sqlite-64bit-test.rb (1.26 KB)

···

--

Jeremy Hinegardner jeremy@hinegardner.org