Titanium JIRA Archive
Alloy (ALOY)

[ALOY-952] Non numeric primary key not escaped during query

GitHub Issuen/a
TypeBug
PriorityLow
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-08-19T13:19:50.000+0000
Affected Version/sAlloy 1.3.0
Fix Version/sn/a
ComponentsModels
Labelsalloy
Reporterwahyudinata setiawan
AssigneeFeon Sua Xin Miao
Created2014-02-07T00:21:45.000+0000
Updated2014-08-19T13:19:50.000+0000

Description

I am having a weird issue with alloy model generating an unescaped query, even though it uses prepared statement. To recreate it: 1. Create a model with a non integer primary key. 2. Do a simple model.fetch({id: "your_text_id"}); It will generate a query like so: SELECT * FROM table_name WHERE some_primary_key = your_text_id where you would expect something like the following: SELECT * FROM table_name WHERE some_primary_key = 'your_text_id' quoted from: http://developer.appcelerator.com/question/162301/weird-sqlite-escaping-issue

Attachments

FileDateSize
aloy-952-test.zip2014-08-06T08:34:11.000+00005907153

Comments

  1. Ritu Agrawal 2014-02-07

    Moving this ticket to engineering based on Tony's comment in the Q&A thread included in this ticket.
  2. Feon Sua Xin Miao 2014-08-06

    Tested using attached sample app on Alloy 1.3.0 and 1.4.1. Can't reproduce the issue on v1.4.1.
       	config: {
       		columns: {
       		    "name": "TEXT",
       		    "countryId": "TEXT PRIMARY KEY"
       		},
       		adapter: {
       			type: "sql",
       			collection_name: "countries",
       			idAttribute: "countryId"
       		}
       	},
       
       model.fetch({id:'SIN'});
       
  3. Tim Poulsen 2014-08-19

    Marking as failed because there doesn't seem to be a way to cancel a review.
  4. Tim Poulsen 2014-08-19

    We are not able to reproduce the issue. Perhaps an intervening change since 1.3.0 has resolved this issue. Please comment here if this remains an issue for you. If you do so, please make sure there's a sample app attached that demonstrates the problem.

JSON Source