I have key containing 19 digits when I parse it to integer via parseInt() method it changes some of the numbers. When I insert this integer into sqlite table it again changes the number (the col is primary key, not auto incremented and integer type) i-e
- '1115430194923422469' string format
- 1115430194923422500 after parseInt
- 1115430194923422464 value inserted/stored in the database
Now when I retrieve this value from database it return the value mentioned in point 2.
Can anyone explain why this behavior .? The value is same (on retrieval) which was inserted but the the value stored in the sqlite table column is different. How can I add the value correctly so it should remain same in the column.
Here is the code sample.
var keyStr = '1115430194923422469'; var key = parseInt(keyStr); var query = 'INSERT INTO Books (key, type) VALUES (?, ?)'; testdb.execute(query, key, 'Comic');
I am using titanium studio and latest sdk 3.5.1
Aucun commentaire:
Enregistrer un commentaire