• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ActiveRecord, Like, ESCAPE problem

#1
[eluser]Unknown[/eluser]
Hi everyone,

I have a small problem with like.

this code:
Code:
$this->db->select('generic_file.name, generic_file.uid')
             ->from('generic_file')
             ->where('generic_file.folder', 'results')
             ->like('generic_file.name', $search_text);

generates this query when searching for text with _, % characters in it(searched a_ in this example):

Code:
SELECT "vav"."generic_file"."name", "vav"."generic_file"."uid"
FROM "vav"."generic_file"
WHERE "vav"."generic_file"."folder" =  'results'
AND  "vav"."generic_file"."name"  LIKE '%a!!_%' ESCAPE '!'


where obviously there should be only one exclamation mark.
Am I doing something wrong?

I am running the latest CodeIgniter version and PostgreSQL 9.1 database


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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