You must Login before you can answer or comment on any questions.
I want to save large integers (timestamp values) in a database using Titanium 1.6.2. On Android this works fine; on iPhone the value seems to get shortened when written to the db (in the simulator and on a real device). Here's some demonstration code:
var db = Ti.Database.open('inttest'); db.execute('CREATE TABLE foo (bar INTEGER)'); var t = new Date().getTime(); db.execute('INSERT INTO foo VALUES (?)', t); var rs = db.execute('SELECT bar FROM foo'); var result = rs.field(0); rs.close(); db.close(); alert('written value=' + t + '\nread value=' + result);On Android, the written and read values are identical. On iPhone, when I write e.g. 1307695588237 to the db, the query returns 2025408156.
I already found that the problem can be fixed by removing the
INTEGER type from the
CREATE TABLE statement. I was just wondering... does anyone have an idea why this happens, or can at least verify that it happens? I assume that's a TiBug...
Also, I hope this helps anyone who runs into the same problem.
Thank you for sharing the workaround you found. Ticket TIMOB-3050 has been raised to address this issue . Please watch it to show your support for its resolution.
What is the type then if it's not integer?......varchar (256) or something?
Just make the field tekst and use parseFloat to get the full number.
I encountered the same issue.
Ti shall have supported the big integer as sqlite3 did. :(
Think you can help? Login to answer this question!