CodeIgniter Forums
Bug in Active Record - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Bug in Active Record (/showthread.php?tid=16637)



Bug in Active Record - El Forum - 03-12-2009

[eluser]Wades[/eluser]
this bug happens when we custom key/value method:

normally, if we use
Code:
$this->db->where('name !=', $name);
then we will get
Code:
// Produces: WHERE name != 'Joe'

but if we use
Code:
$this->db->where('name!=', $name);
(without space between name and !=)
we will get
Code:
// Produces: WHERE 'name!=''Joe'



Bug in Active Record - El Forum - 03-12-2009

[eluser]xwero[/eluser]
I don't think it's a bug, it's a convention to separate the 'weird' fieldnames from the operator.
Code:
function _has_operator($str)
    {
        $str = trim($str);
        if ( ! preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str))
        {
            return FALSE;
        }

        return TRUE;
    }