[ALOY-987] Alloy : Shorthand for fetch() don't work correctly using default alloy_id

GitHub Issuen/a
Resolution Date2014-04-11T17:30:44.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.4.0, 2014 Sprint 07
LabelsAlloy, qe-testadded, query, sqlite
ReporterReymundo López
AssigneeTim Poulsen


Related to ALOY-829. When trying to get a collection using the id shorthand and in the model you don't have an idAttribute configuration set, the adapter throws an exception because the idAttribute is undefined. Also need to add the validation if id value is string, because the alloy_id values are guid's strings.
 myCollection.fetch({ id: "8395dda4-b998-07cb-baaf-3dd071329dc9" });
[ERROR]     nativeReason = "Error Domain=com.plausiblelabs.pldatabase Code=3 \"An error occured parsing the provided SQL statement.\" UserInfo=0xcec2b20 {com.plausiblelabs.pldatabase.error.vendor.code=1, NSLocalizedDescription=An error occured parsing the provided SQL statement., com.plausiblelabs.pldatabase.error.query.string=SELECT * FROM paymentOption WHERE undefined = 8395dda4-b998-07cb-baaf-3dd071329dc9, com.plausiblelabs.pldatabase.error.vendor.string=unrecognized token: \"8395dda4\"}";




  1. Ritu Agrawal 2014-04-09 Please provide a simple runnable test case to reproduce this issue.
  2. Reymundo López 2014-04-10 Simple example that add models to the DB, shows the models in a TableView and when the user click in one row and do the {noformat}fetch.({ id : id }){noformat} error shows
  3. Tim Poulsen 2014-04-11 PR is https://github.com/appcelerator/alloy/pull/359 I've tested and the PR solves the issue and passes all tests. Ready to be merged. Functional test: run the AlloyIDTest app attached to this ticket. Tap any row in the table. The alert should show the collection length to be 1. No errors should be output.
  4. Lokesh Choudhary 2014-05-14 Verified the fix. Clicking on the table rows show's the collection length to be 1. Closing. Environment: Appc Studio : Ti SDK : 3.3.0.v20140513191712 Mac OSX : 10.8.5 Alloy : 1.4.0-dev CLI - 3.3.0-dev Nexus 5 - android 4.4.2 Iphone 5S - iOS 7.1

JSON Source