-
-
.gitignore (Diff revision 1) This is potentially fine, but I doubt it qualifies as an external interaction. Either put it below the top section combined with all the other project and backup files, or give it a separate new section and explain wtf this is for.
Either way, it's an unrelated change and needs to go into a separate commit/review
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 1) This is a bit lacking. Also, why "$condition"?
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 1) is there a possibility of this ever being something else than "USING"?
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 1) this will break many things. Be careful with adding spurious empty lines
-
src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php (Diff revision 1) it would probably be nice for the simple DML query builder to allow passing a column list here, just like select() allows.
-
src/Lunr/Gravity/Database/SQLDMLQueryBuilder.php (Diff revision 1) why "$name" and "expression"? expression of what?
-
-
-
src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderUsingTest.php (Diff revision 1) spurious empty line
-
[Gravity] Added 'Using' functionality to QueryBuilder
Review Request #454 — Created Sept. 14, 2016 and submitted
Information | |
---|---|
p.valk | |
Lunr | |
newsqlusing | |
8f37b20... | |
Reviewers | |
lunr | |
Update: Added 'Using' functionality
phpunit test passed; (having 2 unrelated failures in PhysicalFilesystemAccessObjectFileTest.) = fixed by running 'ant clean' before running unittest.
-
There is one other area of concern. USING is incompatible with ON, yet in the current implementation, it's still allowed to use both, thus potentially constructing invalid queries.
The query builder should take care to never produce invalid queries. Generally in case of conflicts we use a "first come, first served" principle. So whichever function is called first is being used.In summary:
$builder->join()->using()->join()->on()
$builder->join()->on()->join()->using()should be working, but
$builder->join()->using()->on()
$builder->join()->on()->using()should not
Change Summary:
updated according to feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+218 -3) |
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revisions 1 - 2) how does the using part end up in the query if you remove it here?
-
-
-
-
src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php (Diff revision 2) This is weird. Your documentation states $using is always a string, so why would you test whether it's an array? Why would it be an array in the first place?
-
Change Summary:
small doc change and indent fix.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+215) |
Change Summary:
updated according to feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+304 -5) |
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) property unhandled in constructor/destructor
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) Use $column_list instead of $name
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) misleading explanation. JOIN and USING must be used together. It's ON and USING that shouldn't be mixed.
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) you're not finishing the join
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 4) You don't need both isset() and empty(). empty() checks for a superset of possible values.
Also, you're making this more complicated than it needs to be:
if (empty($join) || $this->is_unfinished_join)
-
-
src/Lunr/Gravity/Database/MySQL/MySQLSimpleDMLQueryBuilder.php (Diff revision 4) why do you escape a column as table?
-
-
-
-
Change Summary:
improved tests and fixes according to feedback.
-
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 5) Turns out, storing using() separately from join doesn't work. It breaks when you join multiple times, in which case you might also have multiple different using() clauses.
Example:
JOIN foo USING(bar) JOIN foobar USING(baz)
would translate to
$builder->join('foo') ->using('bar') ->join('foobar') ->using('baz');
The current code however would create:
JOIN foo JOIN foobar USING(bar, baz)
-
Commit: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+507 -65)
|
Change Summary:
updated tests
Commit: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 7 (+618 -65)
|
Testing Done: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||
Diff: |
Revision 8 (+666 -63)
|
-
Something messed with the coding standard. Please don't mix style and functional changes.
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 8) Boolean variables should be clearly understandable.
$join_type = TRUE // USING
$join_type = FALSE // ONIs not clearly understandable. There's no way to make this connection naturally
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 8) Why not reset this also for natural joins?
-
-
-
-
-
-
-
-
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 9 (+655 -62)
|
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 10 (+672 -62)
|
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revisions 9 - 10) that's a rather hacky approach to things and would need to be done in many places. I would prefer a solutions that wouldn't have that.
-
src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsConditionTest.php (Diff revision 10) eh?
Change Summary:
i wrote more unittests for the DatabaseDMLQueryBuilder and fixed that 'hacky' bit of code.
i think that all different code paths are covered now.
also i saw there was a little style error in the DatabaseDMLQueryBuilder so i fixed that.
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 11 (+840 -64)
|
-
I marked a couple missing tests, but not all of them. This should give you a better idea though
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) Not sure what you use for checking that, but Jenkins doesn't have an issue for this line listed.
Either way, if this is changed, it should use [] instead of array()
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) There is a test for join_type = 'on' and join_type = '', but not join_type = 'using'
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) we generally don't do "huge" overarching if statements, but rather early exits.
So, rather than
if (TRUE) { ... long block... }
we'd have
if (FALSE) { return } ... long block...
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) missing test(s) for is_unfinished_join = FALSE
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) yeah, no. Please leave as is
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) missing tests for join_type = '' / is_unfinished_join = TRUE
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) missing test that this is set correctly
-
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) That seems wrong. What good would
$join_type = 'where';
do?
-
src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php (Diff revision 11) don't fix this pls
or if you do, do it right (equal signs should align) -
Change Summary:
more unittest's.
reverted some style changes, enhanced some code
and a small style fix.
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 12 (+1001 -65)
|
Change Summary:
dont tell me you can find more missing unittests.
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 13 (+1258 -65)
|
Change Summary:
removed duplicate and changed some nameing.
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 14 (+1240 -65)
|
-
Looking quite good now, but you should take some time to fix the test names :)
-
src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsConditionTest.php (Diff revision 14) missing remaining tests for ON
-
src/Lunr/Gravity/Database/Tests/DatabaseDMLQueryBuilderQueryPartsConditionTest.php (Diff revision 14) there are tests missing to verify that where/having do not set a join_type
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 15 (+1295 -65)
|
Change Summary:
last fix, ever
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 16 (+1294 -65)
|
Change Summary:
sqdmlquerybuilder and mysqlsimplequerybuilder unittests
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 17 (+1098 -65)
|
-
Mostly looks fine, some small issues. Forward to the next class ;)
-
src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderUsingTest.php (Diff revision 17) shouldn't be necessary
-
src/Lunr/Gravity/Database/Tests/SQLDMLQueryBuilderUsingTest.php (Diff revision 17) assertPropertyEquals
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 18 (+1098 -65)
|
Change Summary:
changed name to be easier to understand.
Commit: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 19 (+1097 -65)
|
-
I tried to merge this but there are too many conflicts.
Please rebase against master and squash all commits into one.