0

I'm using SQLite to store some data. The primary database is on a NAS (Debian Lenny, 2.6.15, armv4l) since the NAS runs a script which updates the data every day. A typical "select * from tableX" looks like this:

2010-12-28|20|62.09|25170.0
2010-12-28|21|49.28|23305.7
2010-12-28|22|48.51|22051.1
2010-12-28|23|47.17|21809.9

When I copy the DB to my main computer (Mac OS X) and run the same SQL query, the output is:

2010-12-28|20|1.08115035175016e-160|25170.0
2010-12-28|21|2.39343503830763e-259|-9.25596535779558e+61
2010-12-28|22|-1.02951149572792e-86|1.90359837597183e+185
2010-12-28|23|-1.10707273937033e-234|-2.35343828462275e-185

The 3rd and 4th column have the type REAL. Interesting fact: When the numbers are integer (i.e. they end with ".0"), there is no difference between the two databases. In all other cases, the differences are ... hm ... surprising? I can't seem to find a pattern.

If someone's got a clue - please share!

5
  • My only guess is the data type is getting read out incorrectly, possibly due to a version conflict between the two DBs. Try storing a record on the Mac and then reading it from Debian and see if the behaviour is consistent. If it is consistent, then you'll find your data is actually fine, but a platform inconsistency is causing this.
    – user3463
    Dec 27, 2010 at 17:53
  • Just tried that - same effect but vice versa. When I store values on the Mac and run a select query on the Debian machine, I get these insanely high or low floats.
    – pruefsumme
    Dec 27, 2010 at 18:15
  • sqlite3 versions: 3.5.9 (Debian), 3.6.12 (Mac)
    – pruefsumme
    Dec 27, 2010 at 18:16
  • Maybe one of your sqlite installs had some unusual compile time options. You can find out by typing PRAGMA compile_options; in the sqlite shell. I'm wondering if it has something to do with malloc byte alignment. Dec 28, 2010 at 23:41
  • this has no effect (i.e. doesn't return anything) sqlite> PRAGMA compile_options; sqlite>
    – pruefsumme
    Dec 29, 2010 at 16:05

0

You must log in to answer this question.

Browse other questions tagged .