CodeIgniter Forums
Undefined Property with MSSQL and Active Records - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Undefined Property with MSSQL and Active Records (/thread-25746.html)



Undefined Property with MSSQL and Active Records - El Forum - 12-23-2009

[eluser]cemaleker[/eluser]
Trying to:

Code:
$search_query = $this->db->escape_like_str($search_query);
        $this->db->select($this->fields_to_select);
        $this->db->order_by($this->default_order);
        $this->db->where($this->default_where_array);
        $this->db->like('news_title', $search_query);
        $this->db->or_like('news_sum', $search_query);
        $data = $this->db->get($this->table_name, $limit, $offset);

Getting:

Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_DB_mssql_driver::$_like_escape_char
Filename: database/DB_active_rec.php
Line Number: 728

I'm gonna fix this by adding

Code:
$this->_like_escape_char = $this->_like_escape_chr;

to my extending DB class. Is this a bug. Or am I doing something wrong?


Undefined Property with MSSQL and Active Records - El Forum - 09-14-2010

[eluser]Unknown[/eluser]
It is a bug in DB_active_rec.php which is corrected in the newest version under http://bitbucket.org/ellislab/codeigniter

<code>
// some platforms require an escape sequence definition for LIKE wildcards
if ($this->_like_escape_str != '')
{
$like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
</code>

($this->_like_escape_char is replaced by $this->_like_escape_chr)