Welcome Guest, Not a member yet? Register   Sign In
CI 1.7.1: No escaping of table name
#1

[eluser]davidbehler[/eluser]
I do the following:
Code:
$this->db->select('*');
$this->db->select('(SELECT COUNT(*) FROM user_group WHERE user_group_group_id = group_id) AS user_count', FALSE);
$this->db->order_by('group_name', 'asc');
$result = $this->db->get('group');
The generated query is
Code:
SELECT *, (SELECT COUNT(*) FROM user_group WHERE user_group_group_id = group_id) AS user_count FROM (group) ORDER BY group_name asc

That produces an error caused by the not escaped table name 'group'.

BUT as soon as I leave out the custom select part like this:
Code:
$this->db->select('*');
$this->db->order_by('group_name', 'asc');
$result = $this->db->get('group');
It works fine and the query looks like this:
Code:
SELECT * FROM (`group`) ORDER BY `group_name` asc

As you can see in my second example the table name is escaped just as it should be.

Am I missing something or is this a bug caused by the 'do not escape' parameter of the select method?


Messages In This Thread
CI 1.7.1: No escaping of table name - by El Forum - 04-01-2009, 01:21 PM
CI 1.7.1: No escaping of table name - by El Forum - 04-13-2009, 08:26 AM
CI 1.7.1: No escaping of table name - by El Forum - 04-13-2009, 08:46 AM
CI 1.7.1: No escaping of table name - by El Forum - 04-13-2009, 08:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB