Skip to content

Commit

Permalink
Merge branch '3.4.x' into 4.0.x
Browse files Browse the repository at this point in the history
* 3.4.x:
  Run PHP 7.4 on AppVeyor
  Deprecated AbstractPlatform::getListTableConstraintsSQL()
  Add section on result types not being guaranteed
  Use CASE_LOWER to follow codebase pattern.
  Move conversion inside if to prevent false value analysis error.
  Oracle: Convert array keys to uppercase.
  • Loading branch information
derrabus committed Feb 2, 2022
2 parents 83766f9 + da754af commit da550e0
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 3 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Expand Up @@ -619,6 +619,10 @@ The following methods have been removed.

# Upgrade to 3.4

# Deprecated `AbstractPlatform::getListTableConstraintsSQL()`

This method is unused by the DBAL since 2.0.

# Deprecated `Type::getName()`

This will method is not useful for the DBAL anymore, and will be removed in 4.0.
Expand Down
8 changes: 6 additions & 2 deletions docs/en/reference/data-retrieval-and-manipulation.rst
Expand Up @@ -296,8 +296,12 @@ API
---

The DBAL contains several methods for executing queries against
your configured database for data retrieval and manipulation. Below
we'll introduce these methods and provide some examples for each of
your configured database for data retrieval and manipulation.

These DBAL methods retrieve data from the database using the underlying database driver and do not perform any type conversion.
So the result php type for a database column can vary between database drivers and php versions.

Below we'll introduce these methods and provide some examples for each of
them.

prepare()
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml.dist
Expand Up @@ -46,6 +46,12 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\OraclePlatform::getListTableConstraintsSQL"/>
<referencedMethod name="Doctrine\DBAL\Platforms\PostgreSQLPlatform::getListTableConstraintsSQL"/>
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::getListTableConstraintsSQL"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
3 changes: 3 additions & 0 deletions src/Platforms/AbstractMySQLPlatform.php
Expand Up @@ -113,6 +113,9 @@ public function getListDatabasesSQL(): string
return 'SHOW DATABASES';
}

/**
* @deprecated
*/
public function getListTableConstraintsSQL(string $table): string
{
return 'SHOW INDEX FROM ' . $table;
Expand Down
2 changes: 2 additions & 0 deletions src/Platforms/AbstractPlatform.php
Expand Up @@ -1981,6 +1981,8 @@ public function getListSequencesSQL(string $database): string
}

/**
* @deprecated
*
* @throws Exception If not supported on this platform.
*/
public function getListTableConstraintsSQL(string $table): string
Expand Down
3 changes: 3 additions & 0 deletions src/Platforms/OraclePlatform.php
Expand Up @@ -554,6 +554,9 @@ public function getListTableForeignKeysSQL(string $table, ?string $database = nu
ORDER BY cols.constraint_name ASC, cols.position ASC';
}

/**
* @deprecated
*/
public function getListTableConstraintsSQL(string $table): string
{
$table = $this->normalizeIdentifier($table);
Expand Down
3 changes: 3 additions & 0 deletions src/Platforms/PostgreSQLPlatform.php
Expand Up @@ -211,6 +211,9 @@ public function getListTableForeignKeysSQL(string $table, ?string $database = nu
AND r.contype = 'f'";
}

/**
* @deprecated
*/
public function getListTableConstraintsSQL(string $table): string
{
$table = new Identifier($table);
Expand Down
3 changes: 3 additions & 0 deletions src/Platforms/SqlitePlatform.php
Expand Up @@ -378,6 +378,9 @@ public function getClobTypeDeclarationSQL(array $column): string
return 'CLOB';
}

/**
* @deprecated
*/
public function getListTableConstraintsSQL(string $table): string
{
return sprintf(
Expand Down
3 changes: 2 additions & 1 deletion src/Schema/OracleSchemaManager.php
Expand Up @@ -319,7 +319,8 @@ public function listTableDetails(string $name): Table
$tableOptions = $this->_conn->fetchAssociative($sql);

if ($tableOptions !== false) {
$table->addOption('comment', $tableOptions['COMMENTS']);
$tableOptions = array_change_key_case($tableOptions, CASE_LOWER);
$table->addOption('comment', $tableOptions['comments']);
}

return $table;
Expand Down

0 comments on commit da550e0

Please sign in to comment.