After upgrade from 1.7.2 to 2.1, LEFT OUTER JOIN mysql query throws a syntax error |
[eluser]Webnet[/eluser]
With 1.7.2 this query works, after upgrading to 2.1 this query throws a syntax error. It seems as though on the first ->join() listed below it's changing (cf.products_id = p.products_id to cf.products_id = p.products_id but it leaves the old parenthesis in place. The result query currently is... Code: ... Notice all LEFT OUTER JOIN's have closing parenthesis but not an opening one. A portion of my query which shows me including the opening parenthesis.... Code: $this->db->select('baseProductsDescription.products_sku AS base_product_sku', FALSE);
[eluser]Unknown[/eluser]
Yes, it's happening to me too. I'm trying to do this: Code: $this->db->join('table_a', ' ((table_b.key_id = table_a.key_id) AND (table_a.type = "my_type"))', 'left'); You are right that the preg_match is breaking it. The match says... Code: preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match) ... that we will split my ON clause into exactly 3 parts -- [letters, numbers, underscores, or periods] followed by [spaces or non-letter-number-underscores] followed by anything. In my case, the three parts are Code: 1. table_b.key_id In other words, as written, the join command will ONLY work with simple ON clauses. Here's hoping they update the documentation to spell out the limitations of join.
[eluser]Webnet[/eluser]
I found it odd that this happened in a later version of code igniter. We're unable to upgrade because of this limitation. We'd have to do some rewriting to make this work.
[eluser]jmadsen[/eluser]
If you've confirmed this is a bug, the next step would be to report it here: https://github.com/EllisLab/CodeIgniter/issues This forum is linked to but doesn't serve as an Bugtracker - you won't necessarily get help or a solution here.
|
Welcome Guest, Not a member yet? Register Sign In |