Re: [pysqlite] retrieving 64-bit numbers from SQLite

Roger Binns <[email protected]> Wed, 10 Sep 2008 17:26:22 -0700
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Bruce Greenblatt wrote:
> I created the table with the num column as an INTEGER.  If I change it to REAL, I work around the problem, but I will lose precision.

Read http://www.sqlite.org/datatype3.html which describes SQLite's
behaviour.

And just to reassure you, pysqlite does get the types correct.
2147483647 is the largest positive integer you can fit in signed 32 bits.

>>> for row in con.cursor().execute("select 3, 2147483647, 2147483647+1, 2147483647.0"):
...     print row
(3, 2147483647, 2147483648L, 2147483647.0)

Roger