Provide a default prefix to `compile` in `sqlStatement`
When creating an ActiveQuery without a prefix (which is possible since the prefix property is nullable), the sqlStatement method fails since it passes the prefix property to $this->driver->getQueryCompiler()->compile which expects a string. I suggest to fallback to an empty string when the prefix property is null.
I wasn’t able to run the test suite, but it seems like the CI setup itself is broken, so I guess it’s alright. Plus it’s really a small and safe change I think.
Codecov Report
Merging #63 (9f0a620) into master (5ae0a62) will decrease coverage by
0.34%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #63 +/- ##
============================================
- Coverage 92.90% 92.55% -0.35%
- Complexity 1476 1488 +12
============================================
Files 67 67
Lines 3804 3842 +38
============================================
+ Hits 3534 3556 +22
- Misses 270 286 +16
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Query/ActiveQuery.php | 91.66% <100.00%> (+0.23%) |
:arrow_up: |
| src/Driver/Driver.php | 76.44% <0.00%> (-6.17%) |
:arrow_down: |
| src/Driver/Postgres/PostgresDriver.php | 81.25% <0.00%> (-1.29%) |
:arrow_down: |
| src/Schema/AbstractColumn.php | 94.41% <0.00%> (-0.09%) |
:arrow_down: |
| src/Driver/MySQL/MySQLCompiler.php | 100.00% <0.00%> (ø) |
|
| src/Driver/Compiler.php | 95.13% <0.00%> (+0.08%) |
:arrow_up: |
| src/DatabaseManager.php | 98.48% <0.00%> (+0.12%) |
:arrow_up: |
| src/Query/SelectQuery.php | 95.49% <0.00%> (+0.25%) |
:arrow_up: |
| src/Driver/SQLite/SQLiteCompiler.php | 95.55% <0.00%> (+0.43%) |
:arrow_up: |
| src/Query/InsertQuery.php | 100.00% <0.00%> (+5.00%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update a729662...9f0a620. Read the comment docs.
Should we re-run the checks for this PR? I think the CI setup was kind of broken at the time.
Sounds like we can't do it anymore...
@SerafimArts do you have any idea how to rerun it?
Maybe add some unimportant commit? Something like that:
$compiler = $this->driver->getQueryCompiler();
return $compiler->compile(
$parameters ?? new QueryParameters(),
$this->prefix,
$this
);
@SerafimArts Done!
@wolfy-j it seems it worked =)
@roxblnfk we have to copy it to the cycle/database as well.
So the test suite fails under MySQL 5.7 but apparently the same test was already failing.