{ "id": "119019", "key": "TIMOB-15254", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2016-06-13T06:30:43.000+0000", "created": "2013-08-26T11:02:09.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "64bit", "ios", "sqlite" ], "versions": [], "issuelinks": [], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-06-13T06:30:43.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "If you store a 64bit integer in Sqlite it returns a truncated version when you try to read it back using resultset.field or resultset.fieldByName\r\n\r\nThis is due to two things:\r\n1) A problem in the underlying pldatabase that the use:\r\nhttp://code.google.com/p/pldatabase/issues/detail?id=25&thanks=25&ts=1377514140\r\n\r\n2) Even if the above problem was fixed Titanium still truncates in TiDatabaseResultSetProxy.m aprox. line #90 in the function transformObject :\r\nresult = NUMINT([TiUtils intValue:obj def:NSNotFound valid:&valid]);\r\n\r\nThere is a work around that requires no modification of the pldatabase library, since if Titanium were to use PLSqliteResultSet->bigIntForColumnIndex it correctly returns a 64bit Objective long long.", "attachment": [], "flagged": false, "summary": "Titanium does not handle 64bit integer correctly in Sqlite on iOS", "creator": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "environment": null, "comment": { "comments": [ { "id": "271438", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi James David Low,\n\nYou can follow [this link|http://stackoverflow.com/questions/9643626/javascript-cant-handle-64-bit-integers-can-it].i think you will know little more about this.\n\nThanks", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2013-09-17T08:00:59.000+0000", "updated": "2013-09-17T08:00:59.000+0000" }, { "id": "271446", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "Hi,\n\nThis is not a JavaScript precision issue. This is an issue with the ObjectiveC code rounding 64bit integers to 16bit integers.\n\nI have managed to get it to work by editing the Objective C code for Titanium to use the PLSqliteResultSet->bigIntForColumnIndex function.\n\nThanks,\nJames", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2013-09-17T10:07:51.000+0000", "updated": "2013-09-17T10:07:51.000+0000" }, { "id": "286471", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "There has been a fix put in the underlying SQL Lite library. If Titanium copy the latest code for the pldatabase it should fix things:\r\n\r\nhttps://github.com/plausiblelabs/pldatabase/commit/517d00f9cc34766ef8de0e43bf47ea4599a73452", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2014-01-02T10:30:39.000+0000", "updated": "2014-01-02T10:30:39.000+0000" }, { "id": "388180", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "I believe this is now fixed in PLSqliteResultSet.m in Titanium 5.2.0\r\n\r\n{code:java}\r\n- (id) objectForColumnIndex: (int) columnIndex {\r\n [self assertNotClosed];\r\n\r\n int columnType = [self validateColumnIndex: columnIndex isNullable: YES];\r\n switch (columnType) {\r\n case SQLITE_TEXT:\r\n return [self stringForColumnIndex: columnIndex];\r\n\r\n case SQLITE_INTEGER:\r\n return [NSNumber numberWithLongLong:[self bigIntForColumnIndex: columnIndex]];\r\n\r\n case SQLITE_FLOAT:\r\n return [NSNumber numberWithDouble: [self doubleForColumnIndex: columnIndex]];\r\n\r\n case SQLITE_BLOB:\r\n return [self dataForColumnIndex: columnIndex];\r\n\r\n case SQLITE_NULL:\r\n return [NSNull null];\r\n\r\n default:\r\n [NSException raise: TI_PLDatabaseException format: @\"Unhandled SQLite column type %d\", columnType];\r\n }\r\n\r\n /* Unreachable */\r\n abort();\r\n}\r\n{code}", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2016-06-13T06:06:10.000+0000", "updated": "2016-06-13T06:06:10.000+0000" }, { "id": "388185", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~jamesdlow] Thanks for the feedback!", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-06-13T06:30:34.000+0000", "updated": "2016-06-13T06:30:34.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }