{ "id": "154213", "key": "TIMOB-20222", "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": "17707", "name": "Release 5.3.0", "archived": false, "released": true, "releaseDate": "2016-06-04" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-01-31T02:31:59.000+0000", "created": "2016-01-11T12:18:28.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "appcelerator", "windows8.1", "windows_phone" ], "versions": [], "issuelinks": [ { "id": "51079", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "155581", "key": "TIMOB-20577", "fields": { "summary": "Windows: App crashes when calling fetch() on any collection that has data", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "56038", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "170031", "key": "CLI-1273", "fields": { "summary": "Ti.Database.execute() should return null when no results are found", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2017-10-16T22:26:11.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "I create a simple alloy app project but in my alloy.js if i put this line\r\n\r\n{code:javascript}\r\nAlloy.Collections.category = Alloy.createCollection('category');\r\n{code}\r\n\r\nwhen the app starts I see in the console this error\r\n\r\n{code}\r\n[ERROR] : Application Error: {\r\n[ERROR] : \"line\": 2,\r\n[ERROR] : \"column\": 10,\r\n[ERROR] : \"message\": \"Error while require(/app) Error while require(alloy/models/Category) unknown exception\",\r\n[ERROR] : \"native_stack\": [\r\n[ERROR] : \"JSExportClass::CallNamedFunction\"\r\n[ERROR] : ]\r\n[ERROR] : }\r\n{code}\r\n\r\neverything works if a run the app on Android and iOS, but it crash if i run it in Windows Phone Simulator.\r\nThis is my model category.js\r\n\r\n{code:javascript}\r\nexports.definition = {\r\n\tconfig: {\r\n\t\tcolumns: {\r\n \"id\": \"INTEGER PRIMARY KEY AUTOINCREMENT\",\r\n \"name\": \"TEXT\",\r\n \"counter\": \"INTEGER\",\r\n \"default_image\": \"TEXT\"\r\n },\r\n defaults: {\r\n \"name\": \"TEXT\",\r\n \"counter\": \"INTEGER\",\r\n \"default_image\": \"TEXT\"\r\n },\r\n\t\tadapter: {\r\n\t\t\t\"type\": \"sql\",\r\n\t\t\t \"tablename\": \"category\",\r\n\t\t\t\"collection_name\": \"category\",\r\n\t\t\t\"db_file\": \"/db.sqlite\",\r\n\t\t\t\"db_name\": \"category\",\r\n\t\t\t\"idAttribute\": \"id\",\r\n\t\t\t\"remoteBackup\": false\r\n\t\t}\r\n\t},\r\n\textendModel: function(Model) {\r\n _.extend(Model.prototype, {\r\n // extended functions and properties go here\r\n });\r\n \r\n return Model;\r\n },\r\n extendCollection: function(Collection) {\r\n _.extend(Collection.prototype, {\r\n // extended functions and properties go here\r\n });\r\n \r\n return Collection;\r\n }\r\n};\r\n{code}", "attachment": [ { "id": "57927", "filename": "erroreDatabase.PNG", "author": { "name": "AlbWebbergate", "key": "albwebbergate", "displayName": "Alberto Bonacina", "active": true, "timeZone": "Europe/Rome" }, "created": "2016-01-11T12:11:58.000+0000", "size": 81946, "mimeType": "image/png" } ], "flagged": false, "summary": "Windows: Error while createcollection on Windows Phone", "creator": { "name": "AlbWebbergate", "key": "albwebbergate", "displayName": "Alberto Bonacina", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "AlbWebbergate", "key": "albwebbergate", "displayName": "Alberto Bonacina", "active": true, "timeZone": "Europe/Rome" }, "environment": "Titanium Studio 4.4.0.201511241829\r\nOperating system Windows 8.1 Pro 64 bit\r\nNodejs version 4.2.4\r\nTitanium cli version 5.0.5\r\nTitanium SDK 5.1.1GA platforms (android, mobileweb, windows)\r\nVisual studio Community 2013 Update 5\r\nWindows Phone SDK 8.0 (Installed with Visual Studio)\r\nWindows Phone Emulator 8.1 ENU\r\nWindows Phone Emulator 8.1 SDK and Emulators\r\nHyper-V Enabled", "closedSprints": [ { "id": 580, "state": "closed", "name": "2016 Sprint 3 SDK", "startDate": "2016-01-30T01:31:48.991Z", "endDate": "2016-02-13T01:31:00.000Z", "completeDate": "2016-02-15T05:32:40.725Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "375081", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "When I tested this, I see:\r\n{code}\r\n[DEBUG] Installing sql database \"/db.sqlite\" with name \"category\"\r\n[ERROR] Application Error: {\r\n[ERROR] \"line\": 2,\r\n[ERROR] \"column\": 10,\r\n[ERROR] \"message\": \"Error while require(/app) Error while require(alloy/models/Category) config.adapter.idAttribute \\\"id\\\" not found in list of columns for table \\\"category\\\"\\ncolumns: []\",\r\n[ERROR] \"native_stack\": [\r\n[ERROR] \"JSExportClass::CallNamedFunction\"\r\n[ERROR] ]\r\n[ERROR] }\r\n{code}\r\n\r\nWhich suggests to me that the database installation isn't working properly in this case here. I'll have to dig deeper and find out why...", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-01-21T18:39:20.000+0000", "updated": "2016-01-21T18:39:20.000+0000" }, { "id": "375083", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Looks to me like this may be because we return a non-null/undefined return value for the Db.execute call here:\r\n{code:javascript}\r\nTi.API.debug('Installing sql database \"' + dbFile + '\" with name \"' + dbName + '\"');\r\n var db = Ti.Database.install(dbFile, dbName);\r\n if (false === config.adapter.remoteBackup && false) {\r\n Ti.API.debug('iCloud \"do not backup\" flag set for database \"' + dbFile + '\"');\r\n db.file.setRemoteBackup(false);\r\n }\r\n var rs = db.execute('pragma table_info(\"' + table + '\");');\r\n{code}\r\nIf we return an empty result set rather than null/undefined for the `rs` variable, the Alloy code will basically end up gathering no columns and error in a way that I'm seeing.\r\n\r\nI also used the Windows Phone Power Tools and saw that the database file existed but was 0 bytes. So I think the database file is getting created (so the Db.install looks like it's working).\r\n\r\n", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-01-21T18:59:38.000+0000", "updated": "2016-01-21T18:59:38.000+0000" }, { "id": "375085", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "[~AlbWebbergate] Do you actually have a {{db.sqlite}} database file you use to pre-populate the category database with? It's mentioned in the db_file value, but wasn't sure if you had that file in your app, or were just relying on behavior to effectively ignore that it doesn't exist?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-01-21T19:07:14.000+0000", "updated": "2016-01-21T19:07:14.000+0000" }, { "id": "375094", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Looks like Android has special code to explicitly return null when a SELECT or PRAGMA is issued and has 0 columns in the result: https://github.com/appcelerator/titanium_mobile/blob/bc85170157d3bebc5de1d61a9fe6e34bce84a8c9/android/modules/database/src/java/ti/modules/titanium/database/TiDatabaseProxy.java#L125", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-01-21T20:04:36.000+0000", "updated": "2016-01-21T20:04:36.000+0000" }, { "id": "375146", "author": { "name": "AlbWebbergate", "key": "albwebbergate", "displayName": "Alberto Bonacina", "active": true, "timeZone": "Europe/Rome" }, "updateAuthor": { "name": "AlbWebbergate", "key": "albwebbergate", "displayName": "Alberto Bonacina", "active": true, "timeZone": "Europe/Rome" }, "created": "2016-01-22T08:58:14.000+0000", "updated": "2016-01-22T08:59:01.000+0000" }, { "id": "375158", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/536", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-01-22T17:53:34.000+0000", "updated": "2016-01-22T17:53:34.000+0000" }, { "id": "386718", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified using: \r\n\r\nWindows 10 Pro \r\nVisual Studio 2015 Community Update 2 \r\nAppc Core: 5.3.0-46 \r\nAppc NPM: 4.2.5-5 \r\nTi SDK: 5.3.0.v20160523083840\r\nLumia 520 8.1, Lumia 930 10.0\r\n\r\nWhen executing pragma table_info(\"table_name\") on a table with no rows the value returned is now null rather than being an empty Ti.Database.ResultSet. Tested classic using the code below and Alloy using the code provided in description\r\n\r\n{code}\r\nvar db = Ti.Database.install(\"made.up.sqlite\", \"category\");\r\nvar rows = db.execute('pragma table_info(\"category\");');\r\nTi.API.info(rows === null);\r\ndb.remove();\r\n{code}\r\n\r\nClosing ticket", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2016-05-25T02:27:47.000+0000", "updated": "2016-05-25T02:28:12.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }