{"action":"created","issue":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4910","repository_url":"https://api.github.com/repos/bcit-ci/CodeIgniter","labels_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4910/labels{/name}","comments_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4910/comments","events_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4910/events","html_url":"https://github.com/bcit-ci/CodeIgniter/pull/4910","id":189314793,"number":4910,"title":"Support array parse in DB_query_builder::where/having","user":{"login":"tianhe1986","id":19562319,"avatar_url":"https://avatars.githubusercontent.com/u/19562319?v=3","gravatar_id":"","url":"https://api.github.com/users/tianhe1986","html_url":"https://github.com/tianhe1986","followers_url":"https://api.github.com/users/tianhe1986/followers","following_url":"https://api.github.com/users/tianhe1986/following{/other_user}","gists_url":"https://api.github.com/users/tianhe1986/gists{/gist_id}","starred_url":"https://api.github.com/users/tianhe1986/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tianhe1986/subscriptions","organizations_url":"https://api.github.com/users/tianhe1986/orgs","repos_url":"https://api.github.com/users/tianhe1986/repos","events_url":"https://api.github.com/users/tianhe1986/events{/privacy}","received_events_url":"https://api.github.com/users/tianhe1986/received_events","type":"User","site_admin":false},"labels":[{"id":140925,"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/labels/Feature%20Request","name":"Feature Request","color":"0b02e1","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-15T07:00:48Z","updated_at":"2016-11-16T11:29:35Z","closed_at":"2016-11-16T10:15:13Z","pull_request":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/pulls/4910","html_url":"https://github.com/bcit-ci/CodeIgniter/pull/4910","diff_url":"https://github.com/bcit-ci/CodeIgniter/pull/4910.diff","patch_url":"https://github.com/bcit-ci/CodeIgniter/pull/4910.patch"},"body":"Support the following use.\r\n\r\n```\r\n$this->db->where('type', array(8, 9, 10));\r\n$this->db->where('account IN', array('account751000872', 'account781000967'));\r\n$this->db->where('phone_num NOT IN', array('13800000000'));\r\n```\r\n\r\nAND\r\n\r\n```\r\n$this->db->select('channel_id, count(1) as num');\r\n$this->db->group_by('channel_id');\r\n$this->db->having('num IN ', array(88, 888));\r\n```\r\n\r\nIndeed, I could use `where_in` and `where_not_in` in the first case. However, sometimes I prefer to use as follows.\r\n\r\n```\r\n$where = array('type' => 10, \r\n\t\t\t'account IN' => array('account751000872', 'account781000967'), \r\n                        'login_token NOT IN' => array('13800000000')\r\n                 );\r\n$this->db->where($where);\r\n```\r\n\r\nThe same with `having`."},"comment":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/comments/260923255","html_url":"https://github.com/bcit-ci/CodeIgniter/pull/4910#issuecomment-260923255","issue_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4910","id":260923255,"user":{"login":"tianhe1986","id":19562319,"avatar_url":"https://avatars.githubusercontent.com/u/19562319?v=3","gravatar_id":"","url":"https://api.github.com/users/tianhe1986","html_url":"https://github.com/tianhe1986","followers_url":"https://api.github.com/users/tianhe1986/followers","following_url":"https://api.github.com/users/tianhe1986/following{/other_user}","gists_url":"https://api.github.com/users/tianhe1986/gists{/gist_id}","starred_url":"https://api.github.com/users/tianhe1986/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tianhe1986/subscriptions","organizations_url":"https://api.github.com/users/tianhe1986/orgs","repos_url":"https://api.github.com/users/tianhe1986/repos","events_url":"https://api.github.com/users/tianhe1986/events{/privacy}","received_events_url":"https://api.github.com/users/tianhe1986/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T11:29:35Z","updated_at":"2016-11-16T11:29:35Z","body":">>> I kind of get the feeling you'd want to add that only for the sake of having it, as opposed to a real need\r\n\r\n>> No, In my project, I gather inputs from page as searching key and value, which are then put into one array . It would be more convenient if I could just use this array as the input for where(), but now I need to loop the array, check the value type and determine which one should I use, where() or where_in().\r\n\r\n> I meant that for having_in() and having_not_in(). :)\r\n\r\nOh  yes, you are quite right. It is just a possibility, forget it. :)"}}
{"actor":{"display_login":"tianhe1986"}}