{ "id": "115847", "key": "ALOY-705", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2014-01-20T22:10:23.000+0000", "created": "2013-06-12T20:21:56.000+0000", "priority": null, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:25:51.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13605", "name": "Models" }, { "id": "12332", "name": "Titanium SDK", "description": "Any integration or issues with the TiSDK" } ], "description": "Unfortunately it is currently not possible to read a single Model via the SQL sync adapter, only to read the whole table/collection.\r\n\r\nIn the official Backbone sync adapter it is possible to read an object by its ID:\r\n{code}\r\nvar mode = Alloy.createModel('Tony', {\r\n id: '121'\r\n});\r\nmodel.fetch();\r\n{code}\r\n\r\nA simple fix is possible afaik:\r\n/lib/alloy/sync/sql.js, line 200\r\n{code}\r\nvar sql;\r\n// If a query is provided\r\nif(opts.query)\r\n sql = opts.query;\r\n// If we are fetching a single Model\r\nelse if (model.id)\r\n sql = {\r\n statement: \"SELECT * FROM \" + table + \" WHERE \" + model.idAttribute + \" = ?\",\r\n params: model.id\r\n };\r\n// If we are fetching a Collection\r\nelse\r\n sql = \"SELECT * FROM \" + table;\r\n{code}", "attachment": [], "flagged": false, "summary": "Add possibility to read a Model by its ID in the SQLite sync adapter", "creator": { "name": "timanrebel", "key": "timanrebel", "displayName": "Timan Rebel", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "257556", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Moving this to Alloy team for feature implementation. ", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-06-13T05:24:04.000+0000", "updated": "2013-06-13T05:24:04.000+0000" }, { "id": "288894", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I believe this is a duplicate of ALOY-829, but can re-open if it does not cover the exact case discussed here.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-20T22:10:23.000+0000", "updated": "2014-01-20T22:10:23.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }