[ALOY-987] Alloy : Shorthand for fetch() don't work correctly using default alloy_id
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-04-11T17:30:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.4.0, 2014 Sprint 07 |
Components | n/a |
Labels | Alloy, qe-testadded, query, sqlite |
Reporter | Reymundo López |
Assignee | Tim Poulsen |
Created | 2014-04-09T02:13:20.000+0000 |
Updated | 2014-06-22T13:21:21.000+0000 |
Description
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\"}";
Attachments
File | Date | Size |
---|---|---|
AlloyIDTest.zip | 2014-04-10T11:54:14.000+0000 | 5915701 |
Please provide a simple runnable test case to reproduce this issue.
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
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.
Verified the fix. Clicking on the table rows show's the collection length to be 1. Closing. Environment: Appc Studio : 3.3.0.201405121247 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