Skip to content

Commit

Permalink
Merge branch '3.0.x' into 3.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Feb 17, 2021
2 parents f77e731 + 11f0f94 commit cab102f
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 95 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
/run-all.sh export-ignore
/SECURITY.md export-ignore
/tests export-ignore
/.travis.yml export-ignore
/UPGRADE.md export-ignore
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/BC_Break.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ about: Have you encountered an issue during an upgrade? 💣
---

<!--
Before reporting a BC break, please consult the upgrading document to make sure it's not an expected change: https://github.com/doctrine/dbal/blob/master/UPGRADE.md
Before reporting a BC break, please consult the upgrading document (UPGRADE.md)
corresponding to the version you are using.
-->

### BC Break Report
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"

jobs:
coding-standards:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"
schedule:
- cron: "42 3 * * *"

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"

jobs:
static-analysis-phpstan:
Expand Down Expand Up @@ -52,6 +50,6 @@ jobs:
uses: actions/checkout@v2

- name: Psalm
uses: docker://vimeo/psalm-github-actions:4.1.1
env:
REQUIRE_DEV: "true"
uses: docker://vimeo/psalm-github-actions:4.5.2
with:
composer_require_dev: true
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Doctrine DBAL

| [4.0-dev][Master] | [3.0][3.0] | [2.12][2.12] |
| [4.0-dev][4.0] | [3.0][3.0] | [2.12][2.12] |
|:----------------:|:----------:|:----------:|
| [![Build status][Master image]][Master] | [![Build status][3.0 image]][3.0] | [![Build status][2.12 image]][2.12] |
| [![GitHub Actions][GA master image]][GA master] | [![GitHub Actions][GA 3.0 image]][GA 3.0] | [![GitHub Actions][GA 2.12 image]][GA 2.12] |
| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 3.0 image]][AppVeyor 3.0] | [![AppVeyor][AppVeyor 2.12 image]][AppVeyor 2.12] |
| [![Code Coverage][Coverage image]][CodeCov Master] | [![Code Coverage][Coverage 3.0 image]][CodeCov 3.0] | [![Code Coverage][Coverage 2.12 image]][CodeCov 2.12] |
| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.0 image]][GA 3.0] | [![GitHub Actions][GA 2.12 image]][GA 2.12] |
| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.0 image]][AppVeyor 3.0] | [![AppVeyor][AppVeyor 2.12 image]][AppVeyor 2.12] |
| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.0 image]][CodeCov 3.0] | [![Code Coverage][Coverage 2.12 image]][CodeCov 2.12] |

Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.

Expand All @@ -15,16 +14,14 @@ Powerful database abstraction layer with many features for database schema intro
* [Documentation](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/)
* [Issue Tracker](https://github.com/doctrine/dbal/issues)

[Master image]: https://img.shields.io/travis/doctrine/dbal/master.svg?style=flat-square
[Coverage image]: https://codecov.io/gh/doctrine/dbal/branch/master/graph/badge.svg
[Master]: https://travis-ci.org/doctrine/dbal
[CodeCov Master]: https://codecov.io/gh/doctrine/dbal/branch/master
[AppVeyor master]: https://ci.appveyor.com/project/doctrine/dbal/branch/master
[AppVeyor master image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/master?svg=true
[GA master]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3Amaster
[GA master image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg
[Coverage image]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x/graph/badge.svg
[4.0]: https://github.com/doctrine/dbal/tree/4.0.x
[CodeCov 4.0]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x
[AppVeyor 4.0]: https://ci.appveyor.com/project/doctrine/dbal/branch/4.0.x
[AppVeyor 4.0 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/4.0.x?svg=true
[GA 4.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x
[GA 4.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg

[3.0 image]: https://img.shields.io/travis/doctrine/dbal/3.0.x.svg?style=flat-square
[Coverage 3.0 image]: https://codecov.io/gh/doctrine/dbal/branch/3.0.x/graph/badge.svg
[3.0]: https://github.com/doctrine/dbal/tree/3.0.x
[CodeCov 3.0]: https://codecov.io/gh/doctrine/dbal/branch/3.0.x
Expand All @@ -33,7 +30,6 @@ Powerful database abstraction layer with many features for database schema intro
[GA 3.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.0.x
[GA 3.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.0.x

[2.12 image]: https://img.shields.io/travis/doctrine/dbal/2.12.x.svg?style=flat-square
[Coverage 2.12 image]: https://codecov.io/gh/doctrine/dbal/branch/2.12.x/graph/badge.svg
[2.12]: https://github.com/doctrine/dbal/tree/2.12.x
[CodeCov 2.12]: https://codecov.io/gh/doctrine/dbal/branch/2.12.x
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ we cannot protect you from SQL injection.
Please read the documentation chapter on Security in Doctrine DBAL to
understand the assumptions we make.

- [Latest security.rst page on Github](https://github.com/doctrine/dbal/blob/master/docs/en/reference/security.rst)
- [Latest security.rst page on Github](https://github.com/doctrine/dbal/blob/4.0.x/docs/en/reference/security.rst)
- [Security Page in rendered documentation](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/security.html)
2 changes: 1 addition & 1 deletion ci/github/phpunit/mysqli-tls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<var name="db_ssl_key" value="client-key.pem"/>

<!-- Use MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT since there's no way to generate a certificate
with a proper common name (CN) on Travis. This flag must be not used in production settings. -->
with a proper common name (CN) on the CI. This flag must be not used in production settings. -->
<var name="db_driver_option_flags" value="64"/>

<var name="db_user" value="root"/>
Expand Down
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"phpunit/phpunit": "9.5.0",
"psalm/plugin-phpunit": "0.13.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "4.3.2"
"vimeo/psalm": "4.5.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
Expand All @@ -61,10 +61,5 @@
},
"autoload-dev": {
"psr-4": { "Doctrine\\DBAL\\Tests\\": "tests" }
},
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
}
}
4 changes: 2 additions & 2 deletions src/Driver/API/MySQL/ExceptionConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
final class ExceptionConverter implements ExceptionConverterInterface
{
/**
* @link https://dev.mysql.com/doc/refman/8.0/en/client-error-reference.html
* @link https://dev.mysql.com/doc/refman/8.0/en/server-error-reference.html
* @link https://dev.mysql.com/doc/mysql-errors/8.0/en/client-error-reference.html
* @link https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html
*/
public function convert(Exception $exception, ?Query $query): DriverException
{
Expand Down
34 changes: 17 additions & 17 deletions src/Platforms/SQLServer2012Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ public function getDropIndexSQL($index, $table = null)

return sprintf(
<<<SQL
IF EXISTS (SELECT * FROM sysobjects WHERE name = '%s')
ALTER TABLE %s DROP CONSTRAINT %s
ELSE
DROP INDEX %s ON %s
SQL
IF EXISTS (SELECT * FROM sysobjects WHERE name = '%s')
ALTER TABLE %s DROP CONSTRAINT %s
ELSE
DROP INDEX %s ON %s
SQL
,
$index,
$table,
Expand Down Expand Up @@ -1651,10 +1651,10 @@ protected function getCommentOnTableSQL(string $tableName, ?string $comment): st
{
return sprintf(
<<<'SQL'
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N%s, @level0type=N'SCHEMA', @level0name=N'dbo',
@level1type=N'TABLE', @level1name=N%s
SQL
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N%s, @level0type=N'SCHEMA', @level0name=N'dbo',
@level1type=N'TABLE', @level1name=N%s
SQL
,
$this->quoteStringLiteral((string) $comment),
$this->quoteStringLiteral($tableName)
Expand All @@ -1665,14 +1665,14 @@ public function getListTableMetadataSQL(string $table): string
{
return sprintf(
<<<'SQL'
SELECT
p.value AS [table_comment]
FROM
sys.tables AS tbl
INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1
WHERE
(tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description')
SQL
SELECT
p.value AS [table_comment]
FROM
sys.tables AS tbl
INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1
WHERE
(tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description')
SQL
,
$this->quoteStringLiteral($table)
);
Expand Down
3 changes: 0 additions & 3 deletions src/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ abstract public function getSQLDeclaration(array $column, AbstractPlatform $plat
*/
abstract public function getName();

/**
* @internal This method is only to be used within DBAL for forward compatibility purposes. Do not use directly.
*/
final public static function getTypeRegistry(): TypeRegistry
{
if (self::$typeRegistry === null) {
Expand Down
2 changes: 0 additions & 2 deletions src/Types/TypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* The type registry is responsible for holding a map of all known DBAL types.
* The types are stored using the flyweight pattern so that one type only exists as exactly one instance.
*
* @internal TypeRegistry exists for forward compatibility, its API should not be considered stable.
*/
final class TypeRegistry
{
Expand Down
5 changes: 0 additions & 5 deletions tests/Functional/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
Expand Down Expand Up @@ -367,10 +366,6 @@ public function testConnectionException(array $params): void
self::markTestSkipped('Only skipped if platform is not sqlite');
}

if ($platform instanceof PostgreSQL94Platform && isset($params['password'])) {
self::markTestSkipped('Does not work on Travis');
}

if ($platform instanceof MySQLPlatform && isset($params['user'])) {
$wrappedConnection = $this->connection->getWrappedConnection();
assert($wrappedConnection instanceof ServerInfoAwareConnection);
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
use function array_map;
use function array_pop;
use function array_unshift;
use function assert;
use function count;
use function preg_match;
use function strtolower;

class PostgreSQLSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
/** @var PostgreSQLSchemaManager */
protected $schemaManager;

protected function supportsPlatform(AbstractPlatform $platform): bool
{
return $platform instanceof PostgreSQL94Platform;
Expand Down Expand Up @@ -58,6 +56,8 @@ public function testGetSearchPath(): void

public function testGetSchemaNames(): void
{
assert($this->schemaManager instanceof PostgreSQLSchemaManager);

$names = $this->schemaManager->getSchemaNames();

self::assertIsArray($names);
Expand Down
6 changes: 3 additions & 3 deletions tests/Platforms/AbstractMySQLPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

use function array_shift;

/**
* @extends AbstractPlatformTestCase<MySQLPlatform>
*/
abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
{
/** @var MySQLPlatform */
protected $platform;

public function testModifyLimitQueryWitoutLimit(): void
{
$sql = $this->platform->modifyLimitQuery('SELECT n FROM Foo', null, 10);
Expand Down
8 changes: 7 additions & 1 deletion tests/Platforms/AbstractPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@
use function sprintf;
use function str_repeat;

/**
* @template T of AbstractPlatform
*/
abstract class AbstractPlatformTestCase extends TestCase
{
/** @var AbstractPlatform */
/** @var T */
protected $platform;

/**
* @return T
*/
abstract public function createPlatform(): AbstractPlatform;

protected function setUp(): void
Expand Down
11 changes: 4 additions & 7 deletions tests/Platforms/AbstractPostgreSQLPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Doctrine\DBAL\Tests\Platforms;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff;
Expand All @@ -17,14 +16,12 @@

use function sprintf;

/**
* @template T of PostgreSQL94Platform
* @extends AbstractPlatformTestCase<T>
*/
abstract class AbstractPostgreSQLPlatformTestCase extends AbstractPlatformTestCase
{
/** @var PostgreSQL94Platform */
protected $platform;

/** @return PostgreSQL94Platform */
abstract public function createPlatform(): AbstractPlatform;

public function getGenerateTableSql(): string
{
return 'CREATE TABLE test (id SERIAL NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))';
Expand Down
6 changes: 3 additions & 3 deletions tests/Platforms/AbstractSQLServerPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;

/**
* @extends AbstractPlatformTestCase<SQLServer2012Platform>
*/
abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCase
{
/** @var SQLServer2012Platform */
protected $platform;

public function getGenerateTableSql(): string
{
return 'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255), PRIMARY KEY (id))';
Expand Down
6 changes: 3 additions & 3 deletions tests/Platforms/DB2PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;

/**
* @extends AbstractPlatformTestCase<DB2Platform>
*/
class DB2PlatformTest extends AbstractPlatformTestCase
{
/** @var DB2Platform */
protected $platform;

public function createPlatform(): AbstractPlatform
{
return new DB2Platform();
Expand Down
9 changes: 3 additions & 6 deletions tests/Platforms/OraclePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
use function strtoupper;
use function uniqid;

/**
* @extends AbstractPlatformTestCase<OraclePlatform>
*/
class OraclePlatformTest extends AbstractPlatformTestCase
{
/** @var OraclePlatform */
protected $platform;

/**
* @return mixed[][]
*/
Expand Down Expand Up @@ -80,9 +80,6 @@ public function testInvalidIdentifiers(string $identifier): void
$platform->assertValidIdentifier($identifier);
}

/**
* @return OraclePlatform
*/
public function createPlatform(): AbstractPlatform
{
return new OraclePlatform();
Expand Down
Loading

0 comments on commit cab102f

Please sign in to comment.