[eluser]darkhouse[/eluser]
I was having an issue with $this->db->having() not setting quotes to a string properly. I was doing:
Code:
$this->db->having('end_date >=', date('Y-m-d'));
And it would write the sql without quotes around the date, like
HAVING `end_date` >= 2010-10-14
which obviously doesn't work (doesn't throw an error, just doesn't do what you want).
Since the having and where functions of active record are quite similar, I decided to see what was causing the problem. I noticed that in DB_active_rec.php the _where method was using
Code:
$v = ' '.$this->escape($v);
but the _having method was using
Code:
$v = ' '.$this->escape_str($v);
The escape method (in DB_driver.php) checks to see if the data passed to it is a string, and if so calls escape_str(). I'm not sure why _having was set to use escape_str instead of escape, but I changed it to be the same as _where and it works how I intended so I thought I'd share.
Happy coding.