Stop Escaping in Active Record LIKE method.

#1
[eluser]Unknown[/eluser]
I'm trying to use Active Records 'like' DB method to perform a select query, but my LIKE "match" has underscores and %. This is my statement:

Code:
$query = $this->db->select('f.asset_id, f.file_path')
    ->from('exp_assets f')
    ->like('f.file_path','{filedir_%}/', 'after')
    //->limit($limit, $start)
    ->get();

The trouble I'm having is that ActiveRecord is escaping the underscores and % prefixing them with backslashes which results in the SELECt statement becoming incorrect.

Code:
SELECT `f`.`asset_id`, `f`.`file_path`
FROM (`exp_assets` f)
WHERE  `f`.`file_path`  LIKE '{filedir\_\%}/%'

Is there any way to correct for this behavior? I've already tried setting the optional parameter on the SELECT method to set escaping to FALSE, but that only removed the backticks from the select and did not impace the escaping in the LIKE portion of my statement.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.