Welcome Guest, Not a member yet? Register   Sign In
Active Record and Protect Identifiers
#1

[eluser]davetao[/eluser]
Hello guys,

My team and I have come across this very peculiar problem related to escaped query parameters

Here is the test case;

$this->db->select('mytitle', FALSE)->get('mytable');
$this->db->select('order')->get('mytable');
# creates the error because 'order' is not escaped automatically.

Looking at the active record code, i have found this...

function select($select = '*', $escape = NULL)
{
// Set the global value if this was sepecified
if (is_bool($escape))
{
$this->_protect_identifiers = $escape;
}
...

My question is this, is this feature a part of the codeigniter design or is it a bug because our assumption as developers, setting the $escape = FALSE should only run for that query, rather than for the entire page request.

Our solution was to RESET the protect_identifiers = TRUE after each query
#2

[eluser]Reneesh T K[/eluser]
I now faced the same issue and solved it by adding two lines on code to the select function.


You can see it at the following url:
http://myphplibrary.blogspot.in/2012/09/...-with.html




Theme © iAndrew 2016 - Forum software by © MyBB