{ "id": "60998", "key": "TIMOB-366", "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": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-07-25T13:04:32.000+0000", "created": "2011-04-15T02:28:01.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "arguments", "database", "execute", "ios", "patch" ], "versions": [], "issuelinks": [ { "id": "19168", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94532", "key": "TIMOB-9901", "fields": { "summary": "TiAPI: Review and clean up platform bugs and reduce bug count by 20%.", "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": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-28T16:33:46.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

.execute(sql, args) currently does not support .execute(string,\narray), which would come in very handy in certain cases. As I\nunderstand, the Desktop version already supports that way of\ncalling execute, at least when I read the comments in Ticket 146\n(https://appcelerator.lighthouseapp.com/projects/25719/tickets/146)\nin Titanium Desktop. So it should be doable.

{html}", "attachment": [ { "id": "17852", "filename": "execute.patch", "author": { "name": "johannrichard", "key": "johannrichard", "displayName": "Johann Richard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:28:02.000+0000", "size": 839, "mimeType": "text/plain" } ], "flagged": false, "summary": "Titanium.Database.execute should support indexed arguments in an array ", "creator": { "name": "johannrichard", "key": "johannrichard", "displayName": "Johann Richard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "johannrichard", "key": "johannrichard", "displayName": "Johann Richard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "123172", "author": { "name": "johannrichard", "key": "johannrichard", "displayName": "Johann Richard", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

And here's a (possible) patch to implement this behaviour:

\n
\ndiff --git a/iphone/modules/DatabaseModule/DatabaseModule.m b/iphone/modules/DatabaseModule/DatabaseModule.m\nindex 33702c0..24b901a 100644\n--- a/iphone/modules/DatabaseModule/DatabaseModule.m\n+++ b/iphone/modules/DatabaseModule/DatabaseModule.m\n@@ -293,7 +293,8 @@\n                \"remove:function(){Ti.Database._RMDB(this._TOKEN);},\"\n                \"execute:function(query){\"\n                    \"var args=[];\"\n-                   \"for(var i=1;i<arguments.length;i++){args.push(arguments[i]);}\"\n+                   \"for(var i=1;i<arguments.length;i++){if((arguments[i]).constructor == Array){\"\n+                   \"args.concat(arguments[i]);} else {args.push(arguments[i]);}}\"\n                    \"var comm=Ti.Database._EXEDB(this._TOKEN,query,args);this.rowsAffected=comm.rowsAffected;this.lastInsertRowId=comm.lastRow;\"\n                    \"var res={_TOKEN:comm.token,\"\n                        \"fields:comm.fields,rowCount:comm.rowCount,values:comm.values,\"\n
\n

-- maybe you want it to be even more robust but it should\nactually implement more or less the behaviour of the Desktop\nvariant of Titanium. At least my tests on the iPhone plus the\nDB-related Unit tests in the titanium_mobile \"Titanium\" App did not\nshow any isses w/ that patch when I custom built the SDK.

{html}", "updateAuthor": { "name": "johannrichard", "key": "johannrichard", "displayName": "Johann Richard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:28:02.000+0000", "updated": "2011-04-15T02:28:02.000+0000" }, { "id": "123173", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Need to discuss in R&D for feature parity, but if this\nexists in Desktop, then it should probably exist for mobile.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:28:03.000+0000", "updated": "2011-04-15T02:28:03.000+0000" }, { "id": "209380", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is already fixed. See the doc [here|http://docs.appcelerator.com/titanium/2.1/#!/api/Titanium.Database.DB-method-execute].", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-25T13:04:04.000+0000", "updated": "2012-07-25T13:04:04.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }