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

Rework handling quoted object names and reserved SQL keywords #6589

Draft
wants to merge 8 commits into
base: 5.0.x
Choose a base branch
from
Draft
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
5 changes: 0 additions & 5 deletions src/Driver/AbstractMySQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Doctrine\DBAL\Platforms\MariaDB1010Platform;
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQL84Platform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\ServerVersionProvider;

Expand Down Expand Up @@ -46,10 +45,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
return new MariaDBPlatform();
}

if (version_compare($version, '8.4.0', '>=')) {
return new MySQL84Platform();
}

return new MySQLPlatform();
}

Expand Down
7 changes: 0 additions & 7 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception\InvalidColumnType\ColumnValuesRequired;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords;
use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
Expand Down Expand Up @@ -756,11 +754,6 @@ protected function initializeDoctrineTypeMappings(): void
];
}

protected function createReservedKeywordsList(): KeywordList
{
return new MySQLKeywords();
}

/**
* {@inheritDoc}
*
Expand Down
20 changes: 0 additions & 20 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\Exception\NoColumnsSpecifiedForTable;
use Doctrine\DBAL\Platforms\Exception\NotSupported;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
Expand Down Expand Up @@ -73,11 +72,6 @@ abstract class AbstractPlatform
/** @var string[]|null */
protected ?array $doctrineTypeMapping = null;

/**
* Holds the KeywordList instance for the current platform.
*/
protected ?KeywordList $_keywords = null;

/**
* Returns the SQL snippet that declares a boolean column.
*
Expand Down Expand Up @@ -2122,20 +2116,6 @@ public function rollbackSavePoint(string $savepoint): string
return 'ROLLBACK TO SAVEPOINT ' . $savepoint;
}

/**
* Returns the keyword list instance of this platform.
*/
final public function getReservedKeywordsList(): KeywordList
{
// Store the instance so it doesn't need to be generated on every request.
return $this->_keywords ??= $this->createReservedKeywordsList();
}

/**
* Creates an instance of the reserved keyword list of this platform.
*/
abstract protected function createReservedKeywordsList(): KeywordList;

/**
* Quotes a literal string.
* This method is NOT meant to fix SQL injections!
Expand Down
7 changes: 0 additions & 7 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\Exception\NotSupported;
use Doctrine\DBAL\Platforms\Keywords\DB2Keywords;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\DB2SchemaManager;
use Doctrine\DBAL\Schema\Identifier;
Expand Down Expand Up @@ -591,11 +589,6 @@ public function supportsSavepoints(): bool
return false;
}

protected function createReservedKeywordsList(): KeywordList
{
return new DB2Keywords();
}

public function createSchemaManager(Connection $connection): DB2SchemaManager
{
return new DB2SchemaManager($connection, $this);
Expand Down
Loading
Loading