[eluser]Shiro[/eluser]
Today I found out a bug in Active Record,
I am using mysql as my db.
CI tread the join first parameter always table id link with another table id
E.g
Code:
$this->db->join('comments', 'comments.id = blogs.id');
in this case, shouldn't be a problem, because CI will auto append ` to the condition
become:
Quote:JOIN comments ON `comments`.`id` = `blogs`.`id`
but today I got a case, which is I don't have any id linking with the table, (For a reason I do that).
Code:
$this->db->join('marketing', 'marketing.status = "active", 'left');
the output become
Quote:JOIN marketing ON `marketing`.`status` = "`active"`
which give me database error.
now I need to do
Code:
$this->db->join('marketing', 'marketing.status = marketing.status AND marketing.status = "active", 'left');
Quote:JOIN marketing ON `marketing`.`status` = `marketing`.`status` AND `marketing`.`status` = "active"
then this will solve my problem,
I think CI should detect first b4 add the `` or add another parameter at the end, allow user escape it
#2
Bug 2
I would like to code like this for better viewing, I put the AND condition next line
Code:
$this->db->join('comments', 'comments.id = blogs.id
AND comments.status = "active"');
in this case, it will have another bug. The outcome
Quote:JOIN comments ON `comments`.`id` = `blogs`.`id
` AND `comments`.`status` = "active"
as you can see, it become db error
Quote:`id <next line>
`