Reputation: 1089
I want to store I string in sqlite table field, which looks like an integer. The definition of the field in sqlite:
"time string"
For example for the value "126.70", I want that it is stored as a complete string, but I see in the database "126.7", so the last zero is cut of(as by integers)
here is my code:
String time = "126.70";
ContentValues cv = new ContentValues();
cv.put("time", time);
db.replace(TABLE, null, cv);
How to avoid such behavior?
Upvotes: 1
Views: 261
Reputation: 152827
string
is not an sqlite column type so the defaults apply. Use text
instead:
sqlite> create table a(b text, c real);
sqlite> insert into a values("123.10", "123.10");
sqlite> select * from a;
123.10|123.1
Upvotes: 1