Skip to content

Commit 2ea8205

Browse files
committed
Test unsupported driver (draft)
1 parent 4496c7b commit 2ea8205

File tree

5 files changed

+565
-33
lines changed

5 files changed

+565
-33
lines changed

.github/workflows/platform-matrix-test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
env:
1616
MYSQL_HOST: '127.0.0.1'
1717
PGSQL_HOST: '127.0.0.1'
18+
MSSQL_HOST: '127.0.0.1'
1819

1920
strategy:
2021
fail-fast: false
@@ -59,3 +60,12 @@ jobs:
5960
MYSQL_DATABASE: foo
6061
ports:
6162
- "3306:3306"
63+
64+
mssql:
65+
image: mcr.microsoft.com/mssql/server:latest
66+
env:
67+
ACCEPT_EULA: Y
68+
SA_PASSWORD: 'Secret.123'
69+
MSSQL_PID: Developer
70+
ports:
71+
- 1433:1433

src/Type/Doctrine/Query/QueryResultTypeWalker.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,10 @@ public function walkSelectExpression($selectExpression): string
11601160
});
11611161
}
11621162

1163+
if (!$this->isSupportedDriver()) {
1164+
$type = new MixedType(); // avoid guessing for unsupported drivers, there are too many differences
1165+
}
1166+
11631167
$this->typeBuilder->addScalar($resultAlias, $type);
11641168

11651169
return '';
@@ -2099,4 +2103,15 @@ private function getNativeConnection()
20992103
return null;
21002104
}
21012105

2106+
private function isSupportedDriver(): bool
2107+
{
2108+
$driver = $this->em->getConnection()->getDriver();
2109+
return $driver instanceof MysqliDriver
2110+
|| $driver instanceof PdoMysqlDriver
2111+
|| $driver instanceof PgSQLDriver
2112+
|| $driver instanceof PdoPgSQLDriver
2113+
|| $driver instanceof SQLite3Driver
2114+
|| $driver instanceof PdoSqliteDriver;
2115+
}
2116+
21022117
}

0 commit comments

Comments
 (0)