Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

3.0.0-dev: Query Builder, floating point values get wrongly escaped, at least in WHERE clause #2015

Closed
ivantcholakov opened this Issue Nov 20, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

ivantcholakov commented Nov 20, 2012

Within config/database.php I have

$db['default']['stricton'] = FALSE;

And this query works:

$result = $this->db
    ->select()
    ->from('products')
    ->where('price <=', '12.66') // <------ type string
    ->get_compiled_select();

var_dump($result);
// SELECT * FROM `products` WHERE `price` <= '12.66'

But this one is wrong and throws database error on execution:

$result = $this->db
    ->select()
    ->from('products')
    ->where('price <=', 12.66)  // <------ type float
    ->get_compiled_select();

var_dump($result);
// SELECT * FROM `products` WHERE `price` <= `12`.`66`

@narfbg narfbg added a commit that referenced this issue Nov 20, 2012

@narfbg narfbg Fix issue #2015 3a5efc2
Contributor

narfbg commented Nov 20, 2012

Fixed.

@narfbg narfbg closed this Nov 20, 2012

Contributor

ivantcholakov commented Nov 20, 2012

Yes, thank you.

@nonchip nonchip pushed a commit to nonchip/CodeIgniter that referenced this issue Jun 29, 2013

@narfbg narfbg Fix issue #2015 36ff02b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment