{"action":"created","issue":{"url":"https://api.github.com/repos/textpattern/textpattern/issues/722","repository_url":"https://api.github.com/repos/textpattern/textpattern","labels_url":"https://api.github.com/repos/textpattern/textpattern/issues/722/labels{/name}","comments_url":"https://api.github.com/repos/textpattern/textpattern/issues/722/comments","events_url":"https://api.github.com/repos/textpattern/textpattern/issues/722/events","html_url":"https://github.com/textpattern/textpattern/pull/722","id":164239152,"number":722,"title":"Allow AND/OR in WHERE clause of safe_upsert (+ useless spaces deleted)","user":{"login":"NicolasGraph","id":5238487,"avatar_url":"https://avatars2.githubusercontent.com/u/5238487?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolasGraph","html_url":"https://github.com/NicolasGraph","followers_url":"https://api.github.com/users/NicolasGraph/followers","following_url":"https://api.github.com/users/NicolasGraph/following{/other_user}","gists_url":"https://api.github.com/users/NicolasGraph/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasGraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasGraph/subscriptions","organizations_url":"https://api.github.com/users/NicolasGraph/orgs","repos_url":"https://api.github.com/users/NicolasGraph/repos","events_url":"https://api.github.com/users/NicolasGraph/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasGraph/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2016-07-07T06:33:26Z","updated_at":"2018-03-03T10:37:21Z","closed_at":"2016-07-21T06:51:18Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/textpattern/textpattern/pulls/722","html_url":"https://github.com/textpattern/textpattern/pull/722","diff_url":"https://github.com/textpattern/textpattern/pull/722.diff","patch_url":"https://github.com/textpattern/textpattern/pull/722.patch"},"body":"As said [here](http://forum.textpattern.com/viewtopic.php?id=47170), the following code does not work.\n\n```\nsafe_upsert(\n    'txp_lang', \n    'data = \"My data\", event = \"public\"',\n    'name = \"my_data\" AND lang = \"en-gb\"'\n)\n```\n\nThe problem is that on `INSERT`, the `WHERE` clause is simply added to the set clause and throw that:\n\n`[SQL: INSERT INTO txp_lang SET name = 'my_data' AND lang = 'en-gb', data = 'My data', event = 'public' ]`\n\n…It keeps the `AND.`\n\nI know that all `WHERE` clauses won't work with `safe_upsert` but can't we allow the use of `AND` (and `OR`?) like so (or in another better way). `OR` could work if the two columns are different.\n"},"comment":{"url":"https://api.github.com/repos/textpattern/textpattern/issues/comments/370137585","html_url":"https://github.com/textpattern/textpattern/pull/722#issuecomment-370137585","issue_url":"https://api.github.com/repos/textpattern/textpattern/issues/722","id":370137585,"user":{"login":"bloatware","id":11578435,"avatar_url":"https://avatars2.githubusercontent.com/u/11578435?v=4","gravatar_id":"","url":"https://api.github.com/users/bloatware","html_url":"https://github.com/bloatware","followers_url":"https://api.github.com/users/bloatware/followers","following_url":"https://api.github.com/users/bloatware/following{/other_user}","gists_url":"https://api.github.com/users/bloatware/gists{/gist_id}","starred_url":"https://api.github.com/users/bloatware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloatware/subscriptions","organizations_url":"https://api.github.com/users/bloatware/orgs","repos_url":"https://api.github.com/users/bloatware/repos","events_url":"https://api.github.com/users/bloatware/events{/privacy}","received_events_url":"https://api.github.com/users/bloatware/received_events","type":"User","site_admin":false},"created_at":"2018-03-03T10:37:21Z","updated_at":"2018-03-03T10:37:21Z","author_association":"MEMBER","body":"It should work with `AND` arrays as [suggested](https://github.com/textpattern/textpattern/pull/722#issuecomment-231193887) by Ruud."}}
{"actor":{"display_login":"bloatware"}}