{"action":"created","issue":{"url":"https://api.github.com/repos/spider/spider/issues/23","labels_url":"https://api.github.com/repos/spider/spider/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/spider/spider/issues/23/comments","events_url":"https://api.github.com/repos/spider/spider/issues/23/events","html_url":"https://github.com/spider/spider/issues/23","id":97815565,"number":23,"title":"Include value binding features to DriverInterface","user":{"login":"PommeVerte","id":1415875,"avatar_url":"https://avatars.githubusercontent.com/u/1415875?v=3","gravatar_id":"","url":"https://api.github.com/users/PommeVerte","html_url":"https://github.com/PommeVerte","followers_url":"https://api.github.com/users/PommeVerte/followers","following_url":"https://api.github.com/users/PommeVerte/following{/other_user}","gists_url":"https://api.github.com/users/PommeVerte/gists{/gist_id}","starred_url":"https://api.github.com/users/PommeVerte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PommeVerte/subscriptions","organizations_url":"https://api.github.com/users/PommeVerte/orgs","repos_url":"https://api.github.com/users/PommeVerte/repos","events_url":"https://api.github.com/users/PommeVerte/events{/privacy}","received_events_url":"https://api.github.com/users/PommeVerte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spider/spider/milestones/2","html_url":"https://github.com/spider/spider/milestones/v0.4%20-%20Full%20Command%20Builder","labels_url":"https://api.github.com/repos/spider/spider/milestones/2/labels","id":1219151,"number":2,"title":"v0.4 - Full Command Builder","description":"The Full Command Builder extends the Basic Command Builder by adding declarative traversals, nested queries, and a solution for the n+1 problem (building a query that fetches a post with all its comments in one query).\r\n\r\nThe Full Command Builder also introduces that the user can specify how they want the result formatted (e.g. `tree`, `flat`, etc).\r\n\r\nLay foundation for Models/Graphs\r\n\r\nTop-level Spider\\Spider Api","creator":{"login":"chrismichaels84","id":5412413,"avatar_url":"https://avatars.githubusercontent.com/u/5412413?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismichaels84","html_url":"https://github.com/chrismichaels84","followers_url":"https://api.github.com/users/chrismichaels84/followers","following_url":"https://api.github.com/users/chrismichaels84/following{/other_user}","gists_url":"https://api.github.com/users/chrismichaels84/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismichaels84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismichaels84/subscriptions","organizations_url":"https://api.github.com/users/chrismichaels84/orgs","repos_url":"https://api.github.com/users/chrismichaels84/repos","events_url":"https://api.github.com/users/chrismichaels84/events{/privacy}","received_events_url":"https://api.github.com/users/chrismichaels84/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2015-07-21T21:32:06Z","updated_at":"2015-07-31T15:00:37Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-07-28T22:32:01Z","updated_at":"2015-08-03T13:43:10Z","closed_at":null,"body":"Binding values to queries in order to prevent injections is going to be a common feature of all databases and driver clients. We should add functionality around these in `DriverInterface`\r\n\r\nSomething along the lines of:\r\n\r\n```php\r\n/**\r\n * @return void\r\n */\r\npublic function bindValue(string $name, $value);\r\n\r\n/**\r\n * @return void\r\n */\r\npublic function bindValues(array $binds);\r\n\r\n/**\r\n * @return array (key/value)\r\n */\r\npublic function getBinds();\r\n```\r\n\r\nThe discussion around binds can be much larger. We will need to settle on a consistent bindpattern (`{var}`, `B_VAR`, etc.) for `Command` and then it would be the `CommandProcessor`'s job to correctly format the binds to whichever language and pass them to the driver."},"comment":{"url":"https://api.github.com/repos/spider/spider/issues/comments/127238325","html_url":"https://github.com/spider/spider/issues/23#issuecomment-127238325","issue_url":"https://api.github.com/repos/spider/spider/issues/23","id":127238325,"user":{"login":"chrismichaels84","id":5412413,"avatar_url":"https://avatars.githubusercontent.com/u/5412413?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismichaels84","html_url":"https://github.com/chrismichaels84","followers_url":"https://api.github.com/users/chrismichaels84/followers","following_url":"https://api.github.com/users/chrismichaels84/following{/other_user}","gists_url":"https://api.github.com/users/chrismichaels84/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismichaels84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismichaels84/subscriptions","organizations_url":"https://api.github.com/users/chrismichaels84/orgs","repos_url":"https://api.github.com/users/chrismichaels84/repos","events_url":"https://api.github.com/users/chrismichaels84/events{/privacy}","received_events_url":"https://api.github.com/users/chrismichaels84/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T13:43:10Z","updated_at":"2015-08-03T13:43:10Z","body":"I actually came to the same conclusion last night as I was getting ready for bed. I don't mind a Driver relying on its own LanguageProcessor, so long as the end user doesn't have to know what's happening. I never intended for the `Driver` to pass the binds. It should only send completed commands in a specific language and return results. Single responsibility.\r\n\r\nFor what its worth, `:values` may not work with Orient because the record ids `@rid` are in the format `#12:2` and I feel it would be too easy to regex replace the wrong bit in weird cases.\r\n\r\nI am in favor of `{{values}}`. We can give it some options.\r\n\r\n`{{keys}}` -> `name, ship`\r\n`{{values}}` -> `Malcom Reynolds, Serenity`\r\n`{{data}}` -> used in `foreach` by the processor in whatever way is appropriate\r\n\r\nMaybe even\r\n`{{values(json)}}` -> `{name: \"Malcom Reynolds\", ship: \"Serenity\"}}`\r\n\r\nThough this may be extra sugar that'll just slow performance"}}