Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Record Join Multiple conditions #7

Closed
bitbucket-import opened this issue Aug 19, 2011 · 4 comments
Closed

Active Record Join Multiple conditions #7

bitbucket-import opened this issue Aug 19, 2011 · 4 comments
Milestone

Comments

@bitbucket-import
Copy link

If there is a JOIN with multiple conditions it does not escape everything

For example:
{{{

!php

->join('tasks', 'projects.id = tasks.project_id AND tasks.deleted=0', 'left')
}}}

does not add the table prefix to the condition tasks.deleted=0

@kewix
Copy link

kewix commented Aug 26, 2011

I have the same issue using postgre driver... please fix this one this a major bug !

@bkirkman
Copy link

Tim, thanks for addressing this issue. I think it might need some tweaking, or I am not implementing correctly. Using the above query as an example.

    $this->db->join('tasks', 'projects.id = tasks.project_id AND tasks.deleted=0', 'left')

will create a query string like

    LEFT JOIN `tasks` ON `projects`.`id` = `tasks`.`project_id` AND `tasks`.`deleted`=`0`

Protecting 0 causes a MySQL error. I'm not even sure if this type of case should be automatically handled in the join method. I would of course like it to be, but it might break some other case. For now, I'm just protecting identifiers long hand in the active record query itself, kind of like this post.

http://codeigniter.com/forums/viewthread/119846/#737096

@Dentxinho
Copy link
Contributor

This issue is related to #758 and if properly fixed may replace the solution given on #759.
Line 331 should match breaklines and tabs too.

@philsturgeon
Copy link
Contributor

This is being handled in #759.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants