[eluser]Unknown[/eluser]
Hello,
I've recently started using CodeIgniter ( using version 2.1.3 ) and I'm still trying to get used to ActiveRecord.
And I'm hoping I can get a solution for the following issue I encountered:
For the following controller method:
Code:
public function test()
{
header( 'Content-type: text/plain' );
$this->db->db_debug = false;
$value = 'x y'; // two spaces between x and y
$this->db->select( 'id' )
->from( 'table' )
->where( '(column=' . $this->db->escape( $value ) .
( empty( $value ) ? ' OR column IS NULL)' : ')' ), null, false )
->get();
echo $this->db->last_query();
}
and the query looks like this:
Code:
SELECT `id`
FROM (`table`)
WHERE (column='x y')
there is only one blank space between x and y, instead of two ( same thing with CI 2.1.4 )
Can someone suggest a solution with Activerecord or do I have to stop using it and build all my queries without it?
Thanks,
Dorian