Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting columns when sql mode is using ansi_quotes #669

Merged
merged 5 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/DbSchema/SchemaHasherMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function hashDb(): string
$maxConcatQuery = 'SET SESSION group_concat_max_len = 1000000';
$this->connection->query($maxConcatQuery);

$query = '
$query = "
SELECT
MD5(
GROUP_CONCAT(
Expand All @@ -50,8 +50,8 @@ public function hashDb(): string
FROM (
SELECT
CONCAT(
COALESCE(COLUMN_NAME, ""),
COALESCE(EXTRA, ""),
COALESCE(COLUMN_NAME, ''),
COALESCE(EXTRA, ''),
COLUMN_TYPE,
IS_NULLABLE
) as columns
Expand All @@ -62,7 +62,7 @@ public function hashDb(): string
ORDER BY table_name, column_name
) as InnerSelect
GROUP BY
grouper';
grouper";

$hash = '';
if ($this->connection instanceof PDO) {
Expand Down
8 changes: 4 additions & 4 deletions src/QueryReflection/PdoMysqlQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ protected function checkInformationSchema(string $tableName): Iterator
if (null === $this->stmt) {
$this->stmt = $this->pdo->prepare(
// EXTRA, COLUMN_NAME seems to be nullable in mariadb
'SELECT
coalesce(COLUMN_NAME, "") as COLUMN_NAME,
coalesce(EXTRA, "") as EXTRA,
"SELECT
coalesce(COLUMN_NAME, '') as COLUMN_NAME,
coalesce(EXTRA, '') as EXTRA,
COLUMN_TYPE
FROM information_schema.columns
WHERE table_name = ? AND table_schema = DATABASE()'
WHERE table_name = ? AND table_schema = DATABASE()"
);
}

Expand Down