{"action":"created","issue":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/291","labels_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/291/labels{/name}","comments_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/291/comments","events_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/291/events","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/291","id":82968175,"number":291,"title":"Dapper will not throw when a param is missing but has the same name as a column.","user":{"login":"ofirgeller","id":4271135,"avatar_url":"https://avatars.githubusercontent.com/u/4271135?v=3","gravatar_id":"","url":"https://api.github.com/users/ofirgeller","html_url":"https://github.com/ofirgeller","followers_url":"https://api.github.com/users/ofirgeller/followers","following_url":"https://api.github.com/users/ofirgeller/following{/other_user}","gists_url":"https://api.github.com/users/ofirgeller/gists{/gist_id}","starred_url":"https://api.github.com/users/ofirgeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofirgeller/subscriptions","organizations_url":"https://api.github.com/users/ofirgeller/orgs","repos_url":"https://api.github.com/users/ofirgeller/repos","events_url":"https://api.github.com/users/ofirgeller/events{/privacy}","received_events_url":"https://api.github.com/users/ofirgeller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-31T01:51:34Z","updated_at":"2015-06-01T09:32:47Z","closed_at":null,"body":"When a query has a param that shares the name of one of the columns, even when the param is missing the query runs without throwing, I think this is a dangerous thing to do.\r\n\r\nexample: \r\n\r\n          var args = new List<ParamClass> { new ParamClass { bad_name_id = 1, name = \"mono\" } };\r\n\r\n           conn.Execute(\"DELETE FROM test WHERE id = @id AND name = @name\",args);\r\n\r\nHere records that match the second predict will be deleted because the first predicate ends up being\r\n \" id = id \"and not \" id =  And  \" (bad syntax exception, correct thing to do IMHO).\r\n\r\nIs there a use case I am missing here for indicating a column name this way?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/comments/107380582","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/291#issuecomment-107380582","issue_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/291","id":107380582,"user":{"login":"mgravell","id":17328,"avatar_url":"https://avatars.githubusercontent.com/u/17328?v=3","gravatar_id":"","url":"https://api.github.com/users/mgravell","html_url":"https://github.com/mgravell","followers_url":"https://api.github.com/users/mgravell/followers","following_url":"https://api.github.com/users/mgravell/following{/other_user}","gists_url":"https://api.github.com/users/mgravell/gists{/gist_id}","starred_url":"https://api.github.com/users/mgravell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgravell/subscriptions","organizations_url":"https://api.github.com/users/mgravell/orgs","repos_url":"https://api.github.com/users/mgravell/repos","events_url":"https://api.github.com/users/mgravell/events{/privacy}","received_events_url":"https://api.github.com/users/mgravell/received_events","type":"User","site_admin":false},"created_at":"2015-06-01T09:32:47Z","updated_at":"2015-06-01T09:32:47Z","body":"I'm not sure I can do much about this in the general case; I can't parse every variant of SQL, and even if I could, things like:\r\n\r\n    declare @foo int = 42;\r\n\r\nis not a parameter (it is a local variable, although it could also represent a table-variable), and\r\n\r\n    where table.Bar = 42 -- @bar - note: now hard coded, see v1.2 release notes\r\n\r\nexists (kind of) in the SQL, but does not need to be added to the parameters (because it is in a comment)\r\n\r\nI'm open to ideas, but I can't see how dapper could do anything different here."}}