Description: |
|
---|
Gravity: fixed a bug where natural join was not correctly processed by sql_group_start
Review Request #410 — Created Feb. 5, 2016 and submitted
Information | |
---|---|
rubendgr | |
Lunr | |
rubendgr:natural_join_fix | |
Reviewers | |
lunr | |
[Gravity] fixed a bug where natural join was not correctly processed by sql_group_start
Unit test.
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 1) Ok, so the logic here looks fine in general, but there are several issues with this solution:
1) $this->is_natural_join is not set to TRUE anywhere
2) I'm not entirely sure using two flags is simpler than just not setting $this->join to TRUE in case of a natural join -
Kind of defeats the purpose, no?
I mean, a natural join never has an ON clause, so testing with one is kind of pointless. Would make more sense to test with WHERE or HAVING here.
Change Summary:
made an extra test to test if there is a natural join and improved my other test with natural join
Diff: |
Revision 2 (+60 -3) |
---|
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 2) I think substr would be better here. We know exactly what we're looking for
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 2) why are two flags better than one?
Change Summary:
replaced explode by substr and made the methods more simple
Diff: |
Revision 3 (+44 -10) |
---|
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 3) AFAICS this should be "if the join is not finished"
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 3) if this is really enough to fix the problem, I would rename this variable to something more clear
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 3) Please make sure your IDE is not autoformatting to his own coding style
-
Change Summary:
Renamed the variable is_join and made some better comments.
Diff: |
Revision 4 (+23 -20) |
---|
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) boolean variables/methods should start with "is" if possible, to convey that they contain a boolean value. In this case I guess I would prefer "is_join_in_progress", "is_unfinished_join" or "is_incomplete_join".
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) I don't think we need to explicitely set it to FALSE.
Change Summary:
Replaced the is_join in a couple of classes for is_unfinished_join.
Diff: |
Revision 5 (+29 -30) |
---|
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 6) better simply use !=
it's much easier to read -
Change Summary:
Applied the M2mobi coding standards and made a small fix with a method naming and logical expression.
Diff: |
Revision 7 (+79 -45) |
---|