Active Record Class - MORE SUPPORT |
[eluser]Cong Do[/eluser]
Hi is there any new function for the Active Record Class, in the new release. like wherein wherenot wherenotin Regards, Cong Do
[eluser]Seppo[/eluser]
It´s already on the SVN repository. http://dev.ellislab.com/svn/CodeIgniter/...ve_rec.php where_in Where_in_or where_not_in where_not_in_or "where not" is not implement. I´m not sure if it´s usefull..
[eluser]Cong Do[/eluser]
Dam should have read this a bit earlyer. where not, is already inplemented as where("key !=","val"). I just made my own ones, the difference is that you don't need to use where_in, where_in_or, where_not_in or where_not_in_or. But just where and whereor . function _where($key, $value = NULL, $type = 'AND ') { if ( ! is_array($key)) { $key = array($key => $value); } foreach ($key as $k => $v) { $prefix = (count($this->ar_where) == 0) ? '' : $type; if ( ! is_null($v)) { if(is_array($v)) { if ( ! $this->_has_operator($k)) { $k .= ' IN'; } foreach($v as $kx=>$vx) { $v[$kx] = ' '.$this->escape($vx); } $v= ' ('.implode(', ',$v).') '; } else { if ( ! $this->_has_operator($k)) { $k .= ' ='; } $v = ' '.$this->escape($v); } } $this->ar_where[] = $prefix.$k.$v; } return $this; } function _has_operator($str) { $str = trim($str); if ( ! preg_match("/(\s|<|>|!|=|is null|is not null|in|not in)/i", $str)) { return FALSE; } return TRUE; } Regards, Cong Do |
Welcome Guest, Not a member yet? Register Sign In |