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

Bruce Greenblatt <bgreenblatt-/[email protected]> Wed, 10 Sep 2008 17:31:03 -0700 (PDT)
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
thanks for the information. I'd already looked at that document.  My system is a 64-bit system, and the numbers appear to be correct in the database table.  It appears that somehow when I retrieve the data it is saved in a 32-bit signed integer, and I don't see any way to coerce the data into a 64-bit unsigned representation.  How would you define the table to use a 64-bit unsigned data?  Would you use the Numeric type?



----- Original Message ----
From: Roger Binns <[email protected]>
To: About pysqlite and APSW. <list-pysqlite-FR6EJeJVuqdwc357pe9rcyQmJico6nz3epZhswDD4dQ@public.gmane.org>
Sent: Wednesday, September 10, 2008 5:26:22 PM
Subject: Re: [pysqlite] retrieving 64-bit numbers from SQLite

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
_______________________________________________
list-pysqlite mailing list
list-pysqlite-FR6EJeJVuqdwc357pe9rcyQmJico6nz3epZhswDD4dQ@public.gmane.org
http://itsystementwicklung.de/cgi-bin/mailman/listinfo/list-pysqlite