{ "id": "63682", "key": "TIMOB-3050", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": [ { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-12-08T22:37:53.000+0000", "created": "2011-04-15T03:35:32.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "core", "qe-testadded" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-01-20T21:16:03.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": "I just discovered a bug in the database code, in that it does not properly typecast big integers coming from the database.\r\n\r\nRunning this code:\r\n\r\n{code:title=app.js}\r\nvar db = Titanium.Database.open('bigint_test');\r\ndb.execute(\"DROP TABLE `test`\")\r\ndb.execute(\"CREATE TABLE `test` (`val1` BIGINT, `val2` BIGINT)\");\r\ndb.execute(\"DELETE FROM `test`\");\r\ndb.execute(\"INSERT INTO test (val1, val2) VALUES (1, 1296802544867)\");\r\n \r\nTitanium.API.info(1296802544867);\r\nTitanium.API.info(db.execute(\"SELECT * FROM `test`\").field(0));\r\nTitanium.API.info(db.execute(\"SELECT * FROM `test`\").field(1));\r\n\r\nvar table_info = db.execute(\"PRAGMA table_info(test)\")\r\nfor (var i=0; i < table_info.fieldCount(); i++) {\r\n Titanium.API.info(table_info.fieldName(i) + \": \" + table_info.field(i));\r\n};\r\n{code}\r\n\r\nproduces this log:\r\n\r\n{code}\r\n[INFO] 1296802544867\r\n[INFO] 1\r\n[INFO] -277578525\r\n[INFO] cid: 0\r\n[INFO] name: val1\r\n[INFO] type: BIGINT\r\n[INFO] notnull: 0\r\n[INFO] dflt_value: null\r\n[INFO] pk: 0\r\n{code}\r\n\r\n\r\nSo you can see that the last log line is wrong it should be 1296802544867.\r\n\r\nLooking at the .sql file from the iPhone Simulator, I can tell you that the right value is stored in the db, and that other sqlite clients give the right value back.\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: bug in typecasting of big integers from the database", "creator": { "name": "mickstaugaard", "key": "mickstaugaard", "displayName": "Mick Staugaard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mickstaugaard", "key": "mickstaugaard", "displayName": "Mick Staugaard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 272, "state": "closed", "name": "2014 Sprint 25 SDK", "startDate": "2014-12-08T22:49:31.264Z", "endDate": "2014-12-22T01:00:00.000Z", "completeDate": "2015-01-05T18:18:28.523Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "156412", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "A user in the Q&A has suggested [this|http://developer.appcelerator.com/question/120826/sqlite-integer-storage-issue-on-iphone] workaround.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-06-10T02:57:26.000+0000", "updated": "2011-06-10T02:57:26.000+0000" }, { "id": "209990", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested SDK 2.2.0.014b86f, valid\r\n\r\nCore issue because resolution will likely involve changing the way we represent ints and floats being transferred between the interpreter and the internals.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T17:04:07.000+0000", "updated": "2012-07-26T17:04:50.000+0000" }, { "id": "327443", "author": { "name": "fatalhck", "key": "fatalhck", "displayName": "Lucas", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Its still happening in release 3.4.0, its a critical bug, because my app running perfect on Android and now when us merge with IOS build, thats crash because this.\r\n\r\nPlease Fix IT!", "updateAuthor": { "name": "fatalhck", "key": "fatalhck", "displayName": "Lucas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-09T15:53:53.000+0000", "updated": "2014-10-09T15:53:53.000+0000" }, { "id": "328541", "author": { "name": "rudolf@pobox.com", "key": "rudolf@pobox.com", "displayName": "Rudolf Cardinal", "active": true, "timeZone": "Europe/London" }, "body": "This is not \"medium\", this is critical; Titanium is corrupting user data. (In my case it prevents the storage of 10-digit patient identifiers.)\r\n\r\nSimilar code to generate:\r\n\r\n{code}\r\nvar DBNAME = \"junk.db\",\r\n TESTVAL = 9876543210, // big enough to cause the bug\r\n db = Titanium.Database.open(DBNAME),\r\n cursor,\r\n x;\r\n\r\ndb.execute(\"DROP TABLE IF EXISTS t\"); // so we can run this more than once\r\ndb.execute(\"CREATE TABLE t (bignum INTEGER)\");\r\ndb.execute(\"INSERT INTO t (bignum) VALUES (?)\", TESTVAL);\r\n// Check the database using the SQLite command line. Confirms: 9876543210.\r\ncursor = db.execute(\"SELECT bignum FROM t\");\r\nx = cursor.field(0);\r\nif (x === TESTVAL) {\r\n Titanium.API.debug(\"happy\");\r\n} else {\r\n Titanium.API.debug(\"oh dear; Titanium bug; x is now \" + x);\r\n}\r\n// Check the database using the SQLite command line. Confirms: 9876543210.\r\n{code}\r\n", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-18T23:30:53.000+0000", "updated": "2014-10-27T19:50:19.000+0000" }, { "id": "331463", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We believe this is fixed in recent CI builds of the Titanium SDK. Please test on iOS against versions 3.4.2 and 3.5.0", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-10T22:20:55.000+0000", "updated": "2014-11-10T23:32:54.000+0000" }, { "id": "334022", "author": { "name": "rudolf@pobox.com", "key": "rudolf@pobox.com", "displayName": "Rudolf Cardinal", "active": true, "timeZone": "Europe/London" }, "body": "Thanks - sorry, what's the URL for the 3.4.2 SDK package for Studio installation? I can't find it in the list at http://builds.appcelerator.com.s3.amazonaws.com/index.html", "updateAuthor": { "name": "rudolf@pobox.com", "key": "rudolf@pobox.com", "displayName": "Rudolf Cardinal", "active": true, "timeZone": "Europe/London" }, "created": "2014-11-27T12:08:47.000+0000", "updated": "2014-11-27T12:08:47.000+0000" }, { "id": "334025", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Use 3.5.X...that's the new name for the same thing (we switched versions).", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-27T13:07:36.000+0000", "updated": "2014-11-27T13:07:36.000+0000" }, { "id": "334031", "author": { "name": "rudolf@pobox.com", "key": "rudolf@pobox.com", "displayName": "Rudolf Cardinal", "active": true, "timeZone": "Europe/London" }, "body": "Thanks! The bug looks like it's fixed in Titanium SDK 3.5.0 alpha (installed today, running under iOS 8.1 simulator under OS/X).", "updateAuthor": { "name": "rudolf@pobox.com", "key": "rudolf@pobox.com", "displayName": "Rudolf Cardinal", "active": true, "timeZone": "Europe/London" }, "created": "2014-11-27T13:53:49.000+0000", "updated": "2014-11-27T13:53:49.000+0000" }, { "id": "335492", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Resolving based on customer feedback.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-12-08T22:37:53.000+0000", "updated": "2014-12-08T22:37:53.000+0000" }, { "id": "339983", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix on:\r\n\r\nMac OSX 10.10.1\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nTitanium SDK build: 3.6.0.v20150120113941\r\nTitanium CLI, build: 3.4.1\r\nAlloy: 1.5.1\r\nXcode 6.1.1\r\niPhone 6 (8.2b4), iPad Mini 3 (8.1)\r\n\r\nUsing the code provided, big integers are typecast properly and the value is returned as expected.\r\n\r\nClosing ticket.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2015-01-20T21:15:59.000+0000", "updated": "2015-01-20T21:15:59.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }