KB-20071120-017
From Triled Wiki
- Status: respond received, fixing
- author: Andrey Fedoseev
- link: http://groups.google.com/group/android-developers/msg/1da9604349c1e4c3
- Description: getFloat() or getDouble() returns incorrect value for REAL fields in sqlite.
- Confirmed on: Windows XP, Windows Vista, Debian (Lenny)
- Steps to reproduce:
Table must have floating point fields (example from Andrey Fedoseev's post):
CREATE TABLE items (_id integer primary key autoincrement, title text not null, amount real not null, date integer not null);
Be sure you have some data here:
sqlite> select * from items; 63|asd|1.0|1195380242797
use Cursor to get data:
Cursor c = db.query(DATABASE_TABLE, new String[] {"_id", "title", "amount", "date"}, "_id=63", null, null, null,null);
c.first();
double amount_value = c.getDouble(c.getColumnIndex("amount"));
Expected value 1.0, but result is 4.60718e+18
Note: For value 0.0 code is working.
