diff --git a/.gitignore b/.gitignore index 381330348..ac361e51f 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ doctrine/common/.travis.yml doctrine/common/composer.json doctrine/dbal/tests doctrine/dbal/docs +doctrine/dbal/psalm.xml doctrine/dbal/run-all.sh doctrine/dbal/.doctrine-project.json doctrine/dbal/.travis.yml diff --git a/composer.json b/composer.json index fc711152c..b13d87295 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "christophwurst/id3parser": "^0.1.1", "deepdiver/zipstreamer": "2.0.0", "deepdiver1975/tarstreamer": "v2.0.0", - "doctrine/dbal": "2.12.0", + "doctrine/dbal": "3.0.0", "egulias/email-validator": "2.1.25", "giggsey/libphonenumber-for-php": "^8.12", "guzzlehttp/guzzle": "^7.2", diff --git a/composer.lock b/composer.lock index c82d603f0..59ea4db95 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c1318b0d9015468b2e3666dfade21d65", + "content-hash": "54aa8c3315eec1c1cf4b20ac730f5a82", "packages": [ { "name": "aws/aws-sdk-php", @@ -218,6 +218,79 @@ ], "time": "2020-01-07T09:05:03+00:00" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.1", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-11-11T10:22:58+00:00" + }, { "name": "deepdiver/zipstreamer", "version": "2.0.0", @@ -331,16 +404,16 @@ }, { "name": "doctrine/cache", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3" + "reference": "13e3381b25847283a91948d04640543941309727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727", + "reference": "13e3381b25847283a91948d04640543941309727", "shasum": "" }, "require": { @@ -409,6 +482,10 @@ "redis", "xcache" ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/1.10.x" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -423,32 +500,33 @@ "type": "tidelift" } ], - "time": "2020-05-27T16:24:54+00:00" + "time": "2020-07-07T18:54:01+00:00" }, { "name": "doctrine/dbal", - "version": "2.12.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646" + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6d37b4c42aaa3c3ee175f05eca68056f4185646", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/ee6d1260d5cc20ec506455a585945d7bdb98662c", + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c", "shasum": "" }, "require": { + "composer/package-versions-deprecated": "^1.11.99", "doctrine/cache": "^1.0", "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.3 || ^8" + "php": "^7.3 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^8.1", "jetbrains/phpstorm-stubs": "^2019.1", "phpstan/phpstan": "^0.12.40", + "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.4", "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", @@ -468,7 +546,7 @@ }, "autoload": { "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + "Doctrine\\DBAL\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -511,11 +589,14 @@ "queryobject", "sasql", "sql", - "sqlanywhere", "sqlite", "sqlserver", "sqlsrv" ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.0.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -530,7 +611,7 @@ "type": "tidelift" } ], - "time": "2020-10-22T17:26:24+00:00" + "time": "2020-11-15T18:20:41+00:00" }, { "name": "doctrine/event-manager", @@ -4425,16 +4506,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c" + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { @@ -4446,7 +4527,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4486,7 +4567,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" }, "funding": [ { @@ -4502,7 +4583,7 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-idn", diff --git a/composer/InstalledVersions.php b/composer/InstalledVersions.php index eb4c4d90c..4f023de23 100644 --- a/composer/InstalledVersions.php +++ b/composer/InstalledVersions.php @@ -29,7 +29,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => '875ee27505a280f58a893b16976fe36572fd82c4', + 'reference' => '65a8a4553327c818931876ac1aa80a2143e02733', 'name' => 'nextcloud/3rdparty', ), 'versions' => @@ -70,6 +70,15 @@ class InstalledVersions ), 'reference' => 'c0e56c336bd6131c199827f928e5a9aec89aa4da', ), + 'composer/package-versions-deprecated' => + array ( + 'pretty_version' => '1.11.99.1', + 'version' => '1.11.99.1', + 'aliases' => + array ( + ), + 'reference' => '7413f0b55a051e89485c5cb9f765fe24bb02a7b6', + ), 'deepdiver/zipstreamer' => array ( 'pretty_version' => '2.0.0', @@ -90,21 +99,21 @@ class InstalledVersions ), 'doctrine/cache' => array ( - 'pretty_version' => '1.10.1', - 'version' => '1.10.1.0', + 'pretty_version' => '1.10.2', + 'version' => '1.10.2.0', 'aliases' => array ( ), - 'reference' => '35a4a70cd94e09e2259dfae7488afc6b474ecbd3', + 'reference' => '13e3381b25847283a91948d04640543941309727', ), 'doctrine/dbal' => array ( - 'pretty_version' => '2.12.0', - 'version' => '2.12.0.0', + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', 'aliases' => array ( ), - 'reference' => 'c6d37b4c42aaa3c3ee175f05eca68056f4185646', + 'reference' => 'ee6d1260d5cc20ec506455a585945d7bdb98662c', ), 'doctrine/event-manager' => array ( @@ -293,7 +302,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => '875ee27505a280f58a893b16976fe36572fd82c4', + 'reference' => '65a8a4553327c818931876ac1aa80a2143e02733', ), 'nextcloud/lognormalizer' => array ( @@ -313,6 +322,13 @@ class InstalledVersions ), 'reference' => 'c6d052fc58cb876152f89f532b95a8d7907e7f0e', ), + 'ocramius/package-versions' => + array ( + 'replaced' => + array ( + 0 => '1.11.99', + ), + ), 'opis/closure' => array ( 'pretty_version' => '3.6.1', @@ -734,12 +750,12 @@ class InstalledVersions ), 'symfony/polyfill-intl-grapheme' => array ( - 'pretty_version' => 'v1.20.0', - 'version' => '1.20.0.0', + 'pretty_version' => 'v1.22.0', + 'version' => '1.22.0.0', 'aliases' => array ( ), - 'reference' => 'c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c', + 'reference' => '267a9adeb8ecb8071040a740930e077cdfb987af', ), 'symfony/polyfill-intl-idn' => array ( diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 72a084426..b85b80888 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -782,312 +782,264 @@ 'Doctrine\\Common\\EventManager' => $vendorDir . '/doctrine/event-manager/lib/Doctrine/Common/EventManager.php', 'Doctrine\\Common\\EventSubscriber' => $vendorDir . '/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.php', 'Doctrine\\Common\\Lexer\\AbstractLexer' => $vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', - 'Doctrine\\DBAL\\Abstraction\\Result' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Abstraction/Result.php', - 'Doctrine\\DBAL\\Cache\\ArrayStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php', - 'Doctrine\\DBAL\\Cache\\CacheException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php', - 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php', - 'Doctrine\\DBAL\\Cache\\ResultCacheStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php', - 'Doctrine\\DBAL\\ColumnCase' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/ColumnCase.php', - 'Doctrine\\DBAL\\Configuration' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php', - 'Doctrine\\DBAL\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Connection.php', - 'Doctrine\\DBAL\\ConnectionException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php', - 'Doctrine\\DBAL\\Connections\\MasterSlaveConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php', - 'Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Connections/PrimaryReadReplicaConnection.php', - 'Doctrine\\DBAL\\DBALException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php', - 'Doctrine\\DBAL\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver.php', - 'Doctrine\\DBAL\\DriverManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php', - 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDB2Driver.php', - 'Doctrine\\DBAL\\Driver\\AbstractDriverException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php', - 'Doctrine\\DBAL\\Driver\\AbstractException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractException.php', - 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver\\EasyConnectString' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver/EasyConnectString.php', - 'Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLAnywhereDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver\\Exception\\PortWithoutHost' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php', - 'Doctrine\\DBAL\\Driver\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Connection.php', - 'Doctrine\\DBAL\\Driver\\DriverException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php', - 'Doctrine\\DBAL\\Driver\\DrizzlePDOMySql\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php', - 'Doctrine\\DBAL\\Driver\\DrizzlePDOMySql\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php', - 'Doctrine\\DBAL\\Driver\\Exception' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Exception.php', - 'Doctrine\\DBAL\\Driver\\ExceptionConverterDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php', - 'Doctrine\\DBAL\\Driver\\FetchUtils' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/FetchUtils.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Connection.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Exception' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DataSourceName' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DataSourceName.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Driver.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionError.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionFailed.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/PrepareFailed.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/StatementError.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Statement.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Connection.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\FailedReadingStreamOffset' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/FailedReadingStreamOffset.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidOption' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/InvalidOption.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\StatementError' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/StatementError.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\UnknownType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/UnknownType.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Statement.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Connection.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\NonTerminatedStringLiteral' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/NonTerminatedStringLiteral.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\SequenceDoesNotExist' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/SequenceDoesNotExist.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\UnknownParameterIndex' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/UnknownParameterIndex.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Exception' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDOConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php', - 'Doctrine\\DBAL\\Driver\\PDOException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php', - 'Doctrine\\DBAL\\Driver\\PDOIbm\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOOracle\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOQueryImplementation' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDOStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php', - 'Doctrine\\DBAL\\Driver\\PDOStatementImplementations' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatementImplementations.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php', - 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/MySQL/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/OCI/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/PgSQL/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLite\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLite/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Statement.php', - 'Doctrine\\DBAL\\Driver\\PingableConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php', - 'Doctrine\\DBAL\\Driver\\Result' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Result.php', - 'Doctrine\\DBAL\\Driver\\ResultStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Driver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Exception\\Error' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Exception/Error.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\LastInsertId' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvStatement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\ServerInfoAwareConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ServerInfoAwareConnection.php', - 'Doctrine\\DBAL\\Driver\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.php', - 'Doctrine\\DBAL\\Driver\\StatementIterator' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/StatementIterator.php', - 'Doctrine\\DBAL\\Event\\ConnectionEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php', - 'Doctrine\\DBAL\\Event\\Listeners\\MysqlSessionInit' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php', - 'Doctrine\\DBAL\\Event\\Listeners\\OracleSessionInit' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php', - 'Doctrine\\DBAL\\Event\\Listeners\\SQLSessionInit' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableAddColumnEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableChangeColumnEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableRemoveColumnEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableRenameColumnEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaColumnDefinitionEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaCreateTableColumnEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaCreateTableEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php', - 'Doctrine\\DBAL\\Events' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Events.php', - 'Doctrine\\DBAL\\Exception' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception.php', - 'Doctrine\\DBAL\\Exception\\ConnectionException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionException.php', - 'Doctrine\\DBAL\\Exception\\ConnectionLost' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionLost.php', - 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php', - 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php', - 'Doctrine\\DBAL\\Exception\\DeadlockException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DeadlockException.php', - 'Doctrine\\DBAL\\Exception\\DriverException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DriverException.php', - 'Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\InvalidArgumentException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php', - 'Doctrine\\DBAL\\Exception\\InvalidFieldNameException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php', - 'Doctrine\\DBAL\\Exception\\LockWaitTimeoutException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php', - 'Doctrine\\DBAL\\Exception\\NoKeyValue' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NoKeyValue.php', - 'Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php', - 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ReadOnlyException.php', - 'Doctrine\\DBAL\\Exception\\RetryableException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/RetryableException.php', - 'Doctrine\\DBAL\\Exception\\ServerException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ServerException.php', - 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php', - 'Doctrine\\DBAL\\Exception\\TableExistsException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableExistsException.php', - 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableNotFoundException.php', - 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php', - 'Doctrine\\DBAL\\FetchMode' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/FetchMode.php', - 'Doctrine\\DBAL\\Id\\TableGenerator' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGenerator.php', - 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php', - 'Doctrine\\DBAL\\LockMode' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/LockMode.php', - 'Doctrine\\DBAL\\Logging\\DebugStack' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php', - 'Doctrine\\DBAL\\Logging\\EchoSQLLogger' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php', - 'Doctrine\\DBAL\\Logging\\LoggerChain' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php', - 'Doctrine\\DBAL\\Logging\\SQLLogger' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php', - 'Doctrine\\DBAL\\ParameterType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/ParameterType.php', - 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php', - 'Doctrine\\DBAL\\Platforms\\DB2Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php', - 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php', - 'Doctrine\\DBAL\\Platforms\\DrizzlePlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\DrizzleKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MsSQLKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQLKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL100Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL91Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL92Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQLKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere11Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere12Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere16Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhereKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2005Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2008Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServerKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php', - 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySqlPlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php', - 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL91Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL92Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSqlPlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere11Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere12Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere12Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere16Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAzurePlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2005Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2008Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServerPlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php', - 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php', - 'Doctrine\\DBAL\\Platforms\\TrimMode' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/TrimMode.php', - 'Doctrine\\DBAL\\Portability\\Connection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php', - 'Doctrine\\DBAL\\Portability\\OptimizeFlags' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/OptimizeFlags.php', - 'Doctrine\\DBAL\\Portability\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php', - 'Doctrine\\DBAL\\Query\\Expression\\CompositeExpression' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php', - 'Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php', - 'Doctrine\\DBAL\\Query\\QueryBuilder' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php', - 'Doctrine\\DBAL\\Query\\QueryException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php', - 'Doctrine\\DBAL\\SQLParserUtils' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php', - 'Doctrine\\DBAL\\SQLParserUtilsException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php', - 'Doctrine\\DBAL\\Schema\\AbstractAsset' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractAsset.php', - 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Column' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php', - 'Doctrine\\DBAL\\Schema\\ColumnDiff' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php', - 'Doctrine\\DBAL\\Schema\\Comparator' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php', - 'Doctrine\\DBAL\\Schema\\Constraint' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php', - 'Doctrine\\DBAL\\Schema\\DB2SchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php', - 'Doctrine\\DBAL\\Schema\\DrizzleSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\ForeignKeyConstraint' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php', - 'Doctrine\\DBAL\\Schema\\Identifier' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php', - 'Doctrine\\DBAL\\Schema\\Index' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php', - 'Doctrine\\DBAL\\Schema\\MySqlSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\OracleSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\PostgreSqlSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\SQLAnywhereSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\SQLServerSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Schema' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php', - 'Doctrine\\DBAL\\Schema\\SchemaConfig' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaConfig.php', - 'Doctrine\\DBAL\\Schema\\SchemaDiff' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaDiff.php', - 'Doctrine\\DBAL\\Schema\\SchemaException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php', - 'Doctrine\\DBAL\\Schema\\Sequence' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Sequence.php', - 'Doctrine\\DBAL\\Schema\\SqliteSchemaManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\AbstractSchemaSynchronizer' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\SchemaSynchronizer' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\SingleDatabaseSynchronizer' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Table' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php', - 'Doctrine\\DBAL\\Schema\\TableDiff' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/TableDiff.php', - 'Doctrine\\DBAL\\Schema\\View' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/View.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\AbstractVisitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/AbstractVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\CreateSchemaSqlCollector' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\DropSchemaSqlCollector' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\Graphviz' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\NamespaceVisitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\RemoveNamespacedAssets' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\SchemaDiffVisitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\Visitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Visitor.php', - 'Doctrine\\DBAL\\Sharding\\PoolingShardConnection' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php', - 'Doctrine\\DBAL\\Sharding\\PoolingShardManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardManager.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\SQLAzureFederationsSynchronizer' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\SQLAzureShardManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\Schema\\MultiTenantVisitor' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php', - 'Doctrine\\DBAL\\Sharding\\ShardChoser\\MultiTenantShardChoser' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/MultiTenantShardChoser.php', - 'Doctrine\\DBAL\\Sharding\\ShardChoser\\ShardChoser' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/ShardChoser.php', - 'Doctrine\\DBAL\\Sharding\\ShardManager' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardManager.php', - 'Doctrine\\DBAL\\Sharding\\ShardingException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardingException.php', - 'Doctrine\\DBAL\\Statement' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Statement.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\ImportCommand' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\RunSqlCommand' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionNotFound' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionNotFound.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php', - 'Doctrine\\DBAL\\Tools\\Console\\Helper\\ConnectionHelper' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php', - 'Doctrine\\DBAL\\Tools\\Dumper' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Dumper.php', - 'Doctrine\\DBAL\\TransactionIsolationLevel' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/TransactionIsolationLevel.php', - 'Doctrine\\DBAL\\Types\\ArrayType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ArrayType.php', - 'Doctrine\\DBAL\\Types\\AsciiStringType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/AsciiStringType.php', - 'Doctrine\\DBAL\\Types\\BigIntType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BigIntType.php', - 'Doctrine\\DBAL\\Types\\BinaryType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BinaryType.php', - 'Doctrine\\DBAL\\Types\\BlobType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BlobType.php', - 'Doctrine\\DBAL\\Types\\BooleanType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BooleanType.php', - 'Doctrine\\DBAL\\Types\\ConversionException' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ConversionException.php', - 'Doctrine\\DBAL\\Types\\DateImmutableType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateIntervalType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateIntervalType.php', - 'Doctrine\\DBAL\\Types\\DateTimeImmutableType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateTimeType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php', - 'Doctrine\\DBAL\\Types\\DateTimeTzImmutableType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateTimeTzType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzType.php', - 'Doctrine\\DBAL\\Types\\DateType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php', - 'Doctrine\\DBAL\\Types\\DecimalType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DecimalType.php', - 'Doctrine\\DBAL\\Types\\FloatType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/FloatType.php', - 'Doctrine\\DBAL\\Types\\GuidType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/GuidType.php', - 'Doctrine\\DBAL\\Types\\IntegerType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/IntegerType.php', - 'Doctrine\\DBAL\\Types\\JsonArrayType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php', - 'Doctrine\\DBAL\\Types\\JsonType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonType.php', - 'Doctrine\\DBAL\\Types\\ObjectType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ObjectType.php', - 'Doctrine\\DBAL\\Types\\PhpDateTimeMappingType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpDateTimeMappingType.php', - 'Doctrine\\DBAL\\Types\\PhpIntegerMappingType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpIntegerMappingType.php', - 'Doctrine\\DBAL\\Types\\SimpleArrayType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/SimpleArrayType.php', - 'Doctrine\\DBAL\\Types\\SmallIntType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/SmallIntType.php', - 'Doctrine\\DBAL\\Types\\StringType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/StringType.php', - 'Doctrine\\DBAL\\Types\\TextType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TextType.php', - 'Doctrine\\DBAL\\Types\\TimeImmutableType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\TimeType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeType.php', - 'Doctrine\\DBAL\\Types\\Type' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/Type.php', - 'Doctrine\\DBAL\\Types\\TypeRegistry' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TypeRegistry.php', - 'Doctrine\\DBAL\\Types\\Types' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php', - 'Doctrine\\DBAL\\Types\\VarDateTimeImmutableType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\VarDateTimeType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php', - 'Doctrine\\DBAL\\Version' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Version.php', - 'Doctrine\\DBAL\\VersionAwarePlatformDriver' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/VersionAwarePlatformDriver.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingNamedParameter' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingPositionalParameter' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php', + 'Doctrine\\DBAL\\Cache\\ArrayResult' => $vendorDir . '/doctrine/dbal/src/Cache/ArrayResult.php', + 'Doctrine\\DBAL\\Cache\\CacheException' => $vendorDir . '/doctrine/dbal/src/Cache/CacheException.php', + 'Doctrine\\DBAL\\Cache\\CachingResult' => $vendorDir . '/doctrine/dbal/src/Cache/CachingResult.php', + 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => $vendorDir . '/doctrine/dbal/src/Cache/QueryCacheProfile.php', + 'Doctrine\\DBAL\\ColumnCase' => $vendorDir . '/doctrine/dbal/src/ColumnCase.php', + 'Doctrine\\DBAL\\Configuration' => $vendorDir . '/doctrine/dbal/src/Configuration.php', + 'Doctrine\\DBAL\\Connection' => $vendorDir . '/doctrine/dbal/src/Connection.php', + 'Doctrine\\DBAL\\ConnectionException' => $vendorDir . '/doctrine/dbal/src/ConnectionException.php', + 'Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection' => $vendorDir . '/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php', + 'Doctrine\\DBAL\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver.php', + 'Doctrine\\DBAL\\DriverManager' => $vendorDir . '/doctrine/dbal/src/DriverManager.php', + 'Doctrine\\DBAL\\Driver\\API\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\IBMDB2\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\OCI\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLSrv\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLite\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractDB2Driver.php', + 'Doctrine\\DBAL\\Driver\\AbstractException' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractException.php', + 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractMySQLDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractOracleDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver\\EasyConnectString' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractOracleDriver/EasyConnectString.php', + 'Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver\\Exception\\PortWithoutHost' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php', + 'Doctrine\\DBAL\\Driver\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/Connection.php', + 'Doctrine\\DBAL\\Driver\\Exception' => $vendorDir . '/doctrine/dbal/src/Driver/Exception.php', + 'Doctrine\\DBAL\\Driver\\Exception\\UnknownParameterType' => $vendorDir . '/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php', + 'Doctrine\\DBAL\\Driver\\FetchUtils' => $vendorDir . '/doctrine/dbal/src/Driver/FetchUtils.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Connection.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\DataSourceName' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/DataSourceName.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Driver.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Result.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Statement.php', + 'Doctrine\\DBAL\\Driver\\Middleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Connection.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Driver.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\FailedReadingStreamOffset' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\HostRequired' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidCharset' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidOption' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\NonStreamResourceUsedAsLargeObject' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\StatementError' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Initializer.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Charset' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Options' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Options.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Secure' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Secure.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Result.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Statement.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Connection.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\ConvertPositionalToNamedPlaceholders' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Driver.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Exception/Error.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\NonTerminatedStringLiteral' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\SequenceDoesNotExist' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\UnknownParameterIndex' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\ExecutionMode' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/ExecutionMode.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Result.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/OCI8/Statement.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/Connection.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/Exception.php', + 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/OCI/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/Result.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLite\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/Statement.php', + 'Doctrine\\DBAL\\Driver\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/Result.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/Connection.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/Driver.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Exception\\Error' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\LastInsertId' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/LastInsertId.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/Result.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/SQLSrv/Statement.php', + 'Doctrine\\DBAL\\Driver\\ServerInfoAwareConnection' => $vendorDir . '/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php', + 'Doctrine\\DBAL\\Driver\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/Statement.php', + 'Doctrine\\DBAL\\Event\\ConnectionEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/ConnectionEventArgs.php', + 'Doctrine\\DBAL\\Event\\Listeners\\OracleSessionInit' => $vendorDir . '/doctrine/dbal/src/Event/Listeners/OracleSessionInit.php', + 'Doctrine\\DBAL\\Event\\Listeners\\SQLSessionInit' => $vendorDir . '/doctrine/dbal/src/Event/Listeners/SQLSessionInit.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableAddColumnEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableChangeColumnEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableRemoveColumnEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableRenameColumnEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaColumnDefinitionEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaCreateTableColumnEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaCreateTableEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Events' => $vendorDir . '/doctrine/dbal/src/Events.php', + 'Doctrine\\DBAL\\Exception' => $vendorDir . '/doctrine/dbal/src/Exception.php', + 'Doctrine\\DBAL\\Exception\\ConnectionException' => $vendorDir . '/doctrine/dbal/src/Exception/ConnectionException.php', + 'Doctrine\\DBAL\\Exception\\ConnectionLost' => $vendorDir . '/doctrine/dbal/src/Exception/ConnectionLost.php', + 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/ConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => $vendorDir . '/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => $vendorDir . '/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\DeadlockException' => $vendorDir . '/doctrine/dbal/src/Exception/DeadlockException.php', + 'Doctrine\\DBAL\\Exception\\DriverException' => $vendorDir . '/doctrine/dbal/src/Exception/DriverException.php', + 'Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\InvalidArgumentException' => $vendorDir . '/doctrine/dbal/src/Exception/InvalidArgumentException.php', + 'Doctrine\\DBAL\\Exception\\InvalidFieldNameException' => $vendorDir . '/doctrine/dbal/src/Exception/InvalidFieldNameException.php', + 'Doctrine\\DBAL\\Exception\\InvalidLockMode' => $vendorDir . '/doctrine/dbal/src/Exception/InvalidLockMode.php', + 'Doctrine\\DBAL\\Exception\\LockWaitTimeoutException' => $vendorDir . '/doctrine/dbal/src/Exception/LockWaitTimeoutException.php', + 'Doctrine\\DBAL\\Exception\\NoKeyValue' => $vendorDir . '/doctrine/dbal/src/Exception/NoKeyValue.php', + 'Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException' => $vendorDir . '/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php', + 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => $vendorDir . '/doctrine/dbal/src/Exception/ReadOnlyException.php', + 'Doctrine\\DBAL\\Exception\\RetryableException' => $vendorDir . '/doctrine/dbal/src/Exception/RetryableException.php', + 'Doctrine\\DBAL\\Exception\\ServerException' => $vendorDir . '/doctrine/dbal/src/Exception/ServerException.php', + 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => $vendorDir . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', + 'Doctrine\\DBAL\\Exception\\TableExistsException' => $vendorDir . '/doctrine/dbal/src/Exception/TableExistsException.php', + 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => $vendorDir . '/doctrine/dbal/src/Exception/TableNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/UniqueConstraintViolationException.php', + 'Doctrine\\DBAL\\ExpandArrayParameters' => $vendorDir . '/doctrine/dbal/src/ExpandArrayParameters.php', + 'Doctrine\\DBAL\\FetchMode' => $vendorDir . '/doctrine/dbal/src/FetchMode.php', + 'Doctrine\\DBAL\\Id\\TableGenerator' => $vendorDir . '/doctrine/dbal/src/Id/TableGenerator.php', + 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => $vendorDir . '/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php', + 'Doctrine\\DBAL\\LockMode' => $vendorDir . '/doctrine/dbal/src/LockMode.php', + 'Doctrine\\DBAL\\Logging\\DebugStack' => $vendorDir . '/doctrine/dbal/src/Logging/DebugStack.php', + 'Doctrine\\DBAL\\Logging\\LoggerChain' => $vendorDir . '/doctrine/dbal/src/Logging/LoggerChain.php', + 'Doctrine\\DBAL\\Logging\\SQLLogger' => $vendorDir . '/doctrine/dbal/src/Logging/SQLLogger.php', + 'Doctrine\\DBAL\\ParameterType' => $vendorDir . '/doctrine/dbal/src/ParameterType.php', + 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/AbstractPlatform.php', + 'Doctrine\\DBAL\\Platforms\\DB2Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/DB2Platform.php', + 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => $vendorDir . '/doctrine/dbal/src/Platforms/DateIntervalUnit.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/KeywordList.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQLKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQLKeywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php', + 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb1027Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL57Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL80Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQLPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQLPlatform.php', + 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/OraclePlatform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/SQLServer2012Platform.php', + 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/SqlitePlatform.php', + 'Doctrine\\DBAL\\Platforms\\TrimMode' => $vendorDir . '/doctrine/dbal/src/Platforms/TrimMode.php', + 'Doctrine\\DBAL\\Portability\\Connection' => $vendorDir . '/doctrine/dbal/src/Portability/Connection.php', + 'Doctrine\\DBAL\\Portability\\Converter' => $vendorDir . '/doctrine/dbal/src/Portability/Converter.php', + 'Doctrine\\DBAL\\Portability\\Driver' => $vendorDir . '/doctrine/dbal/src/Portability/Driver.php', + 'Doctrine\\DBAL\\Portability\\Middleware' => $vendorDir . '/doctrine/dbal/src/Portability/Middleware.php', + 'Doctrine\\DBAL\\Portability\\OptimizeFlags' => $vendorDir . '/doctrine/dbal/src/Portability/OptimizeFlags.php', + 'Doctrine\\DBAL\\Portability\\Result' => $vendorDir . '/doctrine/dbal/src/Portability/Result.php', + 'Doctrine\\DBAL\\Portability\\Statement' => $vendorDir . '/doctrine/dbal/src/Portability/Statement.php', + 'Doctrine\\DBAL\\Query' => $vendorDir . '/doctrine/dbal/src/Query.php', + 'Doctrine\\DBAL\\Query\\Expression\\CompositeExpression' => $vendorDir . '/doctrine/dbal/src/Query/Expression/CompositeExpression.php', + 'Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder' => $vendorDir . '/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php', + 'Doctrine\\DBAL\\Query\\QueryBuilder' => $vendorDir . '/doctrine/dbal/src/Query/QueryBuilder.php', + 'Doctrine\\DBAL\\Query\\QueryException' => $vendorDir . '/doctrine/dbal/src/Query/QueryException.php', + 'Doctrine\\DBAL\\Result' => $vendorDir . '/doctrine/dbal/src/Result.php', + 'Doctrine\\DBAL\\SQL\\Parser' => $vendorDir . '/doctrine/dbal/src/SQL/Parser.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Visitor' => $vendorDir . '/doctrine/dbal/src/SQL/Parser/Visitor.php', + 'Doctrine\\DBAL\\Schema\\AbstractAsset' => $vendorDir . '/doctrine/dbal/src/Schema/AbstractAsset.php', + 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/AbstractSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Column' => $vendorDir . '/doctrine/dbal/src/Schema/Column.php', + 'Doctrine\\DBAL\\Schema\\ColumnDiff' => $vendorDir . '/doctrine/dbal/src/Schema/ColumnDiff.php', + 'Doctrine\\DBAL\\Schema\\Comparator' => $vendorDir . '/doctrine/dbal/src/Schema/Comparator.php', + 'Doctrine\\DBAL\\Schema\\Constraint' => $vendorDir . '/doctrine/dbal/src/Schema/Constraint.php', + 'Doctrine\\DBAL\\Schema\\DB2SchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/DB2SchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Exception\\InvalidTableName' => $vendorDir . '/doctrine/dbal/src/Schema/Exception/InvalidTableName.php', + 'Doctrine\\DBAL\\Schema\\Exception\\UnknownColumnOption' => $vendorDir . '/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php', + 'Doctrine\\DBAL\\Schema\\ForeignKeyConstraint' => $vendorDir . '/doctrine/dbal/src/Schema/ForeignKeyConstraint.php', + 'Doctrine\\DBAL\\Schema\\Identifier' => $vendorDir . '/doctrine/dbal/src/Schema/Identifier.php', + 'Doctrine\\DBAL\\Schema\\Index' => $vendorDir . '/doctrine/dbal/src/Schema/Index.php', + 'Doctrine\\DBAL\\Schema\\MySQLSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/MySQLSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\OracleSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/OracleSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\PostgreSQLSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\SQLServerSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/SQLServerSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Schema' => $vendorDir . '/doctrine/dbal/src/Schema/Schema.php', + 'Doctrine\\DBAL\\Schema\\SchemaConfig' => $vendorDir . '/doctrine/dbal/src/Schema/SchemaConfig.php', + 'Doctrine\\DBAL\\Schema\\SchemaDiff' => $vendorDir . '/doctrine/dbal/src/Schema/SchemaDiff.php', + 'Doctrine\\DBAL\\Schema\\SchemaException' => $vendorDir . '/doctrine/dbal/src/Schema/SchemaException.php', + 'Doctrine\\DBAL\\Schema\\Sequence' => $vendorDir . '/doctrine/dbal/src/Schema/Sequence.php', + 'Doctrine\\DBAL\\Schema\\SqliteSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/SqliteSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Table' => $vendorDir . '/doctrine/dbal/src/Schema/Table.php', + 'Doctrine\\DBAL\\Schema\\TableDiff' => $vendorDir . '/doctrine/dbal/src/Schema/TableDiff.php', + 'Doctrine\\DBAL\\Schema\\UniqueConstraint' => $vendorDir . '/doctrine/dbal/src/Schema/UniqueConstraint.php', + 'Doctrine\\DBAL\\Schema\\View' => $vendorDir . '/doctrine/dbal/src/Schema/View.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\AbstractVisitor' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/AbstractVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\CreateSchemaSqlCollector' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\DropSchemaSqlCollector' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/DropSchemaSqlCollector.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\Graphviz' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/Graphviz.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\NamespaceVisitor' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/NamespaceVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\RemoveNamespacedAssets' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/RemoveNamespacedAssets.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\SchemaDiffVisitor' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/SchemaDiffVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\Visitor' => $vendorDir . '/doctrine/dbal/src/Schema/Visitor/Visitor.php', + 'Doctrine\\DBAL\\Statement' => $vendorDir . '/doctrine/dbal/src/Statement.php', + 'Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand' => $vendorDir . '/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php', + 'Doctrine\\DBAL\\Tools\\Console\\Command\\RunSqlCommand' => $vendorDir . '/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionNotFound' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConnectionNotFound.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConnectionProvider.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConsoleRunner.php', + 'Doctrine\\DBAL\\Tools\\Dumper' => $vendorDir . '/doctrine/dbal/src/Tools/Dumper.php', + 'Doctrine\\DBAL\\TransactionIsolationLevel' => $vendorDir . '/doctrine/dbal/src/TransactionIsolationLevel.php', + 'Doctrine\\DBAL\\Types\\ArrayType' => $vendorDir . '/doctrine/dbal/src/Types/ArrayType.php', + 'Doctrine\\DBAL\\Types\\AsciiStringType' => $vendorDir . '/doctrine/dbal/src/Types/AsciiStringType.php', + 'Doctrine\\DBAL\\Types\\BigIntType' => $vendorDir . '/doctrine/dbal/src/Types/BigIntType.php', + 'Doctrine\\DBAL\\Types\\BinaryType' => $vendorDir . '/doctrine/dbal/src/Types/BinaryType.php', + 'Doctrine\\DBAL\\Types\\BlobType' => $vendorDir . '/doctrine/dbal/src/Types/BlobType.php', + 'Doctrine\\DBAL\\Types\\BooleanType' => $vendorDir . '/doctrine/dbal/src/Types/BooleanType.php', + 'Doctrine\\DBAL\\Types\\ConversionException' => $vendorDir . '/doctrine/dbal/src/Types/ConversionException.php', + 'Doctrine\\DBAL\\Types\\DateImmutableType' => $vendorDir . '/doctrine/dbal/src/Types/DateImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateIntervalType' => $vendorDir . '/doctrine/dbal/src/Types/DateIntervalType.php', + 'Doctrine\\DBAL\\Types\\DateTimeImmutableType' => $vendorDir . '/doctrine/dbal/src/Types/DateTimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateTimeType' => $vendorDir . '/doctrine/dbal/src/Types/DateTimeType.php', + 'Doctrine\\DBAL\\Types\\DateTimeTzImmutableType' => $vendorDir . '/doctrine/dbal/src/Types/DateTimeTzImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateTimeTzType' => $vendorDir . '/doctrine/dbal/src/Types/DateTimeTzType.php', + 'Doctrine\\DBAL\\Types\\DateType' => $vendorDir . '/doctrine/dbal/src/Types/DateType.php', + 'Doctrine\\DBAL\\Types\\DecimalType' => $vendorDir . '/doctrine/dbal/src/Types/DecimalType.php', + 'Doctrine\\DBAL\\Types\\FloatType' => $vendorDir . '/doctrine/dbal/src/Types/FloatType.php', + 'Doctrine\\DBAL\\Types\\GuidType' => $vendorDir . '/doctrine/dbal/src/Types/GuidType.php', + 'Doctrine\\DBAL\\Types\\IntegerType' => $vendorDir . '/doctrine/dbal/src/Types/IntegerType.php', + 'Doctrine\\DBAL\\Types\\JsonType' => $vendorDir . '/doctrine/dbal/src/Types/JsonType.php', + 'Doctrine\\DBAL\\Types\\ObjectType' => $vendorDir . '/doctrine/dbal/src/Types/ObjectType.php', + 'Doctrine\\DBAL\\Types\\PhpDateTimeMappingType' => $vendorDir . '/doctrine/dbal/src/Types/PhpDateTimeMappingType.php', + 'Doctrine\\DBAL\\Types\\PhpIntegerMappingType' => $vendorDir . '/doctrine/dbal/src/Types/PhpIntegerMappingType.php', + 'Doctrine\\DBAL\\Types\\SimpleArrayType' => $vendorDir . '/doctrine/dbal/src/Types/SimpleArrayType.php', + 'Doctrine\\DBAL\\Types\\SmallIntType' => $vendorDir . '/doctrine/dbal/src/Types/SmallIntType.php', + 'Doctrine\\DBAL\\Types\\StringType' => $vendorDir . '/doctrine/dbal/src/Types/StringType.php', + 'Doctrine\\DBAL\\Types\\TextType' => $vendorDir . '/doctrine/dbal/src/Types/TextType.php', + 'Doctrine\\DBAL\\Types\\TimeImmutableType' => $vendorDir . '/doctrine/dbal/src/Types/TimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\TimeType' => $vendorDir . '/doctrine/dbal/src/Types/TimeType.php', + 'Doctrine\\DBAL\\Types\\Type' => $vendorDir . '/doctrine/dbal/src/Types/Type.php', + 'Doctrine\\DBAL\\Types\\TypeRegistry' => $vendorDir . '/doctrine/dbal/src/Types/TypeRegistry.php', + 'Doctrine\\DBAL\\Types\\Types' => $vendorDir . '/doctrine/dbal/src/Types/Types.php', + 'Doctrine\\DBAL\\Types\\VarDateTimeImmutableType' => $vendorDir . '/doctrine/dbal/src/Types/VarDateTimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\VarDateTimeType' => $vendorDir . '/doctrine/dbal/src/Types/VarDateTimeType.php', + 'Doctrine\\DBAL\\VersionAwarePlatformDriver' => $vendorDir . '/doctrine/dbal/src/VersionAwarePlatformDriver.php', 'Ds\\Collection' => $vendorDir . '/php-ds/php-ds/src/Collection.php', 'Ds\\Deque' => $vendorDir . '/php-ds/php-ds/src/Deque.php', 'Ds\\Hashable' => $vendorDir . '/php-ds/php-ds/src/Hashable.php', @@ -1762,6 +1714,9 @@ 'PEAR' => $vendorDir . '/pear/pear-core-minimal/src/PEAR.php', 'PEAR_ErrorStack' => $vendorDir . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php', 'PEAR_Exception' => $vendorDir . '/pear/pear_exception/PEAR/Exception.php', + 'PackageVersions\\FallbackVersions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php', + 'PackageVersions\\Installer' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php', + 'PackageVersions\\Versions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php', 'Patchwork\\JSqueeze' => $vendorDir . '/patchwork/jsqueeze/src/JSqueeze.php', 'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', diff --git a/composer/autoload_psr4.php b/composer/autoload_psr4.php index 015c0f732..ae3431a1a 100644 --- a/composer/autoload_psr4.php +++ b/composer/autoload_psr4.php @@ -50,6 +50,7 @@ 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), 'Patchwork\\' => array($vendorDir . '/patchwork/jsqueeze/src'), + 'PackageVersions\\' => array($vendorDir . '/composer/package-versions-deprecated/src/PackageVersions'), 'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'), 'OpenStack\\' => array($vendorDir . '/php-opencloud/openstack/src'), 'Nextcloud\\LogNormalizer\\' => array($vendorDir . '/nextcloud/lognormalizer/src'), @@ -72,7 +73,7 @@ 'FG\\' => array($vendorDir . '/fgrosse/phpasn1/lib'), 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/src'), 'Ds\\' => array($vendorDir . '/php-ds/php-ds/src'), - 'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL'), + 'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/src'), 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'), 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/lib/Doctrine/Common'), diff --git a/composer/autoload_static.php b/composer/autoload_static.php index dea856cd1..62e993ed4 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -107,6 +107,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Psr\\Container\\' => 14, 'PhpParser\\' => 10, 'Patchwork\\' => 10, + 'PackageVersions\\' => 16, ), 'O' => array ( @@ -361,6 +362,10 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 array ( 0 => __DIR__ . '/..' . '/patchwork/jsqueeze/src', ), + 'PackageVersions\\' => + array ( + 0 => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions', + ), 'Opis\\Closure\\' => array ( 0 => __DIR__ . '/..' . '/opis/closure/src', @@ -453,7 +458,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 ), 'Doctrine\\DBAL\\' => array ( - 0 => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL', + 0 => __DIR__ . '/..' . '/doctrine/dbal/src', ), 'Doctrine\\Common\\Lexer\\' => array ( @@ -1294,312 +1299,264 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\Common\\EventManager' => __DIR__ . '/..' . '/doctrine/event-manager/lib/Doctrine/Common/EventManager.php', 'Doctrine\\Common\\EventSubscriber' => __DIR__ . '/..' . '/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.php', 'Doctrine\\Common\\Lexer\\AbstractLexer' => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', - 'Doctrine\\DBAL\\Abstraction\\Result' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Abstraction/Result.php', - 'Doctrine\\DBAL\\Cache\\ArrayStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php', - 'Doctrine\\DBAL\\Cache\\CacheException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php', - 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php', - 'Doctrine\\DBAL\\Cache\\ResultCacheStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php', - 'Doctrine\\DBAL\\ColumnCase' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/ColumnCase.php', - 'Doctrine\\DBAL\\Configuration' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php', - 'Doctrine\\DBAL\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Connection.php', - 'Doctrine\\DBAL\\ConnectionException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php', - 'Doctrine\\DBAL\\Connections\\MasterSlaveConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php', - 'Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Connections/PrimaryReadReplicaConnection.php', - 'Doctrine\\DBAL\\DBALException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php', - 'Doctrine\\DBAL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver.php', - 'Doctrine\\DBAL\\DriverManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php', - 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDB2Driver.php', - 'Doctrine\\DBAL\\Driver\\AbstractDriverException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php', - 'Doctrine\\DBAL\\Driver\\AbstractException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractException.php', - 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver\\EasyConnectString' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver/EasyConnectString.php', - 'Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLAnywhereDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver\\Exception\\PortWithoutHost' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php', - 'Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php', - 'Doctrine\\DBAL\\Driver\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Connection.php', - 'Doctrine\\DBAL\\Driver\\DriverException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php', - 'Doctrine\\DBAL\\Driver\\DrizzlePDOMySql\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php', - 'Doctrine\\DBAL\\Driver\\DrizzlePDOMySql\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php', - 'Doctrine\\DBAL\\Driver\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Exception.php', - 'Doctrine\\DBAL\\Driver\\ExceptionConverterDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php', - 'Doctrine\\DBAL\\Driver\\FetchUtils' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/FetchUtils.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Connection.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Exception' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\DataSourceName' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DataSourceName.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Driver.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionError.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionFailed.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/PrepareFailed.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/StatementError.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Statement.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Connection.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\FailedReadingStreamOffset' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/FailedReadingStreamOffset.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidOption' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/InvalidOption.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\StatementError' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/StatementError.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\UnknownType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/UnknownType.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php', - 'Doctrine\\DBAL\\Driver\\Mysqli\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Statement.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Connection.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\NonTerminatedStringLiteral' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/NonTerminatedStringLiteral.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\SequenceDoesNotExist' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/SequenceDoesNotExist.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\UnknownParameterIndex' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Exception/UnknownParameterIndex.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Exception' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\OCI8Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php', - 'Doctrine\\DBAL\\Driver\\OCI8\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDOConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php', - 'Doctrine\\DBAL\\Driver\\PDOException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php', - 'Doctrine\\DBAL\\Driver\\PDOIbm\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOOracle\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOQueryImplementation' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlite\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDOStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php', - 'Doctrine\\DBAL\\Driver\\PDOStatementImplementations' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatementImplementations.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php', - 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/MySQL/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/OCI/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/PgSQL/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLSrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\PDO\\SQLite\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/SQLite/Driver.php', - 'Doctrine\\DBAL\\Driver\\PDO\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Statement.php', - 'Doctrine\\DBAL\\Driver\\PingableConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php', - 'Doctrine\\DBAL\\Driver\\Result' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Result.php', - 'Doctrine\\DBAL\\Driver\\ResultStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php', - 'Doctrine\\DBAL\\Driver\\SQLAnywhere\\SQLAnywhereStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Connection.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Exception\\Error' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Exception/Error.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\LastInsertId' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvStatement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php', - 'Doctrine\\DBAL\\Driver\\SQLSrv\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Statement.php', - 'Doctrine\\DBAL\\Driver\\ServerInfoAwareConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/ServerInfoAwareConnection.php', - 'Doctrine\\DBAL\\Driver\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.php', - 'Doctrine\\DBAL\\Driver\\StatementIterator' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Driver/StatementIterator.php', - 'Doctrine\\DBAL\\Event\\ConnectionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php', - 'Doctrine\\DBAL\\Event\\Listeners\\MysqlSessionInit' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php', - 'Doctrine\\DBAL\\Event\\Listeners\\OracleSessionInit' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php', - 'Doctrine\\DBAL\\Event\\Listeners\\SQLSessionInit' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableAddColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableChangeColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableRemoveColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaAlterTableRenameColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaColumnDefinitionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaCreateTableColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaCreateTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php', - 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php', - 'Doctrine\\DBAL\\Events' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Events.php', - 'Doctrine\\DBAL\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception.php', - 'Doctrine\\DBAL\\Exception\\ConnectionException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionException.php', - 'Doctrine\\DBAL\\Exception\\ConnectionLost' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionLost.php', - 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php', - 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php', - 'Doctrine\\DBAL\\Exception\\DeadlockException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DeadlockException.php', - 'Doctrine\\DBAL\\Exception\\DriverException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/DriverException.php', - 'Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php', - 'Doctrine\\DBAL\\Exception\\InvalidFieldNameException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php', - 'Doctrine\\DBAL\\Exception\\LockWaitTimeoutException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php', - 'Doctrine\\DBAL\\Exception\\NoKeyValue' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NoKeyValue.php', - 'Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php', - 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php', - 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ReadOnlyException.php', - 'Doctrine\\DBAL\\Exception\\RetryableException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/RetryableException.php', - 'Doctrine\\DBAL\\Exception\\ServerException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/ServerException.php', - 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php', - 'Doctrine\\DBAL\\Exception\\TableExistsException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableExistsException.php', - 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableNotFoundException.php', - 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php', - 'Doctrine\\DBAL\\FetchMode' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/FetchMode.php', - 'Doctrine\\DBAL\\Id\\TableGenerator' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGenerator.php', - 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php', - 'Doctrine\\DBAL\\LockMode' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/LockMode.php', - 'Doctrine\\DBAL\\Logging\\DebugStack' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php', - 'Doctrine\\DBAL\\Logging\\EchoSQLLogger' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php', - 'Doctrine\\DBAL\\Logging\\LoggerChain' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php', - 'Doctrine\\DBAL\\Logging\\SQLLogger' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php', - 'Doctrine\\DBAL\\ParameterType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/ParameterType.php', - 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php', - 'Doctrine\\DBAL\\Platforms\\DB2Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php', - 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php', - 'Doctrine\\DBAL\\Platforms\\DrizzlePlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\DrizzleKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MsSQLKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQLKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL100Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL91Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL92Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQLKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere11Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere12Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere12Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhere16Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere16Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLAnywhereKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhereKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2005Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2008Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServerKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php', - 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php', - 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php', - 'Doctrine\\DBAL\\Platforms\\MySqlPlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php', - 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL91Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL92Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php', - 'Doctrine\\DBAL\\Platforms\\PostgreSqlPlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere11Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere12Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere12Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywhere16Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLAzurePlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2005Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2008Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php', - 'Doctrine\\DBAL\\Platforms\\SQLServerPlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php', - 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php', - 'Doctrine\\DBAL\\Platforms\\TrimMode' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Platforms/TrimMode.php', - 'Doctrine\\DBAL\\Portability\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php', - 'Doctrine\\DBAL\\Portability\\OptimizeFlags' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/OptimizeFlags.php', - 'Doctrine\\DBAL\\Portability\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php', - 'Doctrine\\DBAL\\Query\\Expression\\CompositeExpression' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php', - 'Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php', - 'Doctrine\\DBAL\\Query\\QueryBuilder' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php', - 'Doctrine\\DBAL\\Query\\QueryException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php', - 'Doctrine\\DBAL\\SQLParserUtils' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php', - 'Doctrine\\DBAL\\SQLParserUtilsException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php', - 'Doctrine\\DBAL\\Schema\\AbstractAsset' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractAsset.php', - 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Column' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php', - 'Doctrine\\DBAL\\Schema\\ColumnDiff' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php', - 'Doctrine\\DBAL\\Schema\\Comparator' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php', - 'Doctrine\\DBAL\\Schema\\Constraint' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php', - 'Doctrine\\DBAL\\Schema\\DB2SchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php', - 'Doctrine\\DBAL\\Schema\\DrizzleSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\ForeignKeyConstraint' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php', - 'Doctrine\\DBAL\\Schema\\Identifier' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php', - 'Doctrine\\DBAL\\Schema\\Index' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php', - 'Doctrine\\DBAL\\Schema\\MySqlSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\OracleSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\PostgreSqlSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\SQLAnywhereSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\SQLServerSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Schema' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php', - 'Doctrine\\DBAL\\Schema\\SchemaConfig' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaConfig.php', - 'Doctrine\\DBAL\\Schema\\SchemaDiff' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaDiff.php', - 'Doctrine\\DBAL\\Schema\\SchemaException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php', - 'Doctrine\\DBAL\\Schema\\Sequence' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Sequence.php', - 'Doctrine\\DBAL\\Schema\\SqliteSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\AbstractSchemaSynchronizer' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\SchemaSynchronizer' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Synchronizer\\SingleDatabaseSynchronizer' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php', - 'Doctrine\\DBAL\\Schema\\Table' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php', - 'Doctrine\\DBAL\\Schema\\TableDiff' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/TableDiff.php', - 'Doctrine\\DBAL\\Schema\\View' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/View.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\AbstractVisitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/AbstractVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\CreateSchemaSqlCollector' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\DropSchemaSqlCollector' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\Graphviz' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\NamespaceVisitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\RemoveNamespacedAssets' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\SchemaDiffVisitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php', - 'Doctrine\\DBAL\\Schema\\Visitor\\Visitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Visitor.php', - 'Doctrine\\DBAL\\Sharding\\PoolingShardConnection' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php', - 'Doctrine\\DBAL\\Sharding\\PoolingShardManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardManager.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\SQLAzureFederationsSynchronizer' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\SQLAzureShardManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php', - 'Doctrine\\DBAL\\Sharding\\SQLAzure\\Schema\\MultiTenantVisitor' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php', - 'Doctrine\\DBAL\\Sharding\\ShardChoser\\MultiTenantShardChoser' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/MultiTenantShardChoser.php', - 'Doctrine\\DBAL\\Sharding\\ShardChoser\\ShardChoser' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/ShardChoser.php', - 'Doctrine\\DBAL\\Sharding\\ShardManager' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardManager.php', - 'Doctrine\\DBAL\\Sharding\\ShardingException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardingException.php', - 'Doctrine\\DBAL\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Statement.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\ImportCommand' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\Command\\RunSqlCommand' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionNotFound' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionNotFound.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', - 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php', - 'Doctrine\\DBAL\\Tools\\Console\\Helper\\ConnectionHelper' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php', - 'Doctrine\\DBAL\\Tools\\Dumper' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Tools/Dumper.php', - 'Doctrine\\DBAL\\TransactionIsolationLevel' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/TransactionIsolationLevel.php', - 'Doctrine\\DBAL\\Types\\ArrayType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ArrayType.php', - 'Doctrine\\DBAL\\Types\\AsciiStringType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/AsciiStringType.php', - 'Doctrine\\DBAL\\Types\\BigIntType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BigIntType.php', - 'Doctrine\\DBAL\\Types\\BinaryType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BinaryType.php', - 'Doctrine\\DBAL\\Types\\BlobType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BlobType.php', - 'Doctrine\\DBAL\\Types\\BooleanType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/BooleanType.php', - 'Doctrine\\DBAL\\Types\\ConversionException' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ConversionException.php', - 'Doctrine\\DBAL\\Types\\DateImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateIntervalType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateIntervalType.php', - 'Doctrine\\DBAL\\Types\\DateTimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateTimeType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php', - 'Doctrine\\DBAL\\Types\\DateTimeTzImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php', - 'Doctrine\\DBAL\\Types\\DateTimeTzType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzType.php', - 'Doctrine\\DBAL\\Types\\DateType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php', - 'Doctrine\\DBAL\\Types\\DecimalType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/DecimalType.php', - 'Doctrine\\DBAL\\Types\\FloatType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/FloatType.php', - 'Doctrine\\DBAL\\Types\\GuidType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/GuidType.php', - 'Doctrine\\DBAL\\Types\\IntegerType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/IntegerType.php', - 'Doctrine\\DBAL\\Types\\JsonArrayType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php', - 'Doctrine\\DBAL\\Types\\JsonType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonType.php', - 'Doctrine\\DBAL\\Types\\ObjectType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/ObjectType.php', - 'Doctrine\\DBAL\\Types\\PhpDateTimeMappingType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpDateTimeMappingType.php', - 'Doctrine\\DBAL\\Types\\PhpIntegerMappingType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpIntegerMappingType.php', - 'Doctrine\\DBAL\\Types\\SimpleArrayType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/SimpleArrayType.php', - 'Doctrine\\DBAL\\Types\\SmallIntType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/SmallIntType.php', - 'Doctrine\\DBAL\\Types\\StringType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/StringType.php', - 'Doctrine\\DBAL\\Types\\TextType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TextType.php', - 'Doctrine\\DBAL\\Types\\TimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\TimeType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeType.php', - 'Doctrine\\DBAL\\Types\\Type' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/Type.php', - 'Doctrine\\DBAL\\Types\\TypeRegistry' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/TypeRegistry.php', - 'Doctrine\\DBAL\\Types\\Types' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php', - 'Doctrine\\DBAL\\Types\\VarDateTimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php', - 'Doctrine\\DBAL\\Types\\VarDateTimeType' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php', - 'Doctrine\\DBAL\\Version' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/Version.php', - 'Doctrine\\DBAL\\VersionAwarePlatformDriver' => __DIR__ . '/..' . '/doctrine/dbal/lib/Doctrine/DBAL/VersionAwarePlatformDriver.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingNamedParameter' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php', + 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingPositionalParameter' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php', + 'Doctrine\\DBAL\\Cache\\ArrayResult' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/ArrayResult.php', + 'Doctrine\\DBAL\\Cache\\CacheException' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/CacheException.php', + 'Doctrine\\DBAL\\Cache\\CachingResult' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/CachingResult.php', + 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/QueryCacheProfile.php', + 'Doctrine\\DBAL\\ColumnCase' => __DIR__ . '/..' . '/doctrine/dbal/src/ColumnCase.php', + 'Doctrine\\DBAL\\Configuration' => __DIR__ . '/..' . '/doctrine/dbal/src/Configuration.php', + 'Doctrine\\DBAL\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Connection.php', + 'Doctrine\\DBAL\\ConnectionException' => __DIR__ . '/..' . '/doctrine/dbal/src/ConnectionException.php', + 'Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection' => __DIR__ . '/..' . '/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php', + 'Doctrine\\DBAL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver.php', + 'Doctrine\\DBAL\\DriverManager' => __DIR__ . '/..' . '/doctrine/dbal/src/DriverManager.php', + 'Doctrine\\DBAL\\Driver\\API\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\IBMDB2\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\OCI\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLSrv\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLite\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractDB2Driver.php', + 'Doctrine\\DBAL\\Driver\\AbstractException' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractException.php', + 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractMySQLDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractOracleDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractOracleDriver\\EasyConnectString' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractOracleDriver/EasyConnectString.php', + 'Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLServerDriver\\Exception\\PortWithoutHost' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php', + 'Doctrine\\DBAL\\Driver\\AbstractSQLiteDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php', + 'Doctrine\\DBAL\\Driver\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Connection.php', + 'Doctrine\\DBAL\\Driver\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Exception.php', + 'Doctrine\\DBAL\\Driver\\Exception\\UnknownParameterType' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php', + 'Doctrine\\DBAL\\Driver\\FetchUtils' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/FetchUtils.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Connection.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\DataSourceName' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/DataSourceName.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Driver.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Result.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Statement.php', + 'Doctrine\\DBAL\\Driver\\Middleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Connection.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Driver.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\FailedReadingStreamOffset' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\HostRequired' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidCharset' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\InvalidOption' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\NonStreamResourceUsedAsLargeObject' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\StatementError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Initializer.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Charset' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Options' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Options.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Initializer\\Secure' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Initializer/Secure.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Result.php', + 'Doctrine\\DBAL\\Driver\\Mysqli\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Statement.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Connection.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\ConvertPositionalToNamedPlaceholders' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Driver.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\Error' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Exception/Error.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\NonTerminatedStringLiteral' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\SequenceDoesNotExist' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Exception\\UnknownParameterIndex' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\ExecutionMode' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/ExecutionMode.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Result.php', + 'Doctrine\\DBAL\\Driver\\OCI8\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/OCI8/Statement.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/Connection.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/Exception.php', + 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/OCI/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/Result.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLSrv\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php', + 'Doctrine\\DBAL\\Driver\\PDO\\SQLite\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/Statement.php', + 'Doctrine\\DBAL\\Driver\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Result.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/Connection.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/Driver.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Exception\\Error' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\LastInsertId' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/LastInsertId.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/Result.php', + 'Doctrine\\DBAL\\Driver\\SQLSrv\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/SQLSrv/Statement.php', + 'Doctrine\\DBAL\\Driver\\ServerInfoAwareConnection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php', + 'Doctrine\\DBAL\\Driver\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Statement.php', + 'Doctrine\\DBAL\\Event\\ConnectionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/ConnectionEventArgs.php', + 'Doctrine\\DBAL\\Event\\Listeners\\OracleSessionInit' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/Listeners/OracleSessionInit.php', + 'Doctrine\\DBAL\\Event\\Listeners\\SQLSessionInit' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/Listeners/SQLSessionInit.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableAddColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableChangeColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableRemoveColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaAlterTableRenameColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaColumnDefinitionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaCreateTableColumnEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaCreateTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaEventArgs.php', + 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Events' => __DIR__ . '/..' . '/doctrine/dbal/src/Events.php', + 'Doctrine\\DBAL\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception.php', + 'Doctrine\\DBAL\\Exception\\ConnectionException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConnectionException.php', + 'Doctrine\\DBAL\\Exception\\ConnectionLost' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConnectionLost.php', + 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\DeadlockException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DeadlockException.php', + 'Doctrine\\DBAL\\Exception\\DriverException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DriverException.php', + 'Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/InvalidArgumentException.php', + 'Doctrine\\DBAL\\Exception\\InvalidFieldNameException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/InvalidFieldNameException.php', + 'Doctrine\\DBAL\\Exception\\InvalidLockMode' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/InvalidLockMode.php', + 'Doctrine\\DBAL\\Exception\\LockWaitTimeoutException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/LockWaitTimeoutException.php', + 'Doctrine\\DBAL\\Exception\\NoKeyValue' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/NoKeyValue.php', + 'Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php', + 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ReadOnlyException.php', + 'Doctrine\\DBAL\\Exception\\RetryableException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/RetryableException.php', + 'Doctrine\\DBAL\\Exception\\ServerException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ServerException.php', + 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', + 'Doctrine\\DBAL\\Exception\\TableExistsException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TableExistsException.php', + 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TableNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/UniqueConstraintViolationException.php', + 'Doctrine\\DBAL\\ExpandArrayParameters' => __DIR__ . '/..' . '/doctrine/dbal/src/ExpandArrayParameters.php', + 'Doctrine\\DBAL\\FetchMode' => __DIR__ . '/..' . '/doctrine/dbal/src/FetchMode.php', + 'Doctrine\\DBAL\\Id\\TableGenerator' => __DIR__ . '/..' . '/doctrine/dbal/src/Id/TableGenerator.php', + 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php', + 'Doctrine\\DBAL\\LockMode' => __DIR__ . '/..' . '/doctrine/dbal/src/LockMode.php', + 'Doctrine\\DBAL\\Logging\\DebugStack' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/DebugStack.php', + 'Doctrine\\DBAL\\Logging\\LoggerChain' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/LoggerChain.php', + 'Doctrine\\DBAL\\Logging\\SQLLogger' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/SQLLogger.php', + 'Doctrine\\DBAL\\ParameterType' => __DIR__ . '/..' . '/doctrine/dbal/src/ParameterType.php', + 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/AbstractPlatform.php', + 'Doctrine\\DBAL\\Platforms\\DB2Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/DB2Platform.php', + 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/DateIntervalUnit.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/KeywordList.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQLKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQLKeywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php', + 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb1027Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL57Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL80Platform.php', + 'Doctrine\\DBAL\\Platforms\\MySQLPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQLPlatform.php', + 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/OraclePlatform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SQLServer2012Platform.php', + 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SqlitePlatform.php', + 'Doctrine\\DBAL\\Platforms\\TrimMode' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/TrimMode.php', + 'Doctrine\\DBAL\\Portability\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Connection.php', + 'Doctrine\\DBAL\\Portability\\Converter' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Converter.php', + 'Doctrine\\DBAL\\Portability\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Driver.php', + 'Doctrine\\DBAL\\Portability\\Middleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Middleware.php', + 'Doctrine\\DBAL\\Portability\\OptimizeFlags' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/OptimizeFlags.php', + 'Doctrine\\DBAL\\Portability\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Result.php', + 'Doctrine\\DBAL\\Portability\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Statement.php', + 'Doctrine\\DBAL\\Query' => __DIR__ . '/..' . '/doctrine/dbal/src/Query.php', + 'Doctrine\\DBAL\\Query\\Expression\\CompositeExpression' => __DIR__ . '/..' . '/doctrine/dbal/src/Query/Expression/CompositeExpression.php', + 'Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder' => __DIR__ . '/..' . '/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php', + 'Doctrine\\DBAL\\Query\\QueryBuilder' => __DIR__ . '/..' . '/doctrine/dbal/src/Query/QueryBuilder.php', + 'Doctrine\\DBAL\\Query\\QueryException' => __DIR__ . '/..' . '/doctrine/dbal/src/Query/QueryException.php', + 'Doctrine\\DBAL\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Result.php', + 'Doctrine\\DBAL\\SQL\\Parser' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Visitor' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser/Visitor.php', + 'Doctrine\\DBAL\\Schema\\AbstractAsset' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/AbstractAsset.php', + 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/AbstractSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Column' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Column.php', + 'Doctrine\\DBAL\\Schema\\ColumnDiff' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/ColumnDiff.php', + 'Doctrine\\DBAL\\Schema\\Comparator' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Comparator.php', + 'Doctrine\\DBAL\\Schema\\Constraint' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Constraint.php', + 'Doctrine\\DBAL\\Schema\\DB2SchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/DB2SchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Exception\\InvalidTableName' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Exception/InvalidTableName.php', + 'Doctrine\\DBAL\\Schema\\Exception\\UnknownColumnOption' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php', + 'Doctrine\\DBAL\\Schema\\ForeignKeyConstraint' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/ForeignKeyConstraint.php', + 'Doctrine\\DBAL\\Schema\\Identifier' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Identifier.php', + 'Doctrine\\DBAL\\Schema\\Index' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Index.php', + 'Doctrine\\DBAL\\Schema\\MySQLSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/MySQLSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\OracleSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/OracleSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\PostgreSQLSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\SQLServerSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/SQLServerSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Schema' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Schema.php', + 'Doctrine\\DBAL\\Schema\\SchemaConfig' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/SchemaConfig.php', + 'Doctrine\\DBAL\\Schema\\SchemaDiff' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/SchemaDiff.php', + 'Doctrine\\DBAL\\Schema\\SchemaException' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/SchemaException.php', + 'Doctrine\\DBAL\\Schema\\Sequence' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Sequence.php', + 'Doctrine\\DBAL\\Schema\\SqliteSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/SqliteSchemaManager.php', + 'Doctrine\\DBAL\\Schema\\Table' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Table.php', + 'Doctrine\\DBAL\\Schema\\TableDiff' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/TableDiff.php', + 'Doctrine\\DBAL\\Schema\\UniqueConstraint' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/UniqueConstraint.php', + 'Doctrine\\DBAL\\Schema\\View' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/View.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\AbstractVisitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/AbstractVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\CreateSchemaSqlCollector' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\DropSchemaSqlCollector' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/DropSchemaSqlCollector.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\Graphviz' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/Graphviz.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\NamespaceVisitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/NamespaceVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\RemoveNamespacedAssets' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/RemoveNamespacedAssets.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\SchemaDiffVisitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/SchemaDiffVisitor.php', + 'Doctrine\\DBAL\\Schema\\Visitor\\Visitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/Visitor/Visitor.php', + 'Doctrine\\DBAL\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Statement.php', + 'Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php', + 'Doctrine\\DBAL\\Tools\\Console\\Command\\RunSqlCommand' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionNotFound' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConnectionNotFound.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConnectionProvider.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', + 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConsoleRunner.php', + 'Doctrine\\DBAL\\Tools\\Dumper' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Dumper.php', + 'Doctrine\\DBAL\\TransactionIsolationLevel' => __DIR__ . '/..' . '/doctrine/dbal/src/TransactionIsolationLevel.php', + 'Doctrine\\DBAL\\Types\\ArrayType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/ArrayType.php', + 'Doctrine\\DBAL\\Types\\AsciiStringType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/AsciiStringType.php', + 'Doctrine\\DBAL\\Types\\BigIntType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/BigIntType.php', + 'Doctrine\\DBAL\\Types\\BinaryType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/BinaryType.php', + 'Doctrine\\DBAL\\Types\\BlobType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/BlobType.php', + 'Doctrine\\DBAL\\Types\\BooleanType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/BooleanType.php', + 'Doctrine\\DBAL\\Types\\ConversionException' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/ConversionException.php', + 'Doctrine\\DBAL\\Types\\DateImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateIntervalType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateIntervalType.php', + 'Doctrine\\DBAL\\Types\\DateTimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateTimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateTimeType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateTimeType.php', + 'Doctrine\\DBAL\\Types\\DateTimeTzImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateTimeTzImmutableType.php', + 'Doctrine\\DBAL\\Types\\DateTimeTzType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateTimeTzType.php', + 'Doctrine\\DBAL\\Types\\DateType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DateType.php', + 'Doctrine\\DBAL\\Types\\DecimalType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/DecimalType.php', + 'Doctrine\\DBAL\\Types\\FloatType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/FloatType.php', + 'Doctrine\\DBAL\\Types\\GuidType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/GuidType.php', + 'Doctrine\\DBAL\\Types\\IntegerType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/IntegerType.php', + 'Doctrine\\DBAL\\Types\\JsonType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/JsonType.php', + 'Doctrine\\DBAL\\Types\\ObjectType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/ObjectType.php', + 'Doctrine\\DBAL\\Types\\PhpDateTimeMappingType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/PhpDateTimeMappingType.php', + 'Doctrine\\DBAL\\Types\\PhpIntegerMappingType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/PhpIntegerMappingType.php', + 'Doctrine\\DBAL\\Types\\SimpleArrayType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/SimpleArrayType.php', + 'Doctrine\\DBAL\\Types\\SmallIntType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/SmallIntType.php', + 'Doctrine\\DBAL\\Types\\StringType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/StringType.php', + 'Doctrine\\DBAL\\Types\\TextType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/TextType.php', + 'Doctrine\\DBAL\\Types\\TimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/TimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\TimeType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/TimeType.php', + 'Doctrine\\DBAL\\Types\\Type' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/Type.php', + 'Doctrine\\DBAL\\Types\\TypeRegistry' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/TypeRegistry.php', + 'Doctrine\\DBAL\\Types\\Types' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/Types.php', + 'Doctrine\\DBAL\\Types\\VarDateTimeImmutableType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/VarDateTimeImmutableType.php', + 'Doctrine\\DBAL\\Types\\VarDateTimeType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/VarDateTimeType.php', + 'Doctrine\\DBAL\\VersionAwarePlatformDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/VersionAwarePlatformDriver.php', 'Ds\\Collection' => __DIR__ . '/..' . '/php-ds/php-ds/src/Collection.php', 'Ds\\Deque' => __DIR__ . '/..' . '/php-ds/php-ds/src/Deque.php', 'Ds\\Hashable' => __DIR__ . '/..' . '/php-ds/php-ds/src/Hashable.php', @@ -2274,6 +2231,9 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'PEAR' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR.php', 'PEAR_ErrorStack' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php', 'PEAR_Exception' => __DIR__ . '/..' . '/pear/pear_exception/PEAR/Exception.php', + 'PackageVersions\\FallbackVersions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php', + 'PackageVersions\\Installer' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php', + 'PackageVersions\\Versions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php', 'Patchwork\\JSqueeze' => __DIR__ . '/..' . '/patchwork/jsqueeze/src/JSqueeze.php', 'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', diff --git a/composer/installed.json b/composer/installed.json index cdb0dcd32..7806fbb62 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -224,6 +224,82 @@ ], "install-path": "../christophwurst/id3parser" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.1", + "version_normalized": "1.11.99.1", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "time": "2020-11-11T10:22:58+00:00", + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "install-path": "./package-versions-deprecated" + }, { "name": "deepdiver/zipstreamer", "version": "2.0.0", @@ -343,17 +419,17 @@ }, { "name": "doctrine/cache", - "version": "1.10.1", - "version_normalized": "1.10.1.0", + "version": "1.10.2", + "version_normalized": "1.10.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3" + "reference": "13e3381b25847283a91948d04640543941309727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3", - "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727", + "reference": "13e3381b25847283a91948d04640543941309727", "shasum": "" }, "require": { @@ -372,7 +448,7 @@ "suggest": { "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" }, - "time": "2020-05-27T16:24:54+00:00", + "time": "2020-07-07T18:54:01+00:00", "type": "library", "extra": { "branch-alias": { @@ -424,6 +500,10 @@ "redis", "xcache" ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/1.10.x" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -442,29 +522,30 @@ }, { "name": "doctrine/dbal", - "version": "2.12.0", - "version_normalized": "2.12.0.0", + "version": "3.0.0", + "version_normalized": "3.0.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646" + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6d37b4c42aaa3c3ee175f05eca68056f4185646", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/ee6d1260d5cc20ec506455a585945d7bdb98662c", + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c", "shasum": "" }, "require": { + "composer/package-versions-deprecated": "^1.11.99", "doctrine/cache": "^1.0", "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.3 || ^8" + "php": "^7.3 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^8.1", "jetbrains/phpstorm-stubs": "^2019.1", "phpstan/phpstan": "^0.12.40", + "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.4", "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", @@ -473,7 +554,7 @@ "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "time": "2020-10-22T17:26:24+00:00", + "time": "2020-11-15T18:20:41+00:00", "bin": [ "bin/doctrine-dbal" ], @@ -486,7 +567,7 @@ "installation-source": "dist", "autoload": { "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + "Doctrine\\DBAL\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -529,11 +610,14 @@ "queryobject", "sasql", "sql", - "sqlanywhere", "sqlite", "sqlserver", "sqlsrv" ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.0.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -4592,17 +4676,17 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.20.0", - "version_normalized": "1.20.0.0", + "version": "v1.22.0", + "version_normalized": "1.22.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c" + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", - "reference": "c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { @@ -4611,11 +4695,11 @@ "suggest": { "ext-intl": "For best performance" }, - "time": "2020-10-23T14:02:19+00:00", + "time": "2021-01-07T16:49:33+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4656,7 +4740,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" }, "funding": [ { diff --git a/composer/installed.php b/composer/installed.php index 440e6aae4..b44b96e2e 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => '875ee27505a280f58a893b16976fe36572fd82c4', + 'reference' => '65a8a4553327c818931876ac1aa80a2143e02733', 'name' => 'nextcloud/3rdparty', ), 'versions' => @@ -47,6 +47,15 @@ ), 'reference' => 'c0e56c336bd6131c199827f928e5a9aec89aa4da', ), + 'composer/package-versions-deprecated' => + array ( + 'pretty_version' => '1.11.99.1', + 'version' => '1.11.99.1', + 'aliases' => + array ( + ), + 'reference' => '7413f0b55a051e89485c5cb9f765fe24bb02a7b6', + ), 'deepdiver/zipstreamer' => array ( 'pretty_version' => '2.0.0', @@ -67,21 +76,21 @@ ), 'doctrine/cache' => array ( - 'pretty_version' => '1.10.1', - 'version' => '1.10.1.0', + 'pretty_version' => '1.10.2', + 'version' => '1.10.2.0', 'aliases' => array ( ), - 'reference' => '35a4a70cd94e09e2259dfae7488afc6b474ecbd3', + 'reference' => '13e3381b25847283a91948d04640543941309727', ), 'doctrine/dbal' => array ( - 'pretty_version' => '2.12.0', - 'version' => '2.12.0.0', + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', 'aliases' => array ( ), - 'reference' => 'c6d37b4c42aaa3c3ee175f05eca68056f4185646', + 'reference' => 'ee6d1260d5cc20ec506455a585945d7bdb98662c', ), 'doctrine/event-manager' => array ( @@ -270,7 +279,7 @@ 'aliases' => array ( ), - 'reference' => '875ee27505a280f58a893b16976fe36572fd82c4', + 'reference' => '65a8a4553327c818931876ac1aa80a2143e02733', ), 'nextcloud/lognormalizer' => array ( @@ -290,6 +299,13 @@ ), 'reference' => 'c6d052fc58cb876152f89f532b95a8d7907e7f0e', ), + 'ocramius/package-versions' => + array ( + 'replaced' => + array ( + 0 => '1.11.99', + ), + ), 'opis/closure' => array ( 'pretty_version' => '3.6.1', @@ -711,12 +727,12 @@ ), 'symfony/polyfill-intl-grapheme' => array ( - 'pretty_version' => 'v1.20.0', - 'version' => '1.20.0.0', + 'pretty_version' => 'v1.22.0', + 'version' => '1.22.0.0', 'aliases' => array ( ), - 'reference' => 'c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c', + 'reference' => '267a9adeb8ecb8071040a740930e077cdfb987af', ), 'symfony/polyfill-intl-idn' => array ( diff --git a/composer/package-versions-deprecated/CHANGELOG.md b/composer/package-versions-deprecated/CHANGELOG.md new file mode 100644 index 000000000..a838c56ad --- /dev/null +++ b/composer/package-versions-deprecated/CHANGELOG.md @@ -0,0 +1,120 @@ +# CHANGELOG + +## 1.1.3 - 2017-09-06 + +This release fixes a bug that caused PackageVersions to prevent +the `composer remove` and `composer update` commands to fail when +this package is removed. + +In addition to that, mutation testing has been added to the suite, +ensuring that the package is accurately and extensively tested. + +Total issues resolved: **3** + +- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius +- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus +- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85 + +## 1.1.2 - 2016-12-30 + +This release fixes a bug that caused PackageVersions to be enabled +even when it was part of a globally installed package. + +Total issues resolved: **3** + +- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35) +- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38) +- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39) + +## 1.1.1 - 2016-07-25 + +This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from +[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72), +as it is no longer needed for `composer install --classmap-authoritative`. +Also, that directive was causing issues with HHVM installations, since +PackageVersions is not compatible with it. + +Total issues resolved: **1** + +- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34) + +## 1.1.0 - 2016-07-22 + +This release introduces support for running `composer install --classmap-authoritative` +and `composer install --no-scripts`. Please note that performance +while using these modes may be degraded, but the package will +still work. + +Additionally, the package was tuned to prevent the plugin from +running twice at installation. + +Total issues resolved: **10** + +- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18) +- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20) +- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22) +- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23) +- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27) +- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29) +- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30) +- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31) +- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32) +- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33) + +## 1.0.4 - 2016-04-23 + +This release includes a fix/workaround for composer/composer#5237, +which causes `ocramius/package-versions` to sometimes generate a +`Versions` class with malformed name (something like +`Versions_composer_tmp0`) when running `composer require `. + +Total issues resolved: **2** + +- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16) +- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17) + +## 1.0.3 - 2016-02-26 + +This release fixes an issue related to concurrent autoloader +re-generation caused by multiple composer plugins being installed. +The issue was solved by removing autoloader re-generation from this +package, but it may still affect other packages. + +It is now recommended that you run `composer dump-autoload --optimize` +after installation when using this particular package. +Please note that `composer (install|update) -o` is not sufficient +to avoid autoload overhead when using this particular package. + +Total issues resolved: **1** + +- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15) + +## 1.0.2 - 2016-02-24 + +This release fixes issues related to installing the component without +any dev dependencies or with packages that don't have a source or dist +reference, which is usual with packages defined directly in the +`composer.json`. + +Total issues resolved: **3** + +- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11) +- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12) +- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13) + +## 1.0.1 - 2016-02-01 + +This release fixes an issue related with composer updates to +already installed versions. +Using `composer require` within a package that already used +`ocramius/package-versions` caused the installation to be unable +to write the `PackageVersions\Versions` class to a file. + +Total issues resolved: **6** + +- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2) +- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3) +- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5) +- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6) +- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7) +- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8) diff --git a/composer/package-versions-deprecated/CONTRIBUTING.md b/composer/package-versions-deprecated/CONTRIBUTING.md new file mode 100644 index 000000000..718061758 --- /dev/null +++ b/composer/package-versions-deprecated/CONTRIBUTING.md @@ -0,0 +1,39 @@ +--- +title: Contributing +--- + +# Contributing + + * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) + * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) + * Any contribution must provide tests for additional introduced conditions + * Any un-confirmed issue needs a failing test case before being accepted + * Pull requests must be sent from a new hotfix/feature branch, not from `master`. + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git://github.com/Ocramius/PackageVersions.git +``` + +You will then need to run a composer installation: + +```sh +$ cd PackageVersions +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement +won't be merged. + diff --git a/composer/package-versions-deprecated/LICENSE b/composer/package-versions-deprecated/LICENSE new file mode 100644 index 000000000..a90b0792c --- /dev/null +++ b/composer/package-versions-deprecated/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 Marco Pivetta + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/composer/package-versions-deprecated/README.md b/composer/package-versions-deprecated/README.md new file mode 100644 index 000000000..c5f5bba10 --- /dev/null +++ b/composer/package-versions-deprecated/README.md @@ -0,0 +1,5 @@ +# Package Versions + +**`composer/package-versions-deprecated` is a fully-compatible fork of [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions)** which provides compatibility with Composer 1 and 2 on PHP 7+. It replaces ocramius/package-versions so if you have a dependency requiring it and you want to use Composer v2 but can not upgrade to PHP 7.4 just yet, you can require this package instead. + +If you have a direct dependency on ocramius/package-versions, we recommend instead that once you migrated to Composer 2 you also migrate to use the `Composer\Versions` class which offers the functionality present here out of the box. diff --git a/composer/package-versions-deprecated/SECURITY.md b/composer/package-versions-deprecated/SECURITY.md new file mode 100644 index 000000000..da9c516dd --- /dev/null +++ b/composer/package-versions-deprecated/SECURITY.md @@ -0,0 +1,5 @@ +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. diff --git a/composer/package-versions-deprecated/composer.json b/composer/package-versions-deprecated/composer.json new file mode 100644 index 000000000..d5a40daac --- /dev/null +++ b/composer/package-versions-deprecated/composer.json @@ -0,0 +1,48 @@ +{ + "name": "composer/package-versions-deprecated", + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "type": "composer-plugin", + "license": "MIT", + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "require": { + "php": "^7 || ^8", + "composer-plugin-api": "^1.1.0 || ^2.0" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "phpunit/phpunit": "^6.5 || ^7", + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13" + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "autoload-dev": { + "psr-4": { + "PackageVersionsTest\\": "test/PackageVersionsTest" + } + }, + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "scripts": { + "post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass", + "post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass" + } +} diff --git a/composer/package-versions-deprecated/composer.lock b/composer/package-versions-deprecated/composer.lock new file mode 100644 index 000000000..b711f6b13 --- /dev/null +++ b/composer/package-versions-deprecated/composer.lock @@ -0,0 +1,2603 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "6bfe0a7d7a51c4bdf14a2d7ea1d22d11", + "packages": [], + "packages-dev": [ + { + "name": "composer/ca-bundle", + "version": "1.2.7", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-04-08T08:27:21+00:00" + }, + { + "name": "composer/composer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "a8c105da344dd84ebd5d11be7943a45b09dc076f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/a8c105da344dd84ebd5d11be7943a45b09dc076f", + "reference": "a8c105da344dd84ebd5d11be7943a45b09dc076f", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "composer/xdebug-handler": "^1.1", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" + }, + "conflict": { + "symfony/console": "2.8.38" + }, + "require-dev": { + "phpspec/prophecy": "^1.10", + "symfony/phpunit-bridge": "^3.4" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/composer/issues", + "source": "https://github.com/composer/composer/tree/master" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-03-29T14:59:26+00:00" + }, + { + "name": "composer/semver", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/1.5.1" + }, + "time": "2020-01-13T12:06:48+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", + "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2020-02-14T07:44:31+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/master" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + } + ], + "time": "2020-03-01T12:26:26+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/master" + }, + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.9", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "44c6787311242a979fa15c704327c20e7221a0e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/44c6787311242a979fa15c704327c20e7221a0e4", + "reference": "44c6787311242a979fa15c704327c20e7221a0e4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "support": { + "issues": "https://github.com/justinrainbow/json-schema/issues", + "source": "https://github.com/justinrainbow/json-schema/tree/5.2.9" + }, + "time": "2019-09-25T14:49:45+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.5", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.9.5" + }, + "time": "2020-01-17T21:11:47+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "time": "2018-08-07T13:53:10+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "shasum": "" + }, + "require": { + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" + }, + "require-dev": { + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-02-22T12:28:44+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "shasum": "" + }, + "require": { + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/master" + }, + "time": "2020-02-18T18:59:58+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.10.3", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "451c3cd1418cf640de218914901e51b064abb093" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" + }, + "time": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2020-01-08T08:45:45+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2020-03-23T09:12:05+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.7.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/e2e5d290e4d2a4f0eb449f510071392e00e10d19", + "reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.7.2" + }, + "time": "2019-10-24T14:27:39+00:00" + }, + { + "name": "seld/phar-utils", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", + "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phar" + ], + "support": { + "issues": "https://github.com/Seldaek/phar-utils/issues", + "source": "https://github.com/Seldaek/phar-utils/tree/1.1.0" + }, + "time": "2020-02-14T15:25:33+00:00" + }, + { + "name": "symfony/console", + "version": "v5.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", + "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/console/tree/v5.0.7" + }, + "time": "2020-03-30T11:42:42+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v5.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "ca3b87dd09fff9b771731637f5379965fbfab420" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ca3b87dd09fff9b771731637f5379965fbfab420", + "reference": "ca3b87dd09fff9b771731637f5379965fbfab420", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.0.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-03-27T16:56:45+00:00" + }, + { + "name": "symfony/finder", + "version": "v5.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/600a52c29afc0d1caa74acbec8d3095ca7e9910d", + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-03-27T16:56:45+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.15.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-02-27T09:26:54+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.15.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-03-09T19:04:49+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.15.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-02-27T09:26:54+00:00" + }, + { + "name": "symfony/process", + "version": "v5.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", + "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.0.7" + }, + "time": "2020-03-27T16:56:45+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.0.1" + }, + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozart/assert/issues", + "source": "https://github.com/webmozart/assert/tree/master" + }, + "time": "2020-04-18T12:12:48+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "composer/composer": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7", + "composer-plugin-api": "^1.1.0 || ^2.0" + }, + "platform-dev": { + "ext-zip": "^1.13" + }, + "plugin-api-version": "1.1.0" +} diff --git a/composer/package-versions-deprecated/phpcs.xml.dist b/composer/package-versions-deprecated/phpcs.xml.dist new file mode 100644 index 000000000..e169c6167 --- /dev/null +++ b/composer/package-versions-deprecated/phpcs.xml.dist @@ -0,0 +1,21 @@ + + + + + + + + + + + src + test + + + src/PackageVersions/Versions.php + + + + src/PackageVersions/Installer.php + + diff --git a/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php b/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php new file mode 100644 index 000000000..18e5fe64f --- /dev/null +++ b/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php @@ -0,0 +1,128 @@ + + */ + private static function getVersions(array $packageData): Generator + { + foreach ($packageData as $package) { + yield $package['name'] => $package['version'] . '@' . ( + $package['source']['reference'] ?? $package['dist']['reference'] ?? '' + ); + } + + yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME; + } +} diff --git a/composer/package-versions-deprecated/src/PackageVersions/Installer.php b/composer/package-versions-deprecated/src/PackageVersions/Installer.php new file mode 100644 index 000000000..c0853c161 --- /dev/null +++ b/composer/package-versions-deprecated/src/PackageVersions/Installer.php @@ -0,0 +1,269 @@ + + * @internal + */ + const VERSIONS = %s; + + private function __construct() + { + } + + /** + * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. + */ + public static function rootPackageName() : string + { + if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + return self::ROOT_PACKAGE_NAME; + } + + return InstalledVersions::getRootPackage()['name']; + } + + /** + * @throws OutOfBoundsException If a version cannot be located. + * + * @psalm-param key-of $packageName + * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. + */ + public static function getVersion(string $packageName): string + { + if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + + if (isset(self::VERSIONS[$packageName])) { + return self::VERSIONS[$packageName]; + } + + throw new OutOfBoundsException( + 'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files' + ); + } +} + +PHP; + + public function activate(Composer $composer, IOInterface $io) + { + // Nothing to do here, as all features are provided through event listeners + } + + public function deactivate(Composer $composer, IOInterface $io) + { + // Nothing to do here, as all features are provided through event listeners + } + + public function uninstall(Composer $composer, IOInterface $io) + { + // Nothing to do here, as all features are provided through event listeners + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents(): array + { + return [ScriptEvents::POST_AUTOLOAD_DUMP => 'dumpVersionsClass']; + } + + /** + * @throws RuntimeException + */ + public static function dumpVersionsClass(Event $composerEvent) + { + $composer = $composerEvent->getComposer(); + $rootPackage = $composer->getPackage(); + $versions = iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage)); + + if (! array_key_exists('composer/package-versions-deprecated', $versions)) { + //plugin must be globally installed - we only want to generate versions for projects which specifically + //require composer/package-versions-deprecated + return; + } + + $versionClass = self::generateVersionsClass($rootPackage->getName(), $versions); + + self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO()); + } + + /** + * @param string[] $versions + */ + private static function generateVersionsClass(string $rootPackageName, array $versions): string + { + return sprintf( + self::$generatedClassTemplate, + 'fin' . 'al ' . 'cla' . 'ss ' . 'Versions', // note: workaround for regex-based code parsers :-( + $rootPackageName, + var_export($versions, true) + ); + } + + /** + * @throws RuntimeException + */ + private static function writeVersionClassToFile(string $versionClassSource, Composer $composer, IOInterface $io) + { + $installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage()) + . '/src/PackageVersions/Versions.php'; + + $installDir = dirname($installPath); + if (! file_exists($installDir)) { + $io->write('composer/package-versions-deprecated: Package not found (probably scheduled for removal); generation of version class skipped.'); + + return; + } + + if (! is_writable($installDir)) { + $io->write( + sprintf( + 'composer/package-versions-deprecated: %s is not writable; generation of version class skipped.', + $installDir + ) + ); + + return; + } + + $io->write('composer/package-versions-deprecated: Generating version class...'); + + $installPathTmp = $installPath . '_' . uniqid('tmp', true); + file_put_contents($installPathTmp, $versionClassSource); + chmod($installPathTmp, 0664); + rename($installPathTmp, $installPath); + + $io->write('composer/package-versions-deprecated: ...done generating version class'); + } + + /** + * @throws RuntimeException + */ + private static function locateRootPackageInstallPath( + Config $composerConfig, + RootPackageInterface $rootPackage + ): string { + if (self::getRootPackageAlias($rootPackage)->getName() === 'composer/package-versions-deprecated') { + return dirname($composerConfig->get('vendor-dir')); + } + + return $composerConfig->get('vendor-dir') . '/composer/package-versions-deprecated'; + } + + private static function getRootPackageAlias(RootPackageInterface $rootPackage): PackageInterface + { + $package = $rootPackage; + + while ($package instanceof AliasPackage) { + $package = $package->getAliasOf(); + } + + return $package; + } + + /** + * @return Generator&string[] + * + * @psalm-return Generator + */ + private static function getVersions(Locker $locker, RootPackageInterface $rootPackage): Generator + { + $lockData = $locker->getLockData(); + + $lockData['packages-dev'] = $lockData['packages-dev'] ?? []; + + $packages = $lockData['packages']; + if (getenv('COMPOSER_DEV_MODE') !== '0') { + $packages = array_merge($packages, $lockData['packages-dev']); + } + foreach ($packages as $package) { + yield $package['name'] => $package['version'] . '@' . ( + $package['source']['reference'] ?? $package['dist']['reference'] ?? '' + ); + } + + foreach ($rootPackage->getReplaces() as $replace) { + $version = $replace->getPrettyConstraint(); + if ($version === 'self.version') { + $version = $rootPackage->getPrettyVersion(); + } + + yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference(); + } + + yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference(); + } +} diff --git a/composer/package-versions-deprecated/src/PackageVersions/Versions.php b/composer/package-versions-deprecated/src/PackageVersions/Versions.php new file mode 100644 index 000000000..b7bed02c5 --- /dev/null +++ b/composer/package-versions-deprecated/src/PackageVersions/Versions.php @@ -0,0 +1,166 @@ + + * @internal + */ + const VERSIONS = array ( + 'aws/aws-sdk-php' => '3.133.27@5527195465ac42cb5127a60b84eb2d8dc3b0d5c9', + 'bantu/ini-get-wrapper' => 'v1.0.1@4770c7feab370c62e23db4f31c112b7c6d90aee2', + 'beberlei/assert' => 'v3.2.7@d63a6943fc4fd1a2aedb65994e3548715105abcf', + 'christophwurst/id3parser' => 'v0.1.1@c0e56c336bd6131c199827f928e5a9aec89aa4da', + 'composer/package-versions-deprecated' => '1.11.99.1@7413f0b55a051e89485c5cb9f765fe24bb02a7b6', + 'deepdiver/zipstreamer' => '2.0.0@b8c59647ff34fb97e8937aefb2a65de2bc4b4755', + 'deepdiver1975/tarstreamer' => '2.0.0@ad48505d1ab54a8e94e6b1cc5297bbed72e956de', + 'doctrine/cache' => '1.10.2@13e3381b25847283a91948d04640543941309727', + 'doctrine/dbal' => '3.0.0@ee6d1260d5cc20ec506455a585945d7bdb98662c', + 'doctrine/event-manager' => '1.1.1@41370af6a30faa9dc0368c4a6814d596e81aba7f', + 'doctrine/lexer' => '1.2.1@e864bbf5904cb8f5bb334f99209b48018522f042', + 'egulias/email-validator' => '2.1.25@0dbf5d78455d4d6a41d186da50adc1122ec066f4', + 'fgrosse/phpasn1' => 'v2.1.1@7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8', + 'giggsey/libphonenumber-for-php' => '8.12.4@cb79970730aacaedb74c8288214a5576572fa7b0', + 'giggsey/locale' => '1.9@b07f1eace8072ccc61445ad8fbd493ff9d783043', + 'guzzlehttp/guzzle' => '7.2.0@0aa74dfb41ae110835923ef10a9d803a22d50e79', + 'guzzlehttp/promises' => '1.4.0@60d379c243457e073cff02bc323a2a86cb355631', + 'guzzlehttp/psr7' => '1.7.0@53330f47520498c0ae1f61f7e2c90f55690c06a3', + 'guzzlehttp/uri-template' => 'v0.2.0@db46525d6d8fee71033b73cc07160f3e5271a8ce', + 'icewind/searchdav' => 'v2.0.0@c69806d900c2c9a5954bfabc80178d6eb0d63df4', + 'icewind/streams' => 'v0.7.2@77d750ccc654c0eda4a41fedb2dbd71053755790', + 'justinrainbow/json-schema' => '5.2.10@2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b', + 'league/flysystem' => '1.0.64@d13c43dbd4b791f815215959105a008515d1a2e0', + 'league/uri' => '6.2.1@6998530902550c6e3fefb5ef98d56fe92ecdb603', + 'league/uri-components' => '2.2.1@14bab20b05bc20d16dec17401a9027c679412589', + 'league/uri-interfaces' => '2.1.0@0068a469958895ceaf3afcb489c0258adfa1e406', + 'microsoft/azure-storage-blob' => '1.5.2@2475330963372d519387cb8135d6a9cfd42272da', + 'microsoft/azure-storage-common' => '1.5.1@e5738035891546075bd369954e8af121d65ebd6d', + 'mtdowling/jmespath.php' => '2.5.0@52168cb9472de06979613d365c7f1ab8798be895', + 'nextcloud/lognormalizer' => 'v1.0.0@87445d69225c247aaff64643b1fc83c6d6df741f', + 'nikic/php-parser' => 'v4.10.4@c6d052fc58cb876152f89f532b95a8d7907e7f0e', + 'opis/closure' => '3.6.1@943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5', + 'paragonie/random_compat' => 'v9.99.99@84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95', + 'patchwork/jsqueeze' => 'v2.0.5@693d64850eab2ce6a7c8f7cf547e1ab46e69d542', + 'pear/archive_tar' => '1.4.11@17d355cb7d3c4ff08e5729f29cd7660145208d9d', + 'pear/console_getopt' => 'v1.4.3@a41f8d3e668987609178c7c4a9fe48fecac53fa0', + 'pear/pear-core-minimal' => 'v1.10.10@625a3c429d9b2c1546438679074cac1b089116a7', + 'pear/pear_exception' => 'v1.0.1@dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7', + 'php-ds/php-ds' => 'v1.3.0@b98396862fb8a13cbdbbaf4d18be28ee5c01ed3c', + 'php-http/guzzle7-adapter' => '0.1.1@1967de656b9679a2a6a66d0e4e16fa99bbed1ad1', + 'php-http/httplug' => '2.2.0@191a0a1b41ed026b717421931f8d3bd2514ffbf9', + 'php-http/promise' => '1.1.0@4c4c1f9b7289a2ec57cde7f1e9762a5789506f88', + 'php-opencloud/openstack' => 'v3.1.0@7b0eeb63defe533fb802514af3c70855c45eaf1e', + 'phpseclib/phpseclib' => '2.0.25@c18159618ed7cd7ff721ac1a8fec7860a475d2f0', + 'pimple/pimple' => 'v3.3.1@21e45061c3429b1e06233475cc0e1f6fc774d5b0', + 'psr/container' => '1.0.0@b7ce3b176482dbbc1245ebf52b181af44c2cf55f', + 'psr/http-client' => '1.0.1@2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', + 'psr/http-factory' => '1.0.1@12ac7fcd07e5b077433f5f2bee95b3a771bf61be', + 'psr/http-message' => '1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363', + 'psr/log' => '1.1.3@0f73288fd15629204f9d42b7055f72dacbe811fc', + 'punic/punic' => '1.6.5@7bc85ce1137cf52db4d2a6298256a4c4a24da99a', + 'ralouphie/getallheaders' => '3.0.3@120b605dfeb996808c31b6477290a714d356e822', + 'ramsey/uuid' => '3.9.3@7e1633a6964b48589b142d60542f9ed31bd37a92', + 'sabre/dav' => '4.1.3@b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e', + 'sabre/event' => '5.1.2@c120bec57c17b6251a496efc82b732418b49d50a', + 'sabre/http' => '5.1.1@d0aafede6961df6195ce7a8dad49296b0aaee22e', + 'sabre/uri' => '2.2.1@f502edffafea8d746825bd5f0b923a60fd2715ff', + 'sabre/vobject' => '4.3.3@58f9f9b46a1080c0130bd86f4df9a568aacb9c79', + 'sabre/xml' => '2.2.3@c3b959f821c19b36952ec4a595edd695c216bfc6', + 'scssphp/scssphp' => '1.0.3@616c518333c656eaa23182ac6cfc01453f1e7c78', + 'spomky-labs/base64url' => 'v2.0.1@3eb46a1de803f0078962d910e3a2759224a68c61', + 'spomky-labs/cbor-php' => 'v1.0.8@575a66dc406575b030e3ba541b33447842f93185', + 'stecman/symfony-console-completion' => '0.11.0@a9502dab59405e275a9f264536c4e1cb61fc3518', + 'swiftmailer/swiftmailer' => 'v6.2.4@56f0ab23f54c4ccbb0d5dcc67ff8552e0c98d59e', + 'symfony/console' => 'v4.4.18@12e071278e396cc3e1c149857337e9e192deca0b', + 'symfony/event-dispatcher' => 'v4.4.18@5d4c874b0eb1c32d40328a09dbc37307a5a910b0', + 'symfony/event-dispatcher-contracts' => 'v1.1.9@84e23fdcd2517bf37aecbd16967e83f0caee25a7', + 'symfony/polyfill-ctype' => 'v1.20.0@f4ba089a5b6366e453971d3aad5fe8e897b37f41', + 'symfony/polyfill-iconv' => 'v1.20.0@c536646fdb4f29104dd26effc2fdcb9a5b085024', + 'symfony/polyfill-intl-grapheme' => 'v1.22.0@267a9adeb8ecb8071040a740930e077cdfb987af', + 'symfony/polyfill-intl-idn' => 'v1.20.0@3b75acd829741c768bc8b1f84eb33265e7cc5117', + 'symfony/polyfill-intl-normalizer' => 'v1.20.0@727d1096295d807c309fb01a851577302394c897', + 'symfony/polyfill-mbstring' => 'v1.20.0@39d483bdf39be819deabf04ec872eb0b2410b531', + 'symfony/polyfill-php72' => 'v1.20.0@cede45fcdfabdd6043b3592e83678e42ec69e930', + 'symfony/polyfill-php73' => 'v1.20.0@8ff431c517be11c78c48a39a66d37431e26a6bed', + 'symfony/polyfill-php80' => 'v1.20.0@e70aa8b064c5b72d3df2abd5ab1e90464ad009de', + 'symfony/process' => 'v4.4.18@075316ff72233ce3d04a9743414292e834f2cb4a', + 'symfony/routing' => 'v4.4.18@80b042c20b035818daec844723e23b9825134ba0', + 'symfony/service-contracts' => 'v2.2.0@d15da7ba4957ffb8f1747218be9e1a121fd298a1', + 'symfony/translation' => 'v4.4.18@c1001b7d75b3136648f94b245588209d881c6939', + 'symfony/translation-contracts' => 'v2.3.0@e2eaa60b558f26a4b0354e1bbb25636efaaad105', + 'web-auth/cose-lib' => 'v3.1.1@bc28b39608b0674546d89318e55fb37eaec1a9e9', + 'web-auth/metadata-service' => 'v3.1.1@0e9d9b85590a0c5155b99d9a4b5bdaa01b1748e3', + 'web-auth/webauthn-lib' => 'v3.1.1@a8a11bc30480e98768987fe0fc266aef08ec99da', + 'nextcloud/3rdparty' => 'dev-master@65a8a4553327c818931876ac1aa80a2143e02733', +); + + private function __construct() + { + } + + /** + * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. + */ + public static function rootPackageName() : string + { + if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) { + return self::ROOT_PACKAGE_NAME; + } + + return InstalledVersions::getRootPackage()['name']; + } + + /** + * @throws OutOfBoundsException If a version cannot be located. + * + * @psalm-param key-of $packageName + * @psalm-pure + * + * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not + * cause any side effects here. + */ + public static function getVersion(string $packageName): string + { + if (class_exists(InstalledVersions::class, false) && InstalledVersions::getRawData()) { + return InstalledVersions::getPrettyVersion($packageName) + . '@' . InstalledVersions::getReference($packageName); + } + + if (isset(self::VERSIONS[$packageName])) { + return self::VERSIONS[$packageName]; + } + + throw new OutOfBoundsException( + 'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files' + ); + } +} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php b/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php index e9762a2cc..8f85845c7 100644 --- a/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php +++ b/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php @@ -15,6 +15,9 @@ class ChainCache extends CacheProvider /** @var CacheProvider[] */ private $cacheProviders = []; + /** @var int */ + private $defaultLifeTimeForDownstreamCacheProviders = 0; + /** * @param CacheProvider[] $cacheProviders */ @@ -25,6 +28,11 @@ public function __construct($cacheProviders = []) : array_values($cacheProviders); } + public function setDefaultLifeTimeForDownstreamCacheProviders(int $defaultLifeTimeForDownstreamCacheProviders) : void + { + $this->defaultLifeTimeForDownstreamCacheProviders = $defaultLifeTimeForDownstreamCacheProviders; + } + /** * {@inheritDoc} */ @@ -48,7 +56,7 @@ protected function doFetch($id) // We populate all the previous cache layers (that are assumed to be faster) for ($subKey = $key - 1; $subKey >= 0; $subKey--) { - $this->cacheProviders[$subKey]->doSave($id, $value); + $this->cacheProviders[$subKey]->doSave($id, $value, $this->defaultLifeTimeForDownstreamCacheProviders); } return $value; @@ -74,7 +82,7 @@ protected function doFetchMultiple(array $keys) // We populate all the previous cache layers (that are assumed to be faster) if (count($fetchedValues) === $keysCount) { foreach ($traversedProviders as $previousCacheProvider) { - $previousCacheProvider->doSaveMultiple($fetchedValues); + $previousCacheProvider->doSaveMultiple($fetchedValues, $this->defaultLifeTimeForDownstreamCacheProviders); } return $fetchedValues; diff --git a/doctrine/dbal/README.md b/doctrine/dbal/README.md index 8f21ee0b5..259f7c626 100644 --- a/doctrine/dbal/README.md +++ b/doctrine/dbal/README.md @@ -1,11 +1,11 @@ # Doctrine DBAL -| [Master][Master] | [2.11][2.11] | +| [Master][Master] | [2.12][2.12] | |:----------------:|:----------:| -| [![Build status][Master image]][Master] | [![Build status][2.11 image]][2.11] | -| [![GitHub Actions][GA master image]][GA master] | [![GitHub Actions][GA 2.11 image]][GA 2.11] | -| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.11 image]][AppVeyor 2.11] | -| [![Code Coverage][Coverage image]][CodeCov Master] | [![Code Coverage][Coverage 2.11 image]][CodeCov 2.11] | +| [![Build status][Master image]][Master] | [![Build status][2.12 image]][2.12] | +| [![GitHub Actions][GA master image]][GA master] | [![GitHub Actions][GA 2.12 image]][GA 2.12] | +| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.12 image]][AppVeyor 2.12] | +| [![Code Coverage][Coverage image]][CodeCov Master] | [![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. @@ -24,11 +24,11 @@ Powerful database abstraction layer with many features for database schema intro [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 - [2.11 image]: https://img.shields.io/travis/doctrine/dbal/2.11.x.svg?style=flat-square - [Coverage 2.11 image]: https://codecov.io/gh/doctrine/dbal/branch/2.11.x/graph/badge.svg - [2.11]: https://github.com/doctrine/dbal/tree/2.11.x - [CodeCov 2.11]: https://codecov.io/gh/doctrine/dbal/branch/2.11.x - [AppVeyor 2.11]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.11.x - [AppVeyor 2.11 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.11.x?svg=true - [GA 2.11]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A2.11.x - [GA 2.11 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=2.11.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 + [AppVeyor 2.12]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.12.x + [AppVeyor 2.12 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.12.x?svg=true + [GA 2.12]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A2.12.x + [GA 2.12 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=2.12.x diff --git a/doctrine/dbal/composer.json b/doctrine/dbal/composer.json index 2571ac419..09095660b 100644 --- a/doctrine/dbal/composer.json +++ b/doctrine/dbal/composer.json @@ -18,7 +18,6 @@ "queryobject", "sasql", "sql", - "sqlanywhere", "sqlite", "sqlserver", "sqlsrv" @@ -32,8 +31,8 @@ {"name": "Jonathan Wage", "email": "jonwage@gmail.com"} ], "require": { - "php": "^7.3 || ^8", - "ext-pdo": "*", + "php": "^7.3 || ^8.0", + "composer/package-versions-deprecated": "^1.11.99", "doctrine/cache": "^1.0", "doctrine/event-manager": "^1.0" }, @@ -41,6 +40,7 @@ "doctrine/coding-standard": "^8.1", "jetbrains/phpstorm-stubs": "^2019.1", "phpstan/phpstan": "^0.12.40", + "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.4", "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", @@ -51,16 +51,16 @@ }, "bin": ["bin/doctrine-dbal"], "config": { - "sort-packages": true, "platform": { "php": "7.3.0" - } + }, + "sort-packages": true }, "autoload": { - "psr-4": { "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" } + "psr-4": { "Doctrine\\DBAL\\": "src" } }, "autoload-dev": { - "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine/Tests" } + "psr-4": { "Doctrine\\DBAL\\Tests\\": "tests" } }, "extra": { "branch-alias": { diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Abstraction/Result.php b/doctrine/dbal/lib/Doctrine/DBAL/Abstraction/Result.php deleted file mode 100644 index 2b1f8e69f..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Abstraction/Result.php +++ /dev/null @@ -1,45 +0,0 @@ -> - * - * @throws Exception - */ - public function iterateNumeric(): Traversable; - - /** - * Returns an iterator over the result set rows represented as associative arrays. - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociative(): Traversable; - - /** - * Returns an iterator over the values of the first column of the result set. - * - * @return Traversable - * - * @throws Exception - */ - public function iterateColumn(): Traversable; -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php b/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php deleted file mode 100644 index 58d0a59e3..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php +++ /dev/null @@ -1,242 +0,0 @@ -data = $data; - if (! count($data)) { - return; - } - - $this->columnCount = count($data[0]); - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->free(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - return count($this->data); - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return $this->columnCount; - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - if ($arg2 !== null || $arg3 !== null) { - throw new InvalidArgumentException('Caching layer does not support 2nd/3rd argument to setFetchMode()'); - } - - $this->defaultFetchMode = $fetchMode; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - $data = $this->fetchAll(); - - return new ArrayIterator($data); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - if (! isset($this->data[$this->num])) { - return false; - } - - $row = $this->data[$this->num++]; - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - if ($fetchMode === FetchMode::ASSOCIATIVE) { - return $row; - } - - if ($fetchMode === FetchMode::NUMERIC) { - return array_values($row); - } - - if ($fetchMode === FetchMode::MIXED) { - return array_merge($row, array_values($row)); - } - - if ($fetchMode === FetchMode::COLUMN) { - return reset($row); - } - - throw new InvalidArgumentException('Invalid fetch-style given for fetching result.'); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $rows = []; - while ($row = $this->fetch($fetchMode)) { - $rows[] = $row; - } - - return $rows; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - // TODO: verify that return false is the correct behavior - return $row[$columnIndex] ?? false; - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - $row = $this->doFetch(); - - if ($row === false) { - return false; - } - - return array_values($row); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->doFetch(); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - $row = $this->doFetch(); - - if ($row === false) { - return false; - } - - return reset($row); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return FetchUtils::fetchAllNumeric($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return FetchUtils::fetchAllAssociative($this); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - public function free(): void - { - $this->data = []; - } - - /** - * @return mixed|false - */ - private function doFetch() - { - if (! isset($this->data[$this->num])) { - return false; - } - - return $this->data[$this->num++]; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php b/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php deleted file mode 100644 index 07a6c2206..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php +++ /dev/null @@ -1,348 +0,0 @@ ->|null */ - private $data; - - /** @var int */ - private $defaultFetchMode = FetchMode::MIXED; - - /** - * @param string $cacheKey - * @param string $realKey - * @param int $lifetime - */ - public function __construct(ResultStatement $stmt, Cache $resultCache, $cacheKey, $realKey, $lifetime) - { - $this->statement = $stmt; - $this->resultCache = $resultCache; - $this->cacheKey = $cacheKey; - $this->realKey = $realKey; - $this->lifetime = $lifetime; - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->free(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return $this->statement->columnCount(); - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->defaultFetchMode = $fetchMode; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - $data = $this->fetchAll(); - - return new ArrayIterator($data); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - if ($this->data === null) { - $this->data = []; - } - - $row = $this->statement->fetch(FetchMode::ASSOCIATIVE); - - if ($row) { - $this->data[] = $row; - - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - if ($fetchMode === FetchMode::ASSOCIATIVE) { - return $row; - } - - if ($fetchMode === FetchMode::NUMERIC) { - return array_values($row); - } - - if ($fetchMode === FetchMode::MIXED) { - return array_merge($row, array_values($row)); - } - - if ($fetchMode === FetchMode::COLUMN) { - return reset($row); - } - - throw new InvalidArgumentException('Invalid fetch-style given for caching result.'); - } - - $this->saveToCache(); - - return false; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $data = $this->statement->fetchAll(FetchMode::ASSOCIATIVE, $fetchArgument, $ctorArgs); - - $this->data = $data; - - $this->saveToCache(); - - if ($fetchMode === FetchMode::NUMERIC) { - foreach ($data as $i => $row) { - $data[$i] = array_values($row); - } - } elseif ($fetchMode === FetchMode::MIXED) { - foreach ($data as $i => $row) { - $data[$i] = array_merge($row, array_values($row)); - } - } elseif ($fetchMode === FetchMode::COLUMN) { - foreach ($data as $i => $row) { - $data[$i] = reset($row); - } - } - - return $data; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - // TODO: verify that return false is the correct behavior - return $row[$columnIndex] ?? false; - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - $row = $this->doFetch(); - - if ($row === false) { - return false; - } - - return array_values($row); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->doFetch(); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - if ($this->statement instanceof Result) { - $data = $this->statement->fetchAllAssociative(); - } else { - $data = $this->statement->fetchAll(FetchMode::ASSOCIATIVE); - } - - $this->store($data); - - return array_map('array_values', $data); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - if ($this->statement instanceof Result) { - $data = $this->statement->fetchAllAssociative(); - } else { - $data = $this->statement->fetchAll(FetchMode::ASSOCIATIVE); - } - - $this->store($data); - - return $data; - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - /** - * Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement - * executed by the corresponding object. - * - * If the last SQL statement executed by the associated Statement object was a SELECT statement, - * some databases may return the number of rows returned by that statement. However, - * this behaviour is not guaranteed for all databases and should not be - * relied on for portable applications. - * - * @return int The number of rows. - */ - public function rowCount() - { - assert($this->statement instanceof Statement); - - return $this->statement->rowCount(); - } - - public function free(): void - { - $this->data = null; - } - - /** - * @return array|false - * - * @throws Exception - */ - private function doFetch() - { - if ($this->data === null) { - $this->data = []; - } - - if ($this->statement instanceof Result) { - $row = $this->statement->fetchAssociative(); - } else { - $row = $this->statement->fetch(FetchMode::ASSOCIATIVE); - } - - if ($row !== false) { - $this->data[] = $row; - - return $row; - } - - $this->saveToCache(); - - return false; - } - - /** - * @param array> $data - */ - private function store(array $data): void - { - $this->data = $data; - } - - private function saveToCache(): void - { - if ($this->data === null) { - return; - } - - $data = $this->resultCache->fetch($this->cacheKey); - if (! $data) { - $data = []; - } - - $data[$this->realKey] = $this->data; - - $this->resultCache->save($this->cacheKey, $data, $this->lifetime); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php b/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php deleted file mode 100644 index fce8a0b53..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php +++ /dev/null @@ -1,164 +0,0 @@ -_attributes['sqlLogger'] = $logger; - } - - /** - * Gets the SQL logger that is used. - * - * @return SQLLogger|null - */ - public function getSQLLogger() - { - return $this->_attributes['sqlLogger'] ?? null; - } - - /** - * Gets the cache driver implementation that is used for query result caching. - * - * @return Cache|null - */ - public function getResultCacheImpl() - { - return $this->_attributes['resultCacheImpl'] ?? null; - } - - /** - * Sets the cache driver implementation that is used for query result caching. - * - * @return void - */ - public function setResultCacheImpl(Cache $cacheImpl) - { - $this->_attributes['resultCacheImpl'] = $cacheImpl; - } - - /** - * Sets the filter schema assets expression. - * - * Only include tables/sequences matching the filter expression regexp in - * schema instances generated for the active connection when calling - * {AbstractSchemaManager#createSchema()}. - * - * @deprecated Use Configuration::setSchemaAssetsFilter() instead - * - * @param string|null $filterExpression - * - * @return void - */ - public function setFilterSchemaAssetsExpression($filterExpression) - { - $this->_attributes['filterSchemaAssetsExpression'] = $filterExpression; - if ($filterExpression) { - $this->_attributes['filterSchemaAssetsExpressionCallable'] - = $this->buildSchemaAssetsFilterFromExpression($filterExpression); - } else { - $this->_attributes['filterSchemaAssetsExpressionCallable'] = null; - } - } - - /** - * Returns filter schema assets expression. - * - * @deprecated Use Configuration::getSchemaAssetsFilter() instead - * - * @return string|null - */ - public function getFilterSchemaAssetsExpression() - { - return $this->_attributes['filterSchemaAssetsExpression'] ?? null; - } - - /** - * @param string $filterExpression - */ - private function buildSchemaAssetsFilterFromExpression($filterExpression): callable - { - return static function ($assetName) use ($filterExpression) { - if ($assetName instanceof AbstractAsset) { - $assetName = $assetName->getName(); - } - - return preg_match($filterExpression, $assetName); - }; - } - - /** - * Sets the callable to use to filter schema assets. - */ - public function setSchemaAssetsFilter(?callable $callable = null): ?callable - { - $this->_attributes['filterSchemaAssetsExpression'] = null; - - return $this->_attributes['filterSchemaAssetsExpressionCallable'] = $callable; - } - - /** - * Returns the callable to use to filter schema assets. - */ - public function getSchemaAssetsFilter(): ?callable - { - return $this->_attributes['filterSchemaAssetsExpressionCallable'] ?? null; - } - - /** - * Sets the default auto-commit mode for connections. - * - * If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual - * transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either - * the method commit or the method rollback. By default, new connections are in auto-commit mode. - * - * @see getAutoCommit - * - * @param bool $autoCommit True to enable auto-commit mode; false to disable it. - * - * @return void - */ - public function setAutoCommit($autoCommit) - { - $this->_attributes['autoCommit'] = (bool) $autoCommit; - } - - /** - * Returns the default auto-commit mode for connections. - * - * @see setAutoCommit - * - * @return bool True if auto-commit mode is enabled by default for connections, false otherwise. - */ - public function getAutoCommit() - { - return $this->_attributes['autoCommit'] ?? true; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php deleted file mode 100644 index 984736fd6..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ /dev/null @@ -1,101 +0,0 @@ -deprecated(self::class, PrimaryReadReplicaConnection::class); - - if (isset($params['master'])) { - $this->deprecated('Params key "master"', '"primary"'); - - $params['primary'] = $params['master']; - } - - if (isset($params['slaves'])) { - $this->deprecated('Params key "slaves"', '"replica"'); - - $params['replica'] = $params['slaves']; - } - - if (isset($params['keepSlave'])) { - $this->deprecated('Params key "keepSlave"', '"keepReplica"'); - - $params['keepReplica'] = $params['keepSlave']; - } - - parent::__construct($params, $driver, $config, $eventManager); - } - - /** - * Checks if the connection is currently towards the primary or not. - */ - public function isConnectedToMaster(): bool - { - $this->deprecated('isConnectedtoMaster()', 'isConnectedToPrimary()'); - - return $this->isConnectedToPrimary(); - } - - /** - * @param string|null $connectionName - * - * @return bool - */ - public function connect($connectionName = null) - { - if ($connectionName === 'master') { - $connectionName = 'primary'; - - $this->deprecated('connect("master")', 'ensureConnectedToPrimary()'); - } - - if ($connectionName === 'slave') { - $connectionName = 'replica'; - - $this->deprecated('connect("slave")', 'ensureConnectedToReplica()'); - } - - return $this->performConnect($connectionName); - } - - private function deprecated(string $thing, string $instead): void - { - @trigger_error( - sprintf( - '%s is deprecated since doctrine/dbal 2.11 and will be removed in 3.0, use %s instead.', - $thing, - $instead - ), - E_USER_DEPRECATED - ); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php b/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php deleted file mode 100644 index b9a33cf1f..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php +++ /dev/null @@ -1,314 +0,0 @@ -getMessage(); - - return static::wrapException($driver, $driverEx, $msg); - } - - /** - * @deprecated - * - * @return Exception - */ - public static function driverException(Driver $driver, Throwable $driverEx) - { - return static::wrapException($driver, $driverEx, 'An exception occurred in driver: ' . $driverEx->getMessage()); - } - - /** - * @return Exception - */ - private static function wrapException(Driver $driver, Throwable $driverEx, string $msg) - { - if ($driverEx instanceof DriverException) { - return $driverEx; - } - - if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DeprecatedDriverException) { - return $driver->convertException($msg, $driverEx); - } - - return new Exception($msg, 0, $driverEx); - } - - /** - * Returns a human-readable representation of an array of parameters. - * This properly handles binary data by returning a hex representation. - * - * @param mixed[] $params - * - * @return string - */ - private static function formatParameters(array $params) - { - return '[' . implode(', ', array_map(static function ($param) { - if (is_resource($param)) { - return (string) $param; - } - - $json = @json_encode($param); - - if (! is_string($json) || $json === 'null' && is_string($param)) { - // JSON encoding failed, this is not a UTF-8 string. - return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param))); - } - - return $json; - }, $params)) . ']'; - } - - /** - * @param string $wrapperClass - * - * @return Exception - */ - public static function invalidWrapperClass($wrapperClass) - { - return new Exception("The given 'wrapperClass' " . $wrapperClass . ' has to be a ' . - 'subtype of \Doctrine\DBAL\Connection.'); - } - - /** - * @param string $driverClass - * - * @return Exception - */ - public static function invalidDriverClass($driverClass) - { - return new Exception( - "The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.' - ); - } - - /** - * @param string $tableName - * - * @return Exception - */ - public static function invalidTableName($tableName) - { - return new Exception('Invalid table name specified: ' . $tableName); - } - - /** - * @param string $tableName - * - * @return Exception - */ - public static function noColumnsSpecifiedForTable($tableName) - { - return new Exception('No columns specified for table ' . $tableName); - } - - /** - * @return Exception - */ - public static function limitOffsetInvalid() - { - return new Exception('Invalid Offset in Limit Query, it has to be larger than or equal to 0.'); - } - - /** - * @param string $name - * - * @return Exception - */ - public static function typeExists($name) - { - return new Exception('Type ' . $name . ' already exists.'); - } - - /** - * @param string $name - * - * @return Exception - */ - public static function unknownColumnType($name) - { - return new Exception('Unknown column type "' . $name . '" requested. Any Doctrine type that you use has ' . - 'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the ' . - 'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database ' . - 'introspection then you might have forgotten to register all database types for a Doctrine Type. Use ' . - 'AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' . - 'Type#getMappedDatabaseTypes(). If the type name is empty you might ' . - 'have a problem with the cache or forgot some mapping information.'); - } - - /** - * @param string $name - * - * @return Exception - */ - public static function typeNotFound($name) - { - return new Exception('Type to be overwritten ' . $name . ' does not exist.'); - } - - public static function typeNotRegistered(Type $type): self - { - return new Exception( - sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type)) - ); - } - - public static function typeAlreadyRegistered(Type $type): self - { - return new Exception( - sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type)) - ); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver.php deleted file mode 100644 index 6f8afbf3c..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver.php +++ /dev/null @@ -1,61 +0,0 @@ -getParams(); - - return $params['dbname']; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new DB2Platform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new DB2SchemaManager($conn); - } - - /** - * @param string $message - * - * @return DriverException - */ - public function convertException($message, TheDriverException $exception) - { - return new DriverException($message, $exception); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php deleted file mode 100644 index bf104545e..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php +++ /dev/null @@ -1,12 +0,0 @@ -errorCode = $errorCode; - $this->sqlState = $sqlState; - } - - /** - * {@inheritdoc} - */ - public function getErrorCode() - { - return $this->errorCode; - } - - /** - * {@inheritdoc} - */ - public function getSQLState() - { - return $this->sqlState; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php deleted file mode 100644 index edb33b89a..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php +++ /dev/null @@ -1,256 +0,0 @@ -getErrorCode()) { - case '1213': - return new DeadlockException($message, $exception); - - case '1205': - return new LockWaitTimeoutException($message, $exception); - - case '1050': - return new TableExistsException($message, $exception); - - case '1051': - case '1146': - return new TableNotFoundException($message, $exception); - - case '1216': - case '1217': - case '1451': - case '1452': - case '1701': - return new ForeignKeyConstraintViolationException($message, $exception); - - case '1062': - case '1557': - case '1569': - case '1586': - return new UniqueConstraintViolationException($message, $exception); - - case '1054': - case '1166': - case '1611': - return new InvalidFieldNameException($message, $exception); - - case '1052': - case '1060': - case '1110': - return new NonUniqueFieldNameException($message, $exception); - - case '1064': - case '1149': - case '1287': - case '1341': - case '1342': - case '1343': - case '1344': - case '1382': - case '1479': - case '1541': - case '1554': - case '1626': - return new SyntaxErrorException($message, $exception); - - case '1044': - case '1045': - case '1046': - case '1049': - case '1095': - case '1142': - case '1143': - case '1227': - case '1370': - case '1429': - case '2002': - case '2005': - return new ConnectionException($message, $exception); - - case '2006': - return new ConnectionLost($message, $exception); - - case '1048': - case '1121': - case '1138': - case '1171': - case '1252': - case '1263': - case '1364': - case '1566': - return new NotNullConstraintViolationException($message, $exception); - } - - return new DriverException($message, $exception); - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function createDatabasePlatformForVersion($version) - { - $mariadb = stripos($version, 'mariadb') !== false; - if ($mariadb && version_compare($this->getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) { - return new MariaDb1027Platform(); - } - - if (! $mariadb) { - $oracleMysqlVersion = $this->getOracleMysqlVersionNumber($version); - if (version_compare($oracleMysqlVersion, '8', '>=')) { - return new MySQL80Platform(); - } - - if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) { - return new MySQL57Platform(); - } - } - - return $this->getDatabasePlatform(); - } - - /** - * Get a normalized 'version number' from the server string - * returned by Oracle MySQL servers. - * - * @param string $versionString Version string returned by the driver, i.e. '5.7.10' - * - * @throws Exception - */ - private function getOracleMysqlVersionNumber(string $versionString): string - { - if ( - ! preg_match( - '/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', - $versionString, - $versionParts - ) - ) { - throw Exception::invalidPlatformVersionSpecified( - $versionString, - '..' - ); - } - - $majorVersion = $versionParts['major']; - $minorVersion = $versionParts['minor'] ?? 0; - $patchVersion = $versionParts['patch'] ?? null; - - if ($majorVersion === '5' && $minorVersion === '7' && $patchVersion === null) { - $patchVersion = '9'; - } - - return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; - } - - /** - * Detect MariaDB server version, including hack for some mariadb distributions - * that starts with the prefix '5.5.5-' - * - * @param string $versionString Version string as returned by mariadb server, i.e. '5.5.5-Mariadb-10.0.8-xenial' - * - * @throws Exception - */ - private function getMariaDbMysqlVersionNumber(string $versionString): string - { - if ( - ! preg_match( - '/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', - $versionString, - $versionParts - ) - ) { - throw Exception::invalidPlatformVersionSpecified( - $versionString, - '^(?:5\.5\.5-)?(mariadb-)?..' - ); - } - - return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - if (isset($params['dbname'])) { - return $params['dbname']; - } - - $database = $conn->query('SELECT DATABASE()')->fetchColumn(); - - assert($database !== false); - - return $database; - } - - /** - * {@inheritdoc} - * - * @return MySqlPlatform - */ - public function getDatabasePlatform() - { - return new MySqlPlatform(); - } - - /** - * {@inheritdoc} - * - * @return MySqlSchemaManager - */ - public function getSchemaManager(Connection $conn) - { - return new MySqlSchemaManager($conn); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php deleted file mode 100644 index be5826659..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php +++ /dev/null @@ -1,111 +0,0 @@ -getErrorCode()) { - case '1': - case '2299': - case '38911': - return new UniqueConstraintViolationException($message, $exception); - - case '904': - return new InvalidFieldNameException($message, $exception); - - case '918': - case '960': - return new NonUniqueFieldNameException($message, $exception); - - case '923': - return new SyntaxErrorException($message, $exception); - - case '942': - return new TableNotFoundException($message, $exception); - - case '955': - return new TableExistsException($message, $exception); - - case '1017': - case '12545': - return new ConnectionException($message, $exception); - - case '1400': - return new NotNullConstraintViolationException($message, $exception); - - case '2266': - case '2291': - case '2292': - return new ForeignKeyConstraintViolationException($message, $exception); - } - - return new DriverException($message, $exception); - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - return $params['user']; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new OraclePlatform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new OracleSchemaManager($conn); - } - - /** - * Returns an appropriate Easy Connect String for the given parameters. - * - * @param mixed[] $params The connection parameters to return the Easy Connect String for. - * - * @return string - */ - protected function getEasyConnectString(array $params) - { - return (string) EasyConnectString::fromConnectionParameters($params); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php deleted file mode 100644 index b96102555..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php +++ /dev/null @@ -1,171 +0,0 @@ -getSQLState(); - - switch ($sqlState) { - case '40001': - case '40P01': - return new DeadlockException($message, $exception); - - case '0A000': - // Foreign key constraint violations during a TRUNCATE operation - // are considered "feature not supported" in PostgreSQL. - if (strpos($exception->getMessage(), 'truncate') !== false) { - return new ForeignKeyConstraintViolationException($message, $exception); - } - - break; - - case '23502': - return new NotNullConstraintViolationException($message, $exception); - - case '23503': - return new ForeignKeyConstraintViolationException($message, $exception); - - case '23505': - return new UniqueConstraintViolationException($message, $exception); - - case '42601': - return new SyntaxErrorException($message, $exception); - - case '42702': - return new NonUniqueFieldNameException($message, $exception); - - case '42703': - return new InvalidFieldNameException($message, $exception); - - case '42P01': - return new TableNotFoundException($message, $exception); - - case '42P07': - return new TableExistsException($message, $exception); - - case '08006': - return new Exception\ConnectionException($message, $exception); - - case '7': - // Prior to fixing https://bugs.php.net/bug.php?id=64705 (PHP 7.3.22 and PHP 7.4.10), - // in some cases (mainly connection errors) the PDO exception wouldn't provide a SQLSTATE via its code. - // The exception code would be always set to 7 here. - // We have to match against the SQLSTATE in the error message in these cases. - if (strpos($exception->getMessage(), 'SQLSTATE[08006]') !== false) { - return new ConnectionException($message, $exception); - } - - break; - } - - return new DriverException($message, $exception); - } - - /** - * {@inheritdoc} - */ - public function createDatabasePlatformForVersion($version) - { - if (! preg_match('/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', $version, $versionParts)) { - throw Exception::invalidPlatformVersionSpecified( - $version, - '..' - ); - } - - $majorVersion = $versionParts['major']; - $minorVersion = $versionParts['minor'] ?? 0; - $patchVersion = $versionParts['patch'] ?? 0; - $version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion; - - switch (true) { - case version_compare($version, '10.0', '>='): - return new PostgreSQL100Platform(); - case version_compare($version, '9.4', '>='): - return new PostgreSQL94Platform(); - case version_compare($version, '9.2', '>='): - return new PostgreSQL92Platform(); - case version_compare($version, '9.1', '>='): - return new PostgreSQL91Platform(); - default: - return new PostgreSqlPlatform(); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - if (isset($params['dbname'])) { - return $params['dbname']; - } - - $database = $conn->query('SELECT CURRENT_DATABASE()')->fetchColumn(); - - assert($database !== false); - - return $database; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new PostgreSqlPlatform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new PostgreSqlSchemaManager($conn); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php deleted file mode 100644 index 7fc71870d..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php +++ /dev/null @@ -1,168 +0,0 @@ -getErrorCode()) { - case '-306': - case '-307': - case '-684': - return new DeadlockException($message, $exception); - - case '-210': - case '-1175': - case '-1281': - return new LockWaitTimeoutException($message, $exception); - - case '-100': - case '-103': - case '-832': - return new ConnectionException($message, $exception); - - case '-143': - return new InvalidFieldNameException($message, $exception); - - case '-193': - case '-196': - return new UniqueConstraintViolationException($message, $exception); - - case '-194': - case '-198': - return new ForeignKeyConstraintViolationException($message, $exception); - - case '-144': - return new NonUniqueFieldNameException($message, $exception); - - case '-184': - case '-195': - return new NotNullConstraintViolationException($message, $exception); - - case '-131': - return new SyntaxErrorException($message, $exception); - - case '-110': - return new TableExistsException($message, $exception); - - case '-141': - case '-1041': - return new TableNotFoundException($message, $exception); - } - - return new DriverException($message, $exception); - } - - /** - * {@inheritdoc} - */ - public function createDatabasePlatformForVersion($version) - { - if ( - ! preg_match( - '/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?)?/', - $version, - $versionParts - ) - ) { - throw Exception::invalidPlatformVersionSpecified( - $version, - '...' - ); - } - - $majorVersion = $versionParts['major']; - $minorVersion = $versionParts['minor'] ?? 0; - $patchVersion = $versionParts['patch'] ?? 0; - $buildVersion = $versionParts['build'] ?? 0; - $version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion; - - switch (true) { - case version_compare($version, '16', '>='): - return new SQLAnywhere16Platform(); - - case version_compare($version, '12', '>='): - return new SQLAnywhere12Platform(); - - case version_compare($version, '11', '>='): - return new SQLAnywhere11Platform(); - - default: - return new SQLAnywherePlatform(); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - if (isset($params['dbname'])) { - return $params['dbname']; - } - - $database = $conn->query('SELECT DB_NAME()')->fetchColumn(); - - assert($database !== false); - - return $database; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new SQLAnywhere12Platform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new SQLAnywhereSchemaManager($conn); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php deleted file mode 100644 index 2550ec5a8..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php +++ /dev/null @@ -1,107 +0,0 @@ -\d+)(?:\.(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?)?/', - $version, - $versionParts - ) - ) { - throw Exception::invalidPlatformVersionSpecified( - $version, - '...' - ); - } - - $majorVersion = $versionParts['major']; - $minorVersion = $versionParts['minor'] ?? 0; - $patchVersion = $versionParts['patch'] ?? 0; - $buildVersion = $versionParts['build'] ?? 0; - $version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion; - - switch (true) { - case version_compare($version, '11.00.2100', '>='): - return new SQLServer2012Platform(); - case version_compare($version, '10.00.1600', '>='): - return new SQLServer2008Platform(); - case version_compare($version, '9.00.1399', '>='): - return new SQLServer2005Platform(); - default: - return new SQLServerPlatform(); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - if (isset($params['dbname'])) { - return $params['dbname']; - } - - $database = $conn->query('SELECT DB_NAME()')->fetchColumn(); - - assert($database !== false); - - return $database; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new SQLServer2008Platform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new SQLServerSchemaManager($conn); - } - - /** - * @param string $message - * - * @return DriverException - */ - public function convertException($message, TheDriverException $exception) - { - return new DriverException($message, $exception); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php deleted file mode 100644 index 2e83e82be..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php +++ /dev/null @@ -1,12 +0,0 @@ -constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - } - - /** - * {@inheritdoc} - */ - public function createDatabasePlatformForVersion($version) - { - return $this->getDatabasePlatform(); - } - - /** - * {@inheritdoc} - * - * @return DrizzlePlatform - */ - public function getDatabasePlatform() - { - return new DrizzlePlatform(); - } - - /** - * {@inheritdoc} - * - * @return DrizzleSchemaManager - */ - public function getSchemaManager(\Doctrine\DBAL\Connection $conn) - { - return new DrizzleSchemaManager($conn); - } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'drizzle_pdo_mysql'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php deleted file mode 100644 index 19428cf94..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php +++ /dev/null @@ -1,29 +0,0 @@ -toString(); - - return new Connection( - $params, - (string) $username, - (string) $password, - $driverOptions - ); - } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'ibm_db2'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php deleted file mode 100644 index aa9ee29c0..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php +++ /dev/null @@ -1,14 +0,0 @@ -stmt = $stmt; - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - assert(is_int($param)); - - return $this->bindParam($param, $value, $type); - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - assert(is_int($param)); - - switch ($type) { - case ParameterType::INTEGER: - $this->bind($param, $variable, DB2_PARAM_IN, DB2_LONG); - break; - - case ParameterType::LARGE_OBJECT: - if (isset($this->lobs[$param])) { - [, $handle] = $this->lobs[$param]; - fclose($handle); - } - - $handle = $this->createTemporaryFile(); - $path = stream_get_meta_data($handle)['uri']; - - $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY); - - $this->lobs[$param] = [&$variable, $handle]; - break; - - default: - $this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR); - break; - } - - return true; - } - - /** - * @param int $position Parameter position - * @param mixed $variable - * - * @throws DB2Exception - */ - private function bind($position, &$variable, int $parameterType, int $dataType): void - { - $this->bindParam[$position] =& $variable; - - if (! db2_bind_param($this->stmt, $position, 'variable', $parameterType, $dataType)) { - throw StatementError::new($this->stmt); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->bindParam = []; - - if (! db2_free_result($this->stmt)) { - return false; - } - - $this->result = false; - - return true; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return db2_num_fields($this->stmt) ?: 0; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - return db2_stmt_error(); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return [ - db2_stmt_errormsg(), - db2_stmt_error(), - ]; - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - if ($params === null) { - ksort($this->bindParam); - - $params = []; - - foreach ($this->bindParam as $column => $value) { - $params[] = $value; - } - } - - foreach ($this->lobs as [$source, $target]) { - if (is_resource($source)) { - $this->copyStreamToStream($source, $target); - - continue; - } - - $this->writeStringToStream($source, $target); - } - - $retval = db2_execute($this->stmt, $params); - - foreach ($this->lobs as [, $handle]) { - fclose($handle); - } - - $this->lobs = []; - - if ($retval === false) { - throw StatementError::new($this->stmt); - } - - $this->result = true; - - return $retval; - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->defaultFetchMode = $fetchMode; - $this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass; - $this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - switch ($fetchMode) { - case FetchMode::COLUMN: - return $this->fetchColumn(); - - case FetchMode::MIXED: - return db2_fetch_both($this->stmt); - - case FetchMode::ASSOCIATIVE: - return db2_fetch_assoc($this->stmt); - - case FetchMode::CUSTOM_OBJECT: - $className = $this->defaultFetchClass; - $ctorArgs = $this->defaultFetchClassCtorArgs; - - if (func_num_args() >= 2) { - $args = func_get_args(); - $className = $args[1]; - $ctorArgs = $args[2] ?? []; - } - - $result = db2_fetch_object($this->stmt); - - if ($result instanceof stdClass) { - $result = $this->castObject($result, $className, $ctorArgs); - } - - return $result; - - case FetchMode::NUMERIC: - return db2_fetch_array($this->stmt); - - case FetchMode::STANDARD_OBJECT: - return db2_fetch_object($this->stmt); - - default: - throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.'); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $rows = []; - - switch ($fetchMode) { - case FetchMode::CUSTOM_OBJECT: - while (($row = $this->fetch(...func_get_args())) !== false) { - $rows[] = $row; - } - - break; - - case FetchMode::COLUMN: - while (($row = $this->fetchColumn()) !== false) { - $rows[] = $row; - } - - break; - - default: - while (($row = $this->fetch($fetchMode)) !== false) { - $rows[] = $row; - } - } - - return $rows; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - if ($row === false) { - return false; - } - - return $row[$columnIndex] ?? null; - } - - /** - * {@inheritDoc} - */ - public function fetchNumeric() - { - if (! $this->result) { - return false; - } - - return db2_fetch_array($this->stmt); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - // do not try fetching from the statement if it's not expected to contain the result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - return db2_fetch_assoc($this->stmt); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return FetchUtils::fetchAllNumeric($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return FetchUtils::fetchAllAssociative($this); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - return @db2_num_rows($this->stmt) ? : 0; - } - - public function free(): void - { - $this->bindParam = []; - - db2_free_result($this->stmt); - - $this->result = false; - } - - /** - * Casts a stdClass object to the given class name mapping its' properties. - * - * @param stdClass $sourceObject Object to cast from. - * @param class-string|object $destinationClass Name of the class or class instance to cast to. - * @param mixed[] $ctorArgs Arguments to use for constructing the destination class instance. - * - * @return object - * - * @throws DB2Exception - */ - private function castObject(stdClass $sourceObject, $destinationClass, array $ctorArgs = []) - { - if (! is_string($destinationClass)) { - if (! is_object($destinationClass)) { - throw new DB2Exception(sprintf( - 'Destination class has to be of type string or object, %s given.', - gettype($destinationClass) - )); - } - } else { - $destinationClass = new ReflectionClass($destinationClass); - $destinationClass = $destinationClass->newInstanceArgs($ctorArgs); - } - - $sourceReflection = new ReflectionObject($sourceObject); - $destinationClassReflection = new ReflectionObject($destinationClass); - /** @var ReflectionProperty[] $destinationProperties */ - $destinationProperties = array_change_key_case($destinationClassReflection->getProperties(), CASE_LOWER); - - foreach ($sourceReflection->getProperties() as $sourceProperty) { - $sourceProperty->setAccessible(true); - - $name = $sourceProperty->getName(); - $value = $sourceProperty->getValue($sourceObject); - - // Try to find a case-matching property. - if ($destinationClassReflection->hasProperty($name)) { - $destinationProperty = $destinationClassReflection->getProperty($name); - - $destinationProperty->setAccessible(true); - $destinationProperty->setValue($destinationClass, $value); - - continue; - } - - $name = strtolower($name); - - // Try to find a property without matching case. - // Fallback for the driver returning either all uppercase or all lowercase column names. - if (isset($destinationProperties[$name])) { - $destinationProperty = $destinationProperties[$name]; - - $destinationProperty->setAccessible(true); - $destinationProperty->setValue($destinationClass, $value); - - continue; - } - - $destinationClass->$name = $value; - } - - return $destinationClass; - } - - /** - * @return resource - * - * @throws DB2Exception - */ - private function createTemporaryFile() - { - $handle = @tmpfile(); - - if ($handle === false) { - throw CannotCreateTemporaryFile::new(error_get_last()); - } - - return $handle; - } - - /** - * @param resource $source - * @param resource $target - * - * @throws DB2Exception - */ - private function copyStreamToStream($source, $target): void - { - if (@stream_copy_to_stream($source, $target) === false) { - throw CannotCopyStreamToStream::new(error_get_last()); - } - } - - /** - * @param resource $target - * - * @throws DB2Exception - */ - private function writeStringToStream(string $string, $target): void - { - if (@fwrite($target, $string) === false) { - throw CannotWriteToTemporaryFile::new(error_get_last()); - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Driver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Driver.php deleted file mode 100644 index dcc84b32d..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Driver.php +++ /dev/null @@ -1,9 +0,0 @@ -conn = mysqli_init(); - - $this->setSecureConnection($params); - $this->setDriverOptions($driverOptions); - - set_error_handler(static function () { - }); - try { - if (! $this->conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket, $flags)) { - throw ConnectionFailed::new($this->conn); - } - } finally { - restore_error_handler(); - } - - if (! isset($params['charset'])) { - return; - } - - $this->conn->set_charset($params['charset']); - } - - /** - * Retrieves mysqli native resource handle. - * - * Could be used if part of your application is not using DBAL. - * - * @return mysqli - */ - public function getWrappedResourceHandle() - { - return $this->conn; - } - - /** - * {@inheritdoc} - * - * The server version detection includes a special case for MariaDB - * to support '5.5.5-' prefixed versions introduced in Maria 10+ - * - * @link https://jira.mariadb.org/browse/MDEV-4088 - */ - public function getServerVersion() - { - $serverInfos = $this->conn->get_server_info(); - if (stripos($serverInfos, 'mariadb') !== false) { - return $serverInfos; - } - - $majorVersion = floor($this->conn->server_version / 10000); - $minorVersion = floor(($this->conn->server_version - $majorVersion * 10000) / 100); - $patchVersion = floor($this->conn->server_version - $majorVersion * 10000 - $minorVersion * 100); - - return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; - } - - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function prepare($sql) - { - return new Statement($this->conn, $sql); - } - - /** - * {@inheritdoc} - */ - public function query() - { - $args = func_get_args(); - $sql = $args[0]; - $stmt = $this->prepare($sql); - $stmt->execute(); - - return $stmt; - } - - /** - * {@inheritdoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - return "'" . $this->conn->escape_string($value) . "'"; - } - - /** - * {@inheritdoc} - */ - public function exec($sql) - { - if ($this->conn->query($sql) === false) { - throw ConnectionError::new($this->conn); - } - - return $this->conn->affected_rows; - } - - /** - * {@inheritdoc} - */ - public function lastInsertId($name = null) - { - return $this->conn->insert_id; - } - - /** - * {@inheritdoc} - */ - public function beginTransaction() - { - $this->conn->query('START TRANSACTION'); - - return true; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - return $this->conn->commit(); - } - - /** - * {@inheritdoc}non-PHPdoc) - */ - public function rollBack() - { - return $this->conn->rollback(); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - * - * @return int - */ - public function errorCode() - { - return $this->conn->errno; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - * - * @return string - */ - public function errorInfo() - { - return $this->conn->error; - } - - /** - * Apply the driver options to the connection. - * - * @param mixed[] $driverOptions - * - * @throws MysqliException When one of of the options is not supported. - * @throws MysqliException When applying doesn't work - e.g. due to incorrect value. - */ - private function setDriverOptions(array $driverOptions = []): void - { - $supportedDriverOptions = [ - MYSQLI_OPT_CONNECT_TIMEOUT, - MYSQLI_OPT_LOCAL_INFILE, - MYSQLI_OPT_READ_TIMEOUT, - MYSQLI_INIT_COMMAND, - MYSQLI_READ_DEFAULT_FILE, - MYSQLI_READ_DEFAULT_GROUP, - MYSQLI_SERVER_PUBLIC_KEY, - ]; - - $exceptionMsg = "%s option '%s' with value '%s'"; - - foreach ($driverOptions as $option => $value) { - if ($option === static::OPTION_FLAGS) { - continue; - } - - if (! in_array($option, $supportedDriverOptions, true)) { - throw InvalidOption::fromOption($option, $value); - } - - if (@mysqli_options($this->conn, $option, $value)) { - continue; - } - - $msg = sprintf($exceptionMsg, 'Failed to set', $option, $value); - $msg .= sprintf(', error: %s (%d)', mysqli_error($this->conn), mysqli_errno($this->conn)); - - throw new MysqliException( - $msg, - $this->conn->sqlstate, - $this->conn->errno - ); - } - } - - /** - * Pings the server and re-connects when `mysqli.reconnect = 1` - * - * @deprecated - * - * @return bool - */ - public function ping() - { - return $this->conn->ping(); - } - - /** - * Establish a secure connection - * - * @param mixed[] $params - * - * @throws MysqliException - */ - private function setSecureConnection(array $params): void - { - if ( - ! isset($params['ssl_key']) && - ! isset($params['ssl_cert']) && - ! isset($params['ssl_ca']) && - ! isset($params['ssl_capath']) && - ! isset($params['ssl_cipher']) - ) { - return; - } - - $this->conn->ssl_set( - $params['ssl_key'] ?? null, - $params['ssl_cert'] ?? null, - $params['ssl_ca'] ?? null, - $params['ssl_capath'] ?? null, - $params['ssl_cipher'] ?? null - ); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php deleted file mode 100644 index 6fbff4291..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php +++ /dev/null @@ -1,14 +0,0 @@ - 's', - ParameterType::STRING => 's', - ParameterType::BINARY => 's', - ParameterType::BOOLEAN => 'i', - ParameterType::NULL => 's', - ParameterType::INTEGER => 'i', - ParameterType::LARGE_OBJECT => 'b', - ]; - - /** @var mysqli */ - protected $_conn; - - /** @var mysqli_stmt */ - protected $_stmt; - - /** @var string[]|false|null */ - protected $_columnNames; - - /** @var mixed[] */ - protected $_rowBindedValues = []; - - /** @var mixed[] */ - protected $_bindedValues; - - /** @var string */ - protected $types; - - /** - * Contains ref values for bindValue(). - * - * @var mixed[] - */ - protected $_values = []; - - /** @var int */ - protected $_defaultFetchMode = FetchMode::MIXED; - - /** - * Indicates whether the statement is in the state when fetching results is possible - * - * @var bool - */ - private $result = false; - - /** - * @internal The statement can be only instantiated by its driver connection. - * - * @param string $prepareString - * - * @throws MysqliException - */ - public function __construct(mysqli $conn, $prepareString) - { - $this->_conn = $conn; - - $stmt = $conn->prepare($prepareString); - - if ($stmt === false) { - throw ConnectionError::new($this->_conn); - } - - $this->_stmt = $stmt; - - $paramCount = $this->_stmt->param_count; - if (0 >= $paramCount) { - return; - } - - $this->types = str_repeat('s', $paramCount); - $this->_bindedValues = array_fill(1, $paramCount, null); - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - assert(is_int($param)); - - if (! isset(self::$_paramTypeMap[$type])) { - throw UnknownType::new($type); - } - - $this->_bindedValues[$param] =& $variable; - $this->types[$param - 1] = self::$_paramTypeMap[$type]; - - return true; - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - assert(is_int($param)); - - if (! isset(self::$_paramTypeMap[$type])) { - throw UnknownType::new($type); - } - - $this->_values[$param] = $value; - $this->_bindedValues[$param] =& $this->_values[$param]; - $this->types[$param - 1] = self::$_paramTypeMap[$type]; - - return true; - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - if ($this->_bindedValues !== null) { - if ($params !== null) { - if (! $this->bindUntypedValues($params)) { - throw StatementError::new($this->_stmt); - } - } else { - $this->bindTypedParameters(); - } - } - - if (! $this->_stmt->execute()) { - throw StatementError::new($this->_stmt); - } - - if ($this->_columnNames === null) { - $meta = $this->_stmt->result_metadata(); - if ($meta !== false) { - $fields = $meta->fetch_fields(); - assert(is_array($fields)); - - $columnNames = []; - foreach ($fields as $col) { - $columnNames[] = $col->name; - } - - $meta->free(); - - $this->_columnNames = $columnNames; - } else { - $this->_columnNames = false; - } - } - - if ($this->_columnNames !== false) { - // Store result of every execution which has it. Otherwise it will be impossible - // to execute a new statement in case if the previous one has non-fetched rows - // @link http://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html - $this->_stmt->store_result(); - - // Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql, - // it will have to allocate as much memory as it may be needed for the given column type - // (e.g. for a LONGBLOB column it's 4 gigabytes) - // @link https://bugs.php.net/bug.php?id=51386#1270673122 - // - // Make sure that the values are bound after each execution. Otherwise, if closeCursor() has been - // previously called on the statement, the values are unbound making the statement unusable. - // - // It's also important that row values are bound after _each_ call to store_result(). Otherwise, - // if mysqli is compiled with libmysql, subsequently fetched string values will get truncated - // to the length of the ones fetched during the previous execution. - $this->_rowBindedValues = array_fill(0, count($this->_columnNames), null); - - $refs = []; - foreach ($this->_rowBindedValues as $key => &$value) { - $refs[$key] =& $value; - } - - if (! $this->_stmt->bind_result(...$refs)) { - throw StatementError::new($this->_stmt); - } - } - - $this->result = true; - - return true; - } - - /** - * Binds parameters with known types previously bound to the statement - */ - private function bindTypedParameters(): void - { - $streams = $values = []; - $types = $this->types; - - foreach ($this->_bindedValues as $parameter => $value) { - assert(is_int($parameter)); - - if (! isset($types[$parameter - 1])) { - $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; - } - - if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) { - if (is_resource($value)) { - if (get_resource_type($value) !== 'stream') { - throw new InvalidArgumentException( - 'Resources passed with the LARGE_OBJECT parameter type must be stream resources.' - ); - } - - $streams[$parameter] = $value; - $values[$parameter] = null; - continue; - } - - $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; - } - - $values[$parameter] = $value; - } - - if (! $this->_stmt->bind_param($types, ...$values)) { - throw StatementError::new($this->_stmt); - } - - $this->sendLongData($streams); - } - - /** - * Handle $this->_longData after regular query parameters have been bound - * - * @param array $streams - * - * @throws MysqliException - */ - private function sendLongData(array $streams): void - { - foreach ($streams as $paramNr => $stream) { - while (! feof($stream)) { - $chunk = fread($stream, 8192); - - if ($chunk === false) { - throw FailedReadingStreamOffset::new($paramNr); - } - - if (! $this->_stmt->send_long_data($paramNr - 1, $chunk)) { - throw StatementError::new($this->_stmt); - } - } - } - } - - /** - * Binds a array of values to bound parameters. - * - * @param mixed[] $values - * - * @return bool - */ - private function bindUntypedValues(array $values) - { - $params = []; - $types = str_repeat('s', count($values)); - - foreach ($values as &$v) { - $params[] =& $v; - } - - return $this->_stmt->bind_param($types, ...$params); - } - - /** - * @return mixed[]|false|null - */ - private function _fetch() - { - $ret = $this->_stmt->fetch(); - - if ($ret === true) { - $values = []; - foreach ($this->_rowBindedValues as $v) { - $values[] = $v; - } - - return $values; - } - - return $ret; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; - - if ($fetchMode === FetchMode::COLUMN) { - return $this->fetchColumn(); - } - - $values = $this->_fetch(); - - if ($values === null) { - return false; - } - - if ($values === false) { - throw StatementError::new($this->_stmt); - } - - if ($fetchMode === FetchMode::NUMERIC) { - return $values; - } - - assert(is_array($this->_columnNames)); - $assoc = array_combine($this->_columnNames, $values); - assert(is_array($assoc)); - - switch ($fetchMode) { - case FetchMode::ASSOCIATIVE: - return $assoc; - - case FetchMode::MIXED: - return $assoc + $values; - - case FetchMode::STANDARD_OBJECT: - return (object) $assoc; - - default: - throw new MysqliException(sprintf("Unknown fetch type '%s'", $fetchMode)); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; - - $rows = []; - - if ($fetchMode === FetchMode::COLUMN) { - while (($row = $this->fetchColumn()) !== false) { - $rows[] = $row; - } - } else { - while (($row = $this->fetch($fetchMode)) !== false) { - $rows[] = $row; - } - } - - return $rows; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - if ($row === false) { - return false; - } - - return $row[$columnIndex] ?? null; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function fetchNumeric() - { - // do not try fetching from the statement if it's not expected to contain the result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - $values = $this->_fetch(); - - if ($values === null) { - return false; - } - - if ($values === false) { - throw StatementError::new($this->_stmt); - } - - return $values; - } - - /** - * {@inheritDoc} - */ - public function fetchAssociative() - { - $values = $this->fetchNumeric(); - - if ($values === false) { - return false; - } - - assert(is_array($this->_columnNames)); - $row = array_combine($this->_columnNames, $values); - assert(is_array($row)); - - return $row; - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return FetchUtils::fetchAllNumeric($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return FetchUtils::fetchAllAssociative($this); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - /** - * {@inheritdoc} - */ - public function errorCode() - { - return $this->_stmt->errno; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - * - * @return string - */ - public function errorInfo() - { - return $this->_stmt->error; - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->free(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - if ($this->_columnNames === false) { - return $this->_stmt->affected_rows; - } - - return $this->_stmt->num_rows; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return $this->_stmt->field_count; - } - - public function free(): void - { - $this->_stmt->free_result(); - $this->result = false; - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->_defaultFetchMode = $fetchMode; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Statement.php deleted file mode 100644 index bfd6ae900..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Statement.php +++ /dev/null @@ -1,7 +0,0 @@ -_constructDsn($params), - $params['charset'] ?? '', - $params['sessionMode'] ?? OCI_NO_AUTO_COMMIT, - $params['persistent'] ?? false - ); - } catch (OCI8Exception $e) { - throw Exception::driverException($this, $e); - } - } - - /** - * Constructs the Oracle DSN. - * - * @param mixed[] $params - * - * @return string The DSN. - */ - protected function _constructDsn(array $params) - { - return $this->getEasyConnectString($params); - } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'oci8'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php deleted file mode 100644 index 8e043ff54..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php +++ /dev/null @@ -1,259 +0,0 @@ -dbh = $dbh; - } - - /** - * {@inheritdoc} - * - * @throws UnexpectedValueException If the version string returned by the database server - * does not contain a parsable version number. - */ - public function getServerVersion() - { - $version = oci_server_version($this->dbh); - - if ($version === false) { - throw OCI8Exception::fromErrorInfo(oci_error($this->dbh)); - } - - if (! preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches)) { - throw new UnexpectedValueException( - sprintf( - 'Unexpected database version string "%s". Cannot parse an appropriate version number from it. ' . - 'Please report this database version string to the Doctrine team.', - $version - ) - ); - } - - return $matches[1]; - } - - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function prepare($sql) - { - return new Statement($this->dbh, $sql, $this); - } - - /** - * {@inheritdoc} - */ - public function query() - { - $args = func_get_args(); - $sql = $args[0]; - //$fetchMode = $args[1]; - $stmt = $this->prepare($sql); - $stmt->execute(); - - return $stmt; - } - - /** - * {@inheritdoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - if (is_int($value) || is_float($value)) { - return $value; - } - - $value = str_replace("'", "''", $value); - - return "'" . addcslashes($value, "\000\n\r\\\032") . "'"; - } - - /** - * {@inheritdoc} - */ - public function exec($sql) - { - $stmt = $this->prepare($sql); - $stmt->execute(); - - return $stmt->rowCount(); - } - - /** - * {@inheritdoc} - * - * @return int|false - */ - public function lastInsertId($name = null) - { - if ($name === null) { - return false; - } - - $sql = 'SELECT ' . $name . '.CURRVAL FROM DUAL'; - $stmt = $this->query($sql); - $result = $stmt->fetchColumn(); - - if ($result === false) { - throw SequenceDoesNotExist::new(); - } - - return (int) $result; - } - - /** - * Returns the current execution mode. - * - * @internal - * - * @return int - */ - public function getExecuteMode() - { - return $this->executeMode; - } - - /** - * {@inheritdoc} - */ - public function beginTransaction() - { - $this->executeMode = OCI_NO_AUTO_COMMIT; - - return true; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - if (! oci_commit($this->dbh)) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); - } - - $this->executeMode = OCI_COMMIT_ON_SUCCESS; - - return true; - } - - /** - * {@inheritdoc} - */ - public function rollBack() - { - if (! oci_rollback($this->dbh)) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); - } - - $this->executeMode = OCI_COMMIT_ON_SUCCESS; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - $error = oci_error($this->dbh); - - if ($error !== false) { - return $error['code']; - } - - return null; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - $error = oci_error($this->dbh); - - if ($error === false) { - return []; - } - - return $error; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php deleted file mode 100644 index ab1449f3b..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php +++ /dev/null @@ -1,27 +0,0 @@ - OCI_BOTH, - FetchMode::ASSOCIATIVE => OCI_ASSOC, - FetchMode::NUMERIC => OCI_NUM, - FetchMode::COLUMN => OCI_NUM, - ]; - - /** @var int */ - protected $_defaultFetchMode = FetchMode::MIXED; - - /** @var string[] */ - protected $_paramMap = []; - - /** - * Holds references to bound parameter values. - * - * This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected. - * - * @var mixed[] - */ - private $boundValues = []; - - /** - * Indicates whether the statement is in the state when fetching results is possible - * - * @var bool - */ - private $result = false; - - /** - * Creates a new OCI8Statement that uses the given connection handle and SQL statement. - * - * @internal The statement can be only instantiated by its driver connection. - * - * @param resource $dbh The connection handle. - * @param string $query The SQL query. - */ - public function __construct($dbh, $query, OCI8Connection $conn) - { - [$query, $paramMap] = self::convertPositionalToNamedPlaceholders($query); - - $stmt = oci_parse($dbh, $query); - assert(is_resource($stmt)); - - $this->_sth = $stmt; - $this->_dbh = $dbh; - $this->_paramMap = $paramMap; - $this->_conn = $conn; - } - - /** - * Converts positional (?) into named placeholders (:param). - * - * Oracle does not support positional parameters, hence this method converts all - * positional parameters into artificially named parameters. Note that this conversion - * is not perfect. All question marks (?) in the original statement are treated as - * placeholders and converted to a named parameter. - * - * The algorithm uses a state machine with two possible states: InLiteral and NotInLiteral. - * Question marks inside literal strings are therefore handled correctly by this method. - * This comes at a cost, the whole sql statement has to be looped over. - * - * @internal - * - * @param string $statement The SQL statement to convert. - * - * @return mixed[] [0] => the statement value (string), [1] => the paramMap value (array). - * - * @throws OCI8Exception - * - * @todo extract into utility class in Doctrine\DBAL\Util namespace - * @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements. - */ - public static function convertPositionalToNamedPlaceholders($statement) - { - $fragmentOffset = $tokenOffset = 0; - $fragments = $paramMap = []; - $currentLiteralDelimiter = null; - - do { - if (! $currentLiteralDelimiter) { - $result = self::findPlaceholderOrOpeningQuote( - $statement, - $tokenOffset, - $fragmentOffset, - $fragments, - $currentLiteralDelimiter, - $paramMap - ); - } else { - $result = self::findClosingQuote($statement, $tokenOffset, $currentLiteralDelimiter); - } - } while ($result); - - if ($currentLiteralDelimiter) { - throw NonTerminatedStringLiteral::new($tokenOffset - 1); - } - - $fragments[] = substr($statement, $fragmentOffset); - $statement = implode('', $fragments); - - return [$statement, $paramMap]; - } - - /** - * Finds next placeholder or opening quote. - * - * @param string $statement The SQL statement to parse - * @param int $tokenOffset The offset to start searching from - * @param int $fragmentOffset The offset to build the next fragment from - * @param string[] $fragments Fragments of the original statement - * not containing placeholders - * @param string|null $currentLiteralDelimiter The delimiter of the current string literal - * or NULL if not currently in a literal - * @param array $paramMap Mapping of the original parameter positions - * to their named replacements - * - * @return bool Whether the token was found - */ - private static function findPlaceholderOrOpeningQuote( - $statement, - &$tokenOffset, - &$fragmentOffset, - &$fragments, - &$currentLiteralDelimiter, - &$paramMap - ) { - $token = self::findToken($statement, $tokenOffset, '/[?\'"]/'); - - if (! $token) { - return false; - } - - if ($token === '?') { - $position = count($paramMap) + 1; - $param = ':param' . $position; - $fragments[] = substr($statement, $fragmentOffset, $tokenOffset - $fragmentOffset); - $fragments[] = $param; - $paramMap[$position] = $param; - $tokenOffset += 1; - $fragmentOffset = $tokenOffset; - - return true; - } - - $currentLiteralDelimiter = $token; - ++$tokenOffset; - - return true; - } - - /** - * Finds closing quote - * - * @param string $statement The SQL statement to parse - * @param int $tokenOffset The offset to start searching from - * @param string $currentLiteralDelimiter The delimiter of the current string literal - * - * @return bool Whether the token was found - */ - private static function findClosingQuote( - $statement, - &$tokenOffset, - &$currentLiteralDelimiter - ) { - $token = self::findToken( - $statement, - $tokenOffset, - '/' . preg_quote($currentLiteralDelimiter, '/') . '/' - ); - - if (! $token) { - return false; - } - - $currentLiteralDelimiter = false; - ++$tokenOffset; - - return true; - } - - /** - * Finds the token described by regex starting from the given offset. Updates the offset with the position - * where the token was found. - * - * @param string $statement The SQL statement to parse - * @param int $offset The offset to start searching from - * @param string $regex The regex containing token pattern - * - * @return string|null Token or NULL if not found - */ - private static function findToken($statement, &$offset, $regex) - { - if (preg_match($regex, $statement, $matches, PREG_OFFSET_CAPTURE, $offset)) { - $offset = $matches[0][1]; - - return $matches[0][0]; - } - - return null; - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - return $this->bindParam($param, $value, $type, null); - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - if (is_int($param)) { - if (! isset($this->_paramMap[$param])) { - throw UnknownParameterIndex::new($param); - } - - $param = $this->_paramMap[$param]; - } - - if ($type === ParameterType::LARGE_OBJECT) { - $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); - - assert($lob !== false); - - $lob->writeTemporary($variable, OCI_TEMP_BLOB); - - $variable =& $lob; - } - - $this->boundValues[$param] =& $variable; - - return oci_bind_by_name( - $this->_sth, - $param, - $variable, - $length ?? -1, - $this->convertParameterType($type) - ); - } - - /** - * Converts DBAL parameter type to oci8 parameter type - */ - private function convertParameterType(int $type): int - { - switch ($type) { - case ParameterType::BINARY: - return OCI_B_BIN; - - case ParameterType::LARGE_OBJECT: - return OCI_B_BLOB; - - default: - return SQLT_CHR; - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->free(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return oci_num_fields($this->_sth) ?: 0; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - $error = oci_error($this->_sth); - if ($error !== false) { - $error = $error['code']; - } - - return $error; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - $error = oci_error($this->_sth); - - if ($error === false) { - return []; - } - - return $error; - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - if ($params) { - $hasZeroIndex = array_key_exists(0, $params); - - foreach ($params as $key => $val) { - if ($hasZeroIndex && is_int($key)) { - $this->bindValue($key + 1, $val); - } else { - $this->bindValue($key, $val); - } - } - } - - $ret = @oci_execute($this->_sth, $this->_conn->getExecuteMode()); - if (! $ret) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); - } - - $this->result = true; - - return $ret; - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->_defaultFetchMode = $fetchMode; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; - - if ($fetchMode === FetchMode::COLUMN) { - return $this->fetchColumn(); - } - - if ($fetchMode === FetchMode::STANDARD_OBJECT) { - return oci_fetch_object($this->_sth); - } - - if (! isset(self::$fetchModeMap[$fetchMode])) { - throw new InvalidArgumentException('Invalid fetch style: ' . $fetchMode); - } - - return oci_fetch_array( - $this->_sth, - self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | OCI_RETURN_LOBS - ); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; - - $result = []; - - if ($fetchMode === FetchMode::STANDARD_OBJECT) { - while ($row = $this->fetch($fetchMode)) { - $result[] = $row; - } - - return $result; - } - - if (! isset(self::$fetchModeMap[$fetchMode])) { - throw new InvalidArgumentException('Invalid fetch style: ' . $fetchMode); - } - - if (self::$fetchModeMap[$fetchMode] === OCI_BOTH) { - while ($row = $this->fetch($fetchMode)) { - $result[] = $row; - } - } else { - $fetchStructure = OCI_FETCHSTATEMENT_BY_ROW; - - if ($fetchMode === FetchMode::COLUMN) { - $fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN; - } - - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if (! $this->result) { - return []; - } - - oci_fetch_all( - $this->_sth, - $result, - 0, - -1, - self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS - ); - - if ($fetchMode === FetchMode::COLUMN) { - $result = $result[0]; - } - } - - return $result; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); - - if ($row === false) { - return false; - } - - return $row[$columnIndex] ?? null; - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - return oci_num_rows($this->_sth) ?: 0; - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - return $this->doFetch(OCI_NUM); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->doFetch(OCI_ASSOC); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return $this->doFetchAll(OCI_NUM, OCI_FETCHSTATEMENT_BY_ROW); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return $this->doFetchAll(OCI_ASSOC, OCI_FETCHSTATEMENT_BY_ROW); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return $this->doFetchAll(OCI_NUM, OCI_FETCHSTATEMENT_BY_COLUMN)[0]; - } - - public function free(): void - { - // not having the result means there's nothing to close - if (! $this->result) { - return; - } - - oci_cancel($this->_sth); - - $this->result = false; - } - - /** - * @return mixed|false - */ - private function doFetch(int $mode) - { - // do not try fetching from the statement if it's not expected to contain the result - // in order to prevent exceptional situation - if (! $this->result) { - return false; - } - - return oci_fetch_array( - $this->_sth, - $mode | OCI_RETURN_NULLS | OCI_RETURN_LOBS - ); - } - - /** - * @return array - */ - private function doFetchAll(int $mode, int $fetchStructure): array - { - // do not try fetching from the statement if it's not expected to contain the result - // in order to prevent exceptional situation - if (! $this->result) { - return []; - } - - oci_fetch_all( - $this->_sth, - $result, - 0, - -1, - $mode | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS - ); - - return $result; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Statement.php deleted file mode 100644 index 2cab1e59c..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Statement.php +++ /dev/null @@ -1,7 +0,0 @@ -setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]); - $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - */ - public function exec($sql) - { - try { - $result = parent::exec($sql); - assert($result !== false); - - return $result; - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - */ - public function getServerVersion() - { - return PDO::getAttribute(PDO::ATTR_SERVER_VERSION); - } - - /** - * @param string $sql - * @param array $driverOptions - * - * @return PDOStatement - */ - public function prepare($sql, $driverOptions = []) - { - try { - $statement = parent::prepare($sql, $driverOptions); - assert($statement instanceof PDOStatement); - - return $statement; - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - return parent::quote($value, $type); - } - - /** - * {@inheritdoc} - */ - public function lastInsertId($name = null) - { - try { - if ($name === null) { - return parent::lastInsertId(); - } - - return parent::lastInsertId($name); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return false; - } - - /** - * @param mixed ...$args - */ - private function doQuery(...$args): PDOStatement - { - try { - $stmt = parent::query(...$args); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - - assert($stmt instanceof PDOStatement); - - return $stmt; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php deleted file mode 100644 index b2c01eb44..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php +++ /dev/null @@ -1,56 +0,0 @@ -getMessage(), 0, $exception); - - $this->code = $exception->getCode(); - $this->errorInfo = $exception->errorInfo; - $this->errorCode = $exception->errorInfo[1] ?? $exception->getCode(); - $this->sqlState = $exception->errorInfo[0] ?? $exception->getCode(); - } - - /** - * {@inheritdoc} - */ - public function getErrorCode() - { - return $this->errorCode; - } - - /** - * {@inheritdoc} - */ - public function getSQLState() - { - return $this->sqlState; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php deleted file mode 100644 index 0543d8786..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php +++ /dev/null @@ -1,63 +0,0 @@ -_constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - } - - /** - * Constructs the IBM PDO DSN. - * - * @param mixed[] $params - * - * @return string The DSN. - */ - private function _constructPdoDsn(array $params) - { - $dsn = 'ibm:'; - if (isset($params['host'])) { - $dsn .= 'HOSTNAME=' . $params['host'] . ';'; - } - - if (isset($params['port'])) { - $dsn .= 'PORT=' . $params['port'] . ';'; - } - - $dsn .= 'PROTOCOL=TCPIP;'; - if (isset($params['dbname'])) { - $dsn .= 'DATABASE=' . $params['dbname'] . ';'; - } - - return $dsn; - } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'pdo_ibm'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php deleted file mode 100644 index b6792996c..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php +++ /dev/null @@ -1,64 +0,0 @@ -constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - } catch (PDOException $e) { - throw Exception::driverException($this, $e); - } - } - - /** - * Constructs the Oracle PDO DSN. - * - * @param mixed[] $params - * - * @return string The DSN. - */ - private function constructPdoDsn(array $params) - { - $dsn = 'oci:dbname=' . $this->getEasyConnectString($params); - - if (isset($params['charset'])) { - $dsn .= ';charset=' . $params['charset']; - } - - return $dsn; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'pdo_oracle'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php deleted file mode 100644 index be05bf646..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php +++ /dev/null @@ -1,39 +0,0 @@ -= 80000) { - /** - * @internal - */ - trait PDOQueryImplementation - { - /** - * @return PDOStatement - */ - public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs) - { - return $this->doQuery($query, $fetchMode, ...$fetchModeArgs); - } - } -} else { - /** - * @internal - */ - trait PDOQueryImplementation - { - /** - * @return PDOStatement - */ - public function query() - { - return $this->doQuery(...func_get_args()); - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php deleted file mode 100644 index 238b8155b..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php +++ /dev/null @@ -1,44 +0,0 @@ -setAttribute(\PDO::ATTR_STATEMENT_CLASS, [PDO\SQLSrv\Statement::class, []]); - } - - /** - * {@inheritDoc} - */ - public function lastInsertId($name = null) - { - if ($name === null) { - return parent::lastInsertId($name); - } - - $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); - $stmt->execute([$name]); - - if ($stmt instanceof Result) { - return $stmt->fetchOne(); - } - - return $stmt->fetchColumn(); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php deleted file mode 100644 index 5669ccc27..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php +++ /dev/null @@ -1,46 +0,0 @@ -bindParam($param, $value, $type); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php deleted file mode 100644 index 86d6a15d4..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php +++ /dev/null @@ -1,308 +0,0 @@ - PDO::PARAM_NULL, - ParameterType::INTEGER => PDO::PARAM_INT, - ParameterType::STRING => PDO::PARAM_STR, - ParameterType::ASCII => PDO::PARAM_STR, - ParameterType::BINARY => PDO::PARAM_LOB, - ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, - ParameterType::BOOLEAN => PDO::PARAM_BOOL, - ]; - - private const FETCH_MODE_MAP = [ - FetchMode::ASSOCIATIVE => PDO::FETCH_ASSOC, - FetchMode::NUMERIC => PDO::FETCH_NUM, - FetchMode::MIXED => PDO::FETCH_BOTH, - FetchMode::STANDARD_OBJECT => PDO::FETCH_OBJ, - FetchMode::COLUMN => PDO::FETCH_COLUMN, - FetchMode::CUSTOM_OBJECT => PDO::FETCH_CLASS, - ]; - - /** - * Protected constructor. - * - * @internal The statement can be only instantiated by its driver connection. - */ - protected function __construct() - { - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - $type = $this->convertParamType($type); - - try { - return parent::bindValue($param, $value, $type); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * @param mixed $param - * @param mixed $variable - * @param int $type - * @param int|null $length - * @param mixed $driverOptions - * - * @return bool - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) - { - $type = $this->convertParamType($type); - - try { - return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - try { - return parent::closeCursor(); - } catch (PDOException $exception) { - // Exceptions not allowed by the interface. - // In case driver implementations do not adhere to the interface, silence exceptions here. - return true; - } - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - try { - return parent::execute($params); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - $args = func_get_args(); - - if (isset($args[0])) { - $args[0] = $this->convertFetchMode($args[0]); - } - - try { - return parent::fetch(...$args); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - try { - return parent::fetchColumn($columnIndex); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - return $this->fetch(PDO::FETCH_NUM); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->fetch(PDO::FETCH_ASSOC); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return $this->fetch(PDO::FETCH_COLUMN); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return $this->fetchAll(PDO::FETCH_NUM); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return $this->fetchAll(PDO::FETCH_ASSOC); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return $this->fetchAll(PDO::FETCH_COLUMN); - } - - public function free(): void - { - parent::closeCursor(); - } - - /** - * @param mixed ...$args - */ - private function doSetFetchMode(int $fetchMode, ...$args): bool - { - $fetchMode = $this->convertFetchMode($fetchMode); - - // This thin wrapper is necessary to shield against the weird signature - // of PDOStatement::setFetchMode(): even if the second and third - // parameters are optional, PHP will not let us remove it from this - // declaration. - $slice = []; - - foreach ($args as $arg) { - if ($arg === null) { - break; - } - - $slice[] = $arg; - } - - try { - return parent::setFetchMode($fetchMode, ...$slice); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * @param mixed ...$args - * - * @return mixed[] - */ - private function doFetchAll(...$args): array - { - if (isset($args[0])) { - $args[0] = $this->convertFetchMode($args[0]); - } - - $slice = []; - - foreach ($args as $arg) { - if ($arg === null) { - break; - } - - $slice[] = $arg; - } - - try { - $data = parent::fetchAll(...$slice); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - - assert(is_array($data)); - - return $data; - } - - /** - * Converts DBAL parameter type to PDO parameter type - * - * @param int $type Parameter type - */ - private function convertParamType(int $type): int - { - if (! isset(self::PARAM_TYPE_MAP[$type])) { - // TODO: next major: throw an exception - @trigger_error(sprintf( - 'Using a PDO parameter type (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0', - $type - ), E_USER_DEPRECATED); - - return $type; - } - - return self::PARAM_TYPE_MAP[$type]; - } - - /** - * Converts DBAL fetch mode to PDO fetch mode - * - * @param int $fetchMode Fetch mode - */ - private function convertFetchMode(int $fetchMode): int - { - if (! isset(self::FETCH_MODE_MAP[$fetchMode])) { - // TODO: next major: throw an exception - @trigger_error(sprintf( - 'Using a PDO fetch mode or their combination (%d given)' . - ' is deprecated and will cause an error in Doctrine DBAL 3.0', - $fetchMode - ), E_USER_DEPRECATED); - - return $fetchMode; - } - - return self::FETCH_MODE_MAP[$fetchMode]; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatementImplementations.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatementImplementations.php deleted file mode 100644 index ff1a4af50..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatementImplementations.php +++ /dev/null @@ -1,73 +0,0 @@ -= 80000) { - /** - * @internal - */ - trait PDOStatementImplementations - { - /** - * @deprecated Use one of the fetch- or iterate-related methods. - * - * @param int $mode - * @param mixed ...$args - * - * @return bool - */ - public function setFetchMode($mode, ...$args) - { - return $this->doSetFetchMode($mode, ...$args); - } - - /** - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - * - * @param int|null $mode - * @param mixed ...$args - * - * @return mixed[] - */ - public function fetchAll($mode = null, ...$args) - { - return $this->doFetchAll($mode, ...$args); - } - } -} else { - /** - * @internal - */ - trait PDOStatementImplementations - { - /** - * @deprecated Use one of the fetch- or iterate-related methods. - * - * @param int $fetchMode - * @param mixed $arg2 - * @param mixed $arg3 - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null): bool - { - return $this->doSetFetchMode(...func_get_args()); - } - - /** - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - * - * @param int|null $fetchMode - * @param mixed $fetchArgument - * @param mixed $ctorArgs - * - * @return mixed[] - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - return $this->doFetchAll(...func_get_args()); - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php deleted file mode 100644 index 42202e7ab..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php +++ /dev/null @@ -1,19 +0,0 @@ -buildDsn( - $params['host'] ?? null, - $params['port'] ?? null, - $params['server'] ?? null, - $params['dbname'] ?? null, - $username, - $password, - $driverOptions - ), - $params['persistent'] ?? false - ); - } catch (SQLAnywhereException $e) { - throw Exception::driverException($this, $e); - } - } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'sqlanywhere'; - } - - /** - * Build the connection string for given connection parameters and driver options. - * - * @param string|null $host Host address to connect to. - * @param int|null $port Port to use for the connection (default to SQL Anywhere standard port 2638). - * @param string|null $server Database server name on the host to connect to. - * SQL Anywhere allows multiple database server instances on the same host, - * therefore specifying the server instance name to use is mandatory. - * @param string|null $dbname Name of the database on the server instance to connect to. - * @param string $username User name to use for connection authentication. - * @param string $password Password to use for connection authentication. - * @param mixed[] $driverOptions Additional parameters to use for the connection. - * - * @return string - */ - private function buildDsn( - $host, - $port, - $server, - $dbname, - $username = null, - $password = null, - array $driverOptions = [] - ) { - $host = $host ?: 'localhost'; - $port = $port ?: 2638; - - if (! empty($server)) { - $server = ';ServerName=' . $server; - } - - return 'HOST=' . $host . ':' . $port . - $server . - ';DBN=' . $dbname . - ';UID=' . $username . - ';PWD=' . $password . - ';' . implode( - ';', - array_map(static function ($key, $value) { - return $key . '=' . $value; - }, array_keys($driverOptions), $driverOptions) - ); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php deleted file mode 100644 index ae5b13f4f..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php +++ /dev/null @@ -1,235 +0,0 @@ -connection = $persistent ? @sasql_pconnect($dsn) : @sasql_connect($dsn); - - if (! is_resource($this->connection)) { - throw SQLAnywhereException::fromSQLAnywhereError(); - } - - // Disable PHP warnings on error. - if (! sasql_set_option($this->connection, 'verbose_errors', false)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - // Enable auto committing by default. - if (! sasql_set_option($this->connection, 'auto_commit', 'on')) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - } - - /** - * {@inheritdoc} - * - * @throws SQLAnywhereException - */ - public function beginTransaction() - { - if (! sasql_set_option($this->connection, 'auto_commit', 'off')) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - return true; - } - - /** - * {@inheritdoc} - * - * @throws SQLAnywhereException - */ - public function commit() - { - if (! sasql_commit($this->connection)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - $this->endTransaction(); - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - return sasql_errorcode($this->connection); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return sasql_error($this->connection); - } - - /** - * {@inheritdoc} - */ - public function exec($sql) - { - if (sasql_real_query($this->connection, $sql) === false) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - return sasql_affected_rows($this->connection); - } - - /** - * {@inheritdoc} - */ - public function getServerVersion() - { - $stmt = $this->query("SELECT PROPERTY('ProductVersion')"); - - if ($stmt instanceof Result) { - $version = $stmt->fetchOne(); - } else { - $version = $stmt->fetchColumn(); - } - - assert(is_string($version)); - - return $version; - } - - /** - * {@inheritdoc} - */ - public function lastInsertId($name = null) - { - if ($name === null) { - return sasql_insert_id($this->connection); - } - - $stmt = $this->query('SELECT ' . $name . '.CURRVAL'); - - if ($stmt instanceof Result) { - return $stmt->fetchOne(); - } - - return $stmt->fetchColumn(); - } - - /** - * {@inheritdoc} - */ - public function prepare($sql) - { - return new SQLAnywhereStatement($this->connection, $sql); - } - - /** - * {@inheritdoc} - */ - public function query() - { - $args = func_get_args(); - $stmt = $this->prepare($args[0]); - - $stmt->execute(); - - return $stmt; - } - - /** - * {@inheritdoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - if (is_int($value) || is_float($value)) { - return $value; - } - - return "'" . sasql_escape_string($this->connection, $value) . "'"; - } - - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return true; - } - - /** - * {@inheritdoc} - * - * @throws SQLAnywhereException - */ - public function rollBack() - { - if (! sasql_rollback($this->connection)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - $this->endTransaction(); - - return true; - } - - /** - * Ends transactional mode and enables auto commit again. - * - * @return bool Whether or not ending transactional mode succeeded. - * - * @throws SQLAnywhereException - */ - private function endTransaction() - { - if (! sasql_set_option($this->connection, 'auto_commit', 'on')) { - throw SQLAnywhereException::fromSQLAnywhereError($this->connection); - } - - return true; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php deleted file mode 100644 index 5446a3b14..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php +++ /dev/null @@ -1,74 +0,0 @@ -conn = $conn; - $this->stmt = sasql_prepare($conn, $sql); - - if (! is_resource($this->stmt)) { - throw SQLAnywhereException::fromSQLAnywhereError($conn); - } - } - - /** - * {@inheritdoc} - * - * @throws SQLAnywhereException - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - assert(is_int($param)); - - switch ($type) { - case ParameterType::INTEGER: - case ParameterType::BOOLEAN: - $type = 'i'; - break; - - case ParameterType::LARGE_OBJECT: - $type = 'b'; - break; - - case ParameterType::NULL: - case ParameterType::STRING: - case ParameterType::BINARY: - $type = 's'; - break; - - default: - throw new SQLAnywhereException('Unknown type: ' . $type); - } - - $this->boundValues[$param] =& $variable; - - if (! sasql_stmt_bind_param_ex($this->stmt, $param - 1, $variable, $type, $variable === null)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - assert(is_int($param)); - - return $this->bindParam($param, $value, $type); - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - * - * @throws SQLAnywhereException - */ - public function closeCursor() - { - if (! sasql_stmt_reset($this->stmt)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return sasql_stmt_field_count($this->stmt); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - return sasql_stmt_errno($this->stmt); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return sasql_stmt_error($this->stmt); - } - - /** - * {@inheritdoc} - * - * @throws SQLAnywhereException - */ - public function execute($params = null) - { - if (is_array($params)) { - $hasZeroIndex = array_key_exists(0, $params); - - foreach ($params as $key => $val) { - if ($hasZeroIndex && is_int($key)) { - $this->bindValue($key + 1, $val); - } else { - $this->bindValue($key, $val); - } - } - } - - if (! sasql_stmt_execute($this->stmt)) { - throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt); - } - - $this->result = sasql_stmt_result_metadata($this->stmt); - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - * - * @throws SQLAnywhereException - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - if (! is_resource($this->result)) { - return false; - } - - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - switch ($fetchMode) { - case FetchMode::COLUMN: - return $this->fetchColumn(); - - case FetchMode::ASSOCIATIVE: - return sasql_fetch_assoc($this->result); - - case FetchMode::MIXED: - return sasql_fetch_array($this->result, SASQL_BOTH); - - case FetchMode::CUSTOM_OBJECT: - $className = $this->defaultFetchClass; - $ctorArgs = $this->defaultFetchClassCtorArgs; - - if (func_num_args() >= 2) { - $args = func_get_args(); - $className = $args[1]; - $ctorArgs = $args[2] ?? []; - } - - $result = sasql_fetch_object($this->result); - - if ($result instanceof stdClass) { - $result = $this->castObject($result, $className, $ctorArgs); - } - - return $result; - - case FetchMode::NUMERIC: - return sasql_fetch_row($this->result); - - case FetchMode::STANDARD_OBJECT: - return sasql_fetch_object($this->result); - - default: - throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode); - } - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $rows = []; - - switch ($fetchMode) { - case FetchMode::CUSTOM_OBJECT: - while (($row = $this->fetch(...func_get_args())) !== false) { - $rows[] = $row; - } - - break; - - case FetchMode::COLUMN: - while (($row = $this->fetchColumn()) !== false) { - $rows[] = $row; - } - - break; - - default: - while (($row = $this->fetch($fetchMode)) !== false) { - $rows[] = $row; - } - } - - return $rows; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - if ($row === false) { - return false; - } - - return $row[$columnIndex] ?? null; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } - - /** - * {@inheritDoc} - */ - public function fetchNumeric() - { - if (! is_resource($this->result)) { - return false; - } - - return sasql_fetch_row($this->result); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - if (! is_resource($this->result)) { - return false; - } - - return sasql_fetch_assoc($this->result); - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * @return array> - * - * @throws Exception - */ - public function fetchAllNumeric(): array - { - return FetchUtils::fetchAllNumeric($this); - } - - /** - * @return array> - * - * @throws Exception - */ - public function fetchAllAssociative(): array - { - return FetchUtils::fetchAllAssociative($this); - } - - /** - * @return array - * - * @throws Exception - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - return sasql_stmt_affected_rows($this->stmt); - } - - public function free(): void - { - sasql_stmt_reset($this->stmt); - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->defaultFetchMode = $fetchMode; - $this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass; - $this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs; - - return true; - } - - /** - * Casts a stdClass object to the given class name mapping its' properties. - * - * @param stdClass $sourceObject Object to cast from. - * @param class-string|object $destinationClass Name of the class or class instance to cast to. - * @param mixed[] $ctorArgs Arguments to use for constructing the destination class instance. - * - * @return object - * - * @throws SQLAnywhereException - */ - private function castObject(stdClass $sourceObject, $destinationClass, array $ctorArgs = []) - { - if (! is_string($destinationClass)) { - if (! is_object($destinationClass)) { - throw new SQLAnywhereException(sprintf( - 'Destination class has to be of type string or object, %s given.', - gettype($destinationClass) - )); - } - } else { - $destinationClass = new ReflectionClass($destinationClass); - $destinationClass = $destinationClass->newInstanceArgs($ctorArgs); - } - - $sourceReflection = new ReflectionObject($sourceObject); - $destinationClassReflection = new ReflectionObject($destinationClass); - - foreach ($sourceReflection->getProperties() as $sourceProperty) { - $sourceProperty->setAccessible(true); - - $name = $sourceProperty->getName(); - $value = $sourceProperty->getValue($sourceObject); - - if ($destinationClassReflection->hasProperty($name)) { - $destinationProperty = $destinationClassReflection->getProperty($name); - - $destinationProperty->setAccessible(true); - $destinationProperty->setValue($destinationClass, $value); - } else { - $destinationClass->$name = $value; - } - } - - return $destinationClass; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Connection.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Connection.php deleted file mode 100644 index 6e009b5db..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Connection.php +++ /dev/null @@ -1,7 +0,0 @@ - SQLSRV_FETCH_BOTH, - FetchMode::ASSOCIATIVE => SQLSRV_FETCH_ASSOC, - FetchMode::NUMERIC => SQLSRV_FETCH_NUMERIC, - ]; - - /** - * The name of the default class to instantiate when fetching class instances. - * - * @var string - */ - private $defaultFetchClass = '\stdClass'; - - /** - * The constructor arguments for the default class to instantiate when fetching class instances. - * - * @var mixed[] - */ - private $defaultFetchClassCtorArgs = []; - - /** - * The fetch style. - * - * @var int - */ - private $defaultFetchMode = FetchMode::MIXED; - - /** - * The last insert ID. - * - * @var LastInsertId|null - */ - private $lastInsertId; - - /** - * Indicates whether the statement is in the state when fetching results is possible - * - * @var bool - */ - private $result = false; - - /** - * Append to any INSERT query to retrieve the last insert id. - * - * @deprecated This constant has been deprecated and will be made private in 3.0 - */ - public const LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;'; - - /** - * @internal The statement can be only instantiated by its driver connection. - * - * @param resource $conn - * @param string $sql - */ - public function __construct($conn, $sql, ?LastInsertId $lastInsertId = null) - { - $this->conn = $conn; - $this->sql = $sql; - - if (stripos($sql, 'INSERT INTO ') !== 0) { - return; - } - - $this->sql .= self::LAST_INSERT_ID_SQL; - $this->lastInsertId = $lastInsertId; - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - if (! is_numeric($param)) { - throw new SQLSrvException( - 'sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.' - ); - } - - $this->variables[$param] = $value; - $this->types[$param] = $type; - - return true; - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - if (! is_numeric($param)) { - throw new SQLSrvException( - 'sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.' - ); - } - - $this->variables[$param] =& $variable; - $this->types[$param] = $type; - - // unset the statement resource if it exists as the new one will need to be bound to the new variable - $this->stmt = null; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - $this->free(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - if ($this->stmt === null) { - return 0; - } - - return sqlsrv_num_fields($this->stmt) ?: 0; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - $errors = sqlsrv_errors(SQLSRV_ERR_ERRORS); - if ($errors) { - return $errors[0]['code']; - } - - return false; - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return (array) sqlsrv_errors(SQLSRV_ERR_ERRORS); - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - if ($params) { - $hasZeroIndex = array_key_exists(0, $params); - - foreach ($params as $key => $val) { - if ($hasZeroIndex && is_int($key)) { - $this->bindValue($key + 1, $val); - } else { - $this->bindValue($key, $val); - } - } - } - - if (! $this->stmt) { - $this->stmt = $this->prepare(); - } - - if (! sqlsrv_execute($this->stmt)) { - throw Error::new(); - } - - if ($this->lastInsertId) { - sqlsrv_next_result($this->stmt); - sqlsrv_fetch($this->stmt); - $this->lastInsertId->setId(sqlsrv_get_field($this->stmt, 0)); - } - - $this->result = true; - - return true; - } - - /** - * Prepares SQL Server statement resource - * - * @return resource - * - * @throws SQLSrvException - */ - private function prepare() - { - $params = []; - - foreach ($this->variables as $column => &$variable) { - switch ($this->types[$column]) { - case ParameterType::LARGE_OBJECT: - $params[$column - 1] = [ - &$variable, - SQLSRV_PARAM_IN, - SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), - SQLSRV_SQLTYPE_VARBINARY('max'), - ]; - break; - - case ParameterType::BINARY: - $params[$column - 1] = [ - &$variable, - SQLSRV_PARAM_IN, - SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY), - ]; - break; - - case ParameterType::ASCII: - $params[$column - 1] = [ - &$variable, - SQLSRV_PARAM_IN, - SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), - ]; - break; - - default: - $params[$column - 1] =& $variable; - break; - } - } - - $stmt = sqlsrv_prepare($this->conn, $this->sql, $params); - - if (! $stmt) { - throw Error::new(); - } - - return $stmt; - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->defaultFetchMode = $fetchMode; - $this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass; - $this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs; - - return true; - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - * - * @throws SQLSrvException - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - // do not try fetching from the statement if it's not expected to contain result - // in order to prevent exceptional situation - if ($this->stmt === null || ! $this->result) { - return false; - } - - $args = func_get_args(); - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - if ($fetchMode === FetchMode::COLUMN) { - return $this->fetchColumn(); - } - - if (isset(self::$fetchMap[$fetchMode])) { - return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false; - } - - if (in_array($fetchMode, [FetchMode::STANDARD_OBJECT, FetchMode::CUSTOM_OBJECT], true)) { - $className = $this->defaultFetchClass; - $ctorArgs = $this->defaultFetchClassCtorArgs; - - if (count($args) >= 2) { - $className = $args[1]; - $ctorArgs = $args[2] ?? []; - } - - return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false; - } - - throw new SQLSrvException('Fetch mode is not supported!'); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $rows = []; - - switch ($fetchMode) { - case FetchMode::CUSTOM_OBJECT: - while (($row = $this->fetch(...func_get_args())) !== false) { - $rows[] = $row; - } - - break; - - case FetchMode::COLUMN: - while (($row = $this->fetchColumn()) !== false) { - $rows[] = $row; - } - - break; - - default: - while (($row = $this->fetch($fetchMode)) !== false) { - $rows[] = $row; - } - } - - return $rows; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $row = $this->fetch(FetchMode::NUMERIC); - - if ($row === false) { - return false; - } - - return $row[$columnIndex] ?? null; - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - return $this->doFetch(SQLSRV_FETCH_NUMERIC); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->doFetch(SQLSRV_FETCH_ASSOC); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return FetchUtils::fetchAllNumeric($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - return FetchUtils::fetchAllAssociative($this); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - if ($this->stmt === null) { - return 0; - } - - return sqlsrv_rows_affected($this->stmt) ?: 0; - } - - public function free(): void - { - // not having the result means there's nothing to close - if ($this->stmt === null || ! $this->result) { - return; - } - - // emulate it by fetching and discarding rows, similarly to what PDO does in this case - // @link http://php.net/manual/en/pdostatement.closecursor.php - // @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075 - // deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them - while (sqlsrv_fetch($this->stmt)) { - } - - $this->result = false; - } - - /** - * @return mixed|false - */ - private function doFetch(int $fetchType) - { - // do not try fetching from the statement if it's not expected to contain the result - // in order to prevent exceptional situation - if ($this->stmt === null || ! $this->result) { - return false; - } - - return sqlsrv_fetch_array($this->stmt, $fetchType) ?? false; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Statement.php deleted file mode 100644 index 6a96b87c9..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Statement.php +++ /dev/null @@ -1,7 +0,0 @@ -statement = $statement; - } - - /** - * {@inheritdoc} - */ - public function getIterator() - { - while (($result = $this->statement->fetch()) !== false) { - yield $result; - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php b/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php deleted file mode 100644 index 0b6ffbb9d..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php +++ /dev/null @@ -1,61 +0,0 @@ -connection = $connection; - } - - /** - * @return Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDriver() instead. - * - * @return Driver - */ - public function getDriver() - { - return $this->connection->getDriver(); - } - - /** - * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDatabasePlatform() instead. - * - * @return AbstractPlatform - */ - public function getDatabasePlatform() - { - return $this->connection->getDatabasePlatform(); - } - - /** - * @deprecated Use ConnectionEventArgs::getConnection() and Connection::getSchemaManager() instead. - * - * @return AbstractSchemaManager - */ - public function getSchemaManager() - { - return $this->connection->getSchemaManager(); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php b/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php deleted file mode 100644 index 8748dd174..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php +++ /dev/null @@ -1,58 +0,0 @@ -charset = $charset; - $this->collation = $collation; - } - - /** - * @return void - */ - public function postConnect(ConnectionEventArgs $args) - { - $collation = $this->collation ? ' COLLATE ' . $this->collation : ''; - $args->getConnection()->executeStatement('SET NAMES ' . $this->charset . $collation); - } - - /** - * {@inheritdoc} - */ - public function getSubscribedEvents() - { - return [Events::postConnect]; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Exception.php b/doctrine/dbal/lib/Doctrine/DBAL/Exception.php deleted file mode 100644 index 34442da6a..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Exception.php +++ /dev/null @@ -1,10 +0,0 @@ -driverException = $driverException; - } - - /** - * Returns the driver specific error code if given. - * - * Returns null if no error code was given by the driver. - * - * @return int|string|null - */ - public function getErrorCode() - { - return $this->driverException->getErrorCode(); - } - - /** - * Returns the SQLSTATE the driver was in at the time the error occurred, if given. - * - * Returns null if no SQLSTATE was given by the driver. - * - * @return string|null - */ - public function getSQLState() - { - return $this->driverException->getSQLState(); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/FetchMode.php b/doctrine/dbal/lib/Doctrine/DBAL/FetchMode.php deleted file mode 100644 index bef473f5e..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/FetchMode.php +++ /dev/null @@ -1,75 +0,0 @@ -_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - protected function _getCommonIntegerTypeDeclarationSQL(array $column) - { - $autoinc = ''; - if (! empty($column['autoincrement'])) { - $autoinc = ' AUTO_INCREMENT'; - } - - return $autoinc; - } - - /** - * {@inheritDoc} - */ - public function getBigIntTypeDeclarationSQL(array $column) - { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getSmallIntTypeDeclarationSQL(array $column) - { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) - { - return $length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'; - } - - /** - * {@inheritdoc} - */ - protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) - { - return 'VARBINARY(' . ($length ?: 255) . ')'; - } - - /** - * {@inheritDoc} - */ - protected function initializeDoctrineTypeMappings() - { - $this->doctrineTypeMapping = [ - 'boolean' => 'boolean', - 'varchar' => 'string', - 'varbinary' => 'binary', - 'integer' => 'integer', - 'blob' => 'blob', - 'decimal' => 'decimal', - 'datetime' => 'datetime', - 'date' => 'date', - 'time' => 'time', - 'text' => 'text', - 'timestamp' => 'datetime', - 'double' => 'float', - 'bigint' => 'bigint', - ]; - } - - /** - * {@inheritDoc} - */ - public function getClobTypeDeclarationSQL(array $column) - { - return 'TEXT'; - } - - /** - * {@inheritDoc} - */ - public function getBlobTypeDeclarationSQL(array $column) - { - return 'BLOB'; - } - - /** - * {@inheritDoc} - */ - public function getCreateDatabaseSQL($name) - { - return 'CREATE DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getDropDatabaseSQL($name) - { - return 'DROP DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = []) - { - $queryFields = $this->getColumnDeclarationListSQL($columns); - - if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $index => $definition) { - $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition); - } - } - - // add all indexes - if (isset($options['indexes']) && ! empty($options['indexes'])) { - foreach ($options['indexes'] as $index => $definition) { - $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition); - } - } - - // attach all primary keys - if (isset($options['primary']) && ! empty($options['primary'])) { - $keyColumns = array_unique(array_values($options['primary'])); - $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; - } - - $query = 'CREATE '; - - if (! empty($options['temporary'])) { - $query .= 'TEMPORARY '; - } - - $query .= 'TABLE ' . $name . ' (' . $queryFields . ') '; - $query .= $this->buildTableOptions($options); - $query .= $this->buildPartitionOptions($options); - - $sql = [$query]; - - if (isset($options['foreignKeys'])) { - foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $name); - } - } - - return $sql; - } - - /** - * Build SQL for table options - * - * @param mixed[] $options - * - * @return string - */ - private function buildTableOptions(array $options) - { - if (isset($options['table_options'])) { - return $options['table_options']; - } - - $tableOptions = []; - - // Collate - if (! isset($options['collate'])) { - $options['collate'] = 'utf8_unicode_ci'; - } - - $tableOptions[] = sprintf('COLLATE %s', $options['collate']); - - // Engine - if (! isset($options['engine'])) { - $options['engine'] = 'InnoDB'; - } - - $tableOptions[] = sprintf('ENGINE = %s', $options['engine']); - - // Auto increment - if (isset($options['auto_increment'])) { - $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']); - } - - // Comment - if (isset($options['comment'])) { - $comment = trim($options['comment'], " '"); - - $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($comment)); - } - - // Row format - if (isset($options['row_format'])) { - $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']); - } - - return implode(' ', $tableOptions); - } - - /** - * Build SQL for partition options. - * - * @param mixed[] $options - * - * @return string - */ - private function buildPartitionOptions(array $options) - { - return isset($options['partition_options']) - ? ' ' . $options['partition_options'] - : ''; - } - - /** - * {@inheritDoc} - */ - public function getListDatabasesSQL() - { - return "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME='LOCAL'"; - } - - /** - * {@inheritDoc} - */ - protected function getReservedKeywordsClass() - { - return Keywords\DrizzleKeywords::class; - } - - /** - * {@inheritDoc} - */ - public function getListTablesSQL() - { - return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE' AND TABLE_SCHEMA=DATABASE()"; - } - - /** - * {@inheritDoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - if ($database) { - $databaseSQL = $this->quoteStringLiteral($database); - } else { - $databaseSQL = 'DATABASE()'; - } - - return 'SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT,' . - ' CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT, NUMERIC_PRECISION, NUMERIC_SCALE, COLLATION_NAME' . - ' FROM DATA_DICTIONARY.COLUMNS' . - ' WHERE TABLE_SCHEMA=' . $databaseSQL . ' AND TABLE_NAME = ' . $this->quoteStringLiteral($table); - } - - /** - * @param string $table - * @param string|null $database - * - * @return string - */ - public function getListTableForeignKeysSQL($table, $database = null) - { - if ($database) { - $databaseSQL = $this->quoteStringLiteral($database); - } else { - $databaseSQL = 'DATABASE()'; - } - - return 'SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS,' - . ' UPDATE_RULE, DELETE_RULE' - . ' FROM DATA_DICTIONARY.FOREIGN_KEYS' - . ' WHERE CONSTRAINT_SCHEMA=' . $databaseSQL - . ' AND CONSTRAINT_TABLE=' . $this->quoteStringLiteral($table); - } - - /** - * {@inheritDoc} - */ - public function getListTableIndexesSQL($table, $database = null) - { - if ($database) { - $databaseSQL = $this->quoteStringLiteral($database); - } else { - $databaseSQL = 'DATABASE()'; - } - - return "SELECT INDEX_NAME AS 'key_name'," - . " COLUMN_NAME AS 'column_name'," - . " IS_USED_IN_PRIMARY AS 'primary'," - . " IS_UNIQUE=0 AS 'non_unique'" - . ' FROM DATA_DICTIONARY.INDEX_PARTS' - . ' WHERE TABLE_SCHEMA=' . $databaseSQL . ' AND TABLE_NAME=' . $this->quoteStringLiteral($table); - } - - /** - * {@inheritDoc} - */ - public function prefersIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsInlineColumnComments() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsViews() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function supportsColumnCollation() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getDropIndexSQL($index, $table = null) - { - if ($index instanceof Index) { - $indexName = $index->getQuotedName($this); - } elseif (is_string($index)) { - $indexName = $index; - } else { - throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' - ); - } - - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } elseif (! is_string($table)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' - ); - } - - if ($index instanceof Index && $index->isPrimary()) { - // drizzle primary keys are always named "PRIMARY", - // so we cannot use them in statements because of them being keyword. - return $this->getDropPrimaryKeySQL($table); - } - - return 'DROP INDEX ' . $indexName . ' ON ' . $table; - } - - /** - * @param string $table - * - * @return string - */ - protected function getDropPrimaryKeySQL($table) - { - return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTypeDeclarationSQL(array $column) - { - if (isset($column['version']) && $column['version'] === true) { - return 'TIMESTAMP'; - } - - return 'DATETIME'; - } - - /** - * {@inheritDoc} - */ - public function getTimeTypeDeclarationSQL(array $column) - { - return 'TIME'; - } - - /** - * {@inheritDoc} - */ - public function getDateTypeDeclarationSQL(array $column) - { - return 'DATE'; - } - - /** - * {@inheritDoc} - */ - public function getAlterTableSQL(TableDiff $diff) - { - $columnSql = []; - $queryParts = []; - - $newName = $diff->getNewName(); - - if ($newName !== false) { - $queryParts[] = 'RENAME TO ' . $newName->getQuotedName($this); - } - - foreach ($diff->addedColumns as $column) { - if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { - continue; - } - - $columnArray = array_merge($column->toArray(), [ - 'comment' => $this->getColumnComment($column), - ]); - - $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - foreach ($diff->removedColumns as $column) { - if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { - continue; - } - - $queryParts[] = 'DROP ' . $column->getQuotedName($this); - } - - foreach ($diff->changedColumns as $columnDiff) { - if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { - continue; - } - - $column = $columnDiff->column; - $columnArray = $column->toArray(); - - // Do not generate column alteration clause if type is binary and only fixed property has changed. - // Drizzle only supports binary type columns with variable length. - // Avoids unnecessary table alteration statements. - if ( - $columnArray['type'] instanceof BinaryType && - $columnDiff->hasChanged('fixed') && - count($columnDiff->changedProperties) === 1 - ) { - continue; - } - - $columnArray['comment'] = $this->getColumnComment($column); - $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' - . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - foreach ($diff->renamedColumns as $oldColumnName => $column) { - if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { - continue; - } - - $oldColumnName = new Identifier($oldColumnName); - - $columnArray = $column->toArray(); - $columnArray['comment'] = $this->getColumnComment($column); - $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' - . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - $sql = []; - $tableSql = []; - - if (! $this->onSchemaAlterTable($diff, $tableSql)) { - if (count($queryParts) > 0) { - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) - . ' ' . implode(', ', $queryParts); - } - - $sql = array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - } - - return array_merge($sql, $tableSql, $columnSql); - } - - /** - * {@inheritDoc} - */ - public function getDropTemporaryTableSQL($table) - { - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } elseif (! is_string($table)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' - ); - } - - return 'DROP TEMPORARY TABLE ' . $table; - } - - /** - * {@inheritDoc} - */ - public function convertBooleans($item) - { - if (is_array($item)) { - foreach ($item as $key => $value) { - if (! is_bool($value) && ! is_numeric($value)) { - continue; - } - - $item[$key] = $value ? 'true' : 'false'; - } - } elseif (is_bool($item) || is_numeric($item)) { - $item = $item ? 'true' : 'false'; - } - - return $item; - } - - /** - * {@inheritDoc} - */ - public function getLocateExpression($str, $substr, $startPos = false) - { - if ($startPos === false) { - return 'LOCATE(' . $substr . ', ' . $str . ')'; - } - - return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; - } - - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'UUID()'; - } - - /** - * {@inheritDoc} - */ - public function getRegexpExpression() - { - return 'RLIKE'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php deleted file mode 100644 index 70f69f44b..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php +++ /dev/null @@ -1,326 +0,0 @@ -quoteSingleIdentifier($collation); - } - - /** - * {@inheritDoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - $sql = parent::getListTableColumnsSQL($table, $database); - $parts = explode('AS complete_type,', $sql, 2); - - return $parts[0] . 'AS complete_type, ' - . '(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' - . $parts[1]; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php deleted file mode 100644 index 9a1784a55..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php +++ /dev/null @@ -1,72 +0,0 @@ -doctrineTypeMapping['json'] = Types::JSON; - } - - /** - * {@inheritdoc} - */ - public function getCloseActiveDatabaseConnectionsSQL($database) - { - return sprintf( - 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s', - $this->quoteStringLiteral($database) - ); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php deleted file mode 100644 index c17020f74..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php +++ /dev/null @@ -1,41 +0,0 @@ -doctrineTypeMapping['jsonb'] = Types::JSON; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php deleted file mode 100644 index 71922b227..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php +++ /dev/null @@ -1,28 +0,0 @@ -getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize() . - ' START WITH ' . $sequence->getInitialValue() . - ' MINVALUE ' . $sequence->getInitialValue(); - } - - /** - * {@inheritdoc} - */ - public function getAlterSequenceSQL(Sequence $sequence) - { - return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize(); - } - - /** - * {@inheritdoc} - */ - public function getDateTimeTzFormatString() - { - return 'Y-m-d H:i:s.uP'; - } - - /** - * {@inheritdoc} - */ - public function getDateTimeTzTypeDeclarationSQL(array $column) - { - return 'TIMESTAMP WITH TIME ZONE'; - } - - /** - * {@inheritdoc} - */ - public function getDropSequenceSQL($sequence) - { - if ($sequence instanceof Sequence) { - $sequence = $sequence->getQuotedName($this); - } - - return 'DROP SEQUENCE ' . $sequence; - } - - /** - * {@inheritdoc} - */ - public function getListSequencesSQL($database) - { - return 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE'; - } - - /** - * {@inheritdoc} - */ - public function getSequenceNextValSQL($sequence) - { - return 'SELECT ' . $sequence . '.NEXTVAL'; - } - - /** - * {@inheritdoc} - */ - public function supportsSequences() - { - return true; - } - - /** - * {@inheritdoc} - */ - protected function getAdvancedIndexOptionsSQL(Index $index) - { - if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_not_distinct')) { - return ' WITH NULLS NOT DISTINCT' . parent::getAdvancedIndexOptionsSQL($index); - } - - return parent::getAdvancedIndexOptionsSQL($index); - } - - /** - * {@inheritdoc} - */ - protected function getReservedKeywordsClass() - { - return Keywords\SQLAnywhere12Keywords::class; - } - - /** - * {@inheritDoc} - */ - protected function initializeDoctrineTypeMappings() - { - parent::initializeDoctrineTypeMappings(); - $this->doctrineTypeMapping['timestamp with time zone'] = 'datetime'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php deleted file mode 100644 index 35d4238e4..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php +++ /dev/null @@ -1,39 +0,0 @@ -hasFlag('with_nulls_distinct') && $index->hasFlag('with_nulls_not_distinct')) { - throw new UnexpectedValueException( - 'An Index can either have a "with_nulls_distinct" or "with_nulls_not_distinct" flag but not both.' - ); - } - - if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_distinct')) { - return ' WITH NULLS DISTINCT' . parent::getAdvancedIndexOptionsSQL($index); - } - - return parent::getAdvancedIndexOptionsSQL($index); - } - - /** - * {@inheritdoc} - */ - protected function getReservedKeywordsClass() - { - return Keywords\SQLAnywhere16Keywords::class; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php deleted file mode 100644 index f7921cbde..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ /dev/null @@ -1,1525 +0,0 @@ -getMaxIdentifierLength(); - - if (strlen($schemaElementName) > $maxIdentifierLength) { - return substr($schemaElementName, 0, $maxIdentifierLength); - } - - return $schemaElementName; - } - - /** - * {@inheritdoc} - */ - public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) - { - $query = ''; - - if ($foreignKey->hasOption('match')) { - $query = ' MATCH ' . $this->getForeignKeyMatchClauseSQL($foreignKey->getOption('match')); - } - - $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); - - if ($foreignKey->hasOption('check_on_commit') && (bool) $foreignKey->getOption('check_on_commit')) { - $query .= ' CHECK ON COMMIT'; - } - - if ($foreignKey->hasOption('clustered') && (bool) $foreignKey->getOption('clustered')) { - $query .= ' CLUSTERED'; - } - - if ($foreignKey->hasOption('for_olap_workload') && (bool) $foreignKey->getOption('for_olap_workload')) { - $query .= ' FOR OLAP WORKLOAD'; - } - - return $query; - } - - /** - * {@inheritdoc} - */ - public function getAlterTableSQL(TableDiff $diff) - { - $sql = []; - $columnSql = []; - $commentsSQL = []; - $tableSql = []; - $alterClauses = []; - - foreach ($diff->addedColumns as $column) { - if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { - continue; - } - - $alterClauses[] = $this->getAlterTableAddColumnClause($column); - - $comment = $this->getColumnComment($column); - - if ($comment === null || $comment === '') { - continue; - } - - $commentsSQL[] = $this->getCommentOnColumnSQL( - $diff->getName($this)->getQuotedName($this), - $column->getQuotedName($this), - $comment - ); - } - - foreach ($diff->removedColumns as $column) { - if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { - continue; - } - - $alterClauses[] = $this->getAlterTableRemoveColumnClause($column); - } - - foreach ($diff->changedColumns as $columnDiff) { - if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { - continue; - } - - $alterClause = $this->getAlterTableChangeColumnClause($columnDiff); - - if ($alterClause !== null) { - $alterClauses[] = $alterClause; - } - - if (! $columnDiff->hasChanged('comment')) { - continue; - } - - $column = $columnDiff->column; - - $commentsSQL[] = $this->getCommentOnColumnSQL( - $diff->getName($this)->getQuotedName($this), - $column->getQuotedName($this), - $this->getColumnComment($column) - ); - } - - foreach ($diff->renamedColumns as $oldColumnName => $column) { - if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { - continue; - } - - $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' . - $this->getAlterTableRenameColumnClause($oldColumnName, $column); - } - - if (! $this->onSchemaAlterTable($diff, $tableSql)) { - if (! empty($alterClauses)) { - $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' . implode(', ', $alterClauses); - } - - $sql = array_merge($sql, $commentsSQL); - - $newName = $diff->getNewName(); - - if ($newName !== false) { - $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' . - $this->getAlterTableRenameTableClause($newName); - } - - $sql = array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - } - - return array_merge($sql, $tableSql, $columnSql); - } - - /** - * Returns the SQL clause for creating a column in a table alteration. - * - * @param Column $column The column to add. - * - * @return string - */ - protected function getAlterTableAddColumnClause(Column $column) - { - return 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); - } - - /** - * Returns the SQL clause for altering a table. - * - * @param Identifier $tableName The quoted name of the table to alter. - * - * @return string - */ - protected function getAlterTableClause(Identifier $tableName) - { - return 'ALTER TABLE ' . $tableName->getQuotedName($this); - } - - /** - * Returns the SQL clause for dropping a column in a table alteration. - * - * @param Column $column The column to drop. - * - * @return string - */ - protected function getAlterTableRemoveColumnClause(Column $column) - { - return 'DROP ' . $column->getQuotedName($this); - } - - /** - * Returns the SQL clause for renaming a column in a table alteration. - * - * @param string $oldColumnName The quoted name of the column to rename. - * @param Column $column The column to rename to. - * - * @return string - */ - protected function getAlterTableRenameColumnClause($oldColumnName, Column $column) - { - $oldColumnName = new Identifier($oldColumnName); - - return 'RENAME ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this); - } - - /** - * Returns the SQL clause for renaming a table in a table alteration. - * - * @param Identifier $newTableName The quoted name of the table to rename to. - * - * @return string - */ - protected function getAlterTableRenameTableClause(Identifier $newTableName) - { - return 'RENAME ' . $newTableName->getQuotedName($this); - } - - /** - * Returns the SQL clause for altering a column in a table alteration. - * - * This method returns null in case that only the column comment has changed. - * Changes in column comments have to be handled differently. - * - * @param ColumnDiff $columnDiff The diff of the column to alter. - * - * @return string|null - */ - protected function getAlterTableChangeColumnClause(ColumnDiff $columnDiff) - { - $column = $columnDiff->column; - - // Do not return alter clause if only comment has changed. - if (! ($columnDiff->hasChanged('comment') && count($columnDiff->changedProperties) === 1)) { - $columnAlterationClause = 'ALTER ' . - $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); - - if ($columnDiff->hasChanged('default') && $column->getDefault() === null) { - $columnAlterationClause .= ', ALTER ' . $column->getQuotedName($this) . ' DROP DEFAULT'; - } - - return $columnAlterationClause; - } - - return null; - } - - /** - * {@inheritdoc} - */ - public function getBigIntTypeDeclarationSQL(array $column) - { - $column['integer_type'] = 'BIGINT'; - - return $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritdoc} - */ - public function getBinaryDefaultLength() - { - return 1; - } - - /** - * {@inheritdoc} - */ - public function getBinaryMaxLength() - { - return 32767; - } - - /** - * {@inheritdoc} - */ - public function getBlobTypeDeclarationSQL(array $column) - { - return 'LONG BINARY'; - } - - /** - * {@inheritdoc} - * - * BIT type columns require an explicit NULL declaration - * in SQL Anywhere if they shall be nullable. - * Otherwise by just omitting the NOT NULL clause, - * SQL Anywhere will declare them NOT NULL nonetheless. - */ - public function getBooleanTypeDeclarationSQL(array $column) - { - $nullClause = isset($column['notnull']) && (bool) $column['notnull'] === false ? ' NULL' : ''; - - return 'BIT' . $nullClause; - } - - /** - * {@inheritdoc} - */ - public function getClobTypeDeclarationSQL(array $column) - { - return 'TEXT'; - } - - /** - * {@inheritdoc} - */ - public function getCommentOnColumnSQL($tableName, $columnName, $comment) - { - $tableName = new Identifier($tableName); - $columnName = new Identifier($columnName); - $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment); - - return sprintf( - 'COMMENT ON COLUMN %s.%s IS %s', - $tableName->getQuotedName($this), - $columnName->getQuotedName($this), - $comment - ); - } - - /** - * {@inheritdoc} - */ - public function getConcatExpression() - { - return 'STRING(' . implode(', ', (array) func_get_args()) . ')'; - } - - /** - * {@inheritdoc} - */ - public function getCreateConstraintSQL(Constraint $constraint, $table) - { - if ($constraint instanceof ForeignKeyConstraint) { - return $this->getCreateForeignKeySQL($constraint, $table); - } - - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } - - return 'ALTER TABLE ' . $table . - ' ADD ' . $this->getTableConstraintDeclarationSQL($constraint, $constraint->getQuotedName($this)); - } - - /** - * {@inheritdoc} - */ - public function getCreateDatabaseSQL($database) - { - $database = new Identifier($database); - - return "CREATE DATABASE '" . $database->getName() . "'"; - } - - /** - * {@inheritdoc} - * - * Appends SQL Anywhere specific flags if given. - */ - public function getCreateIndexSQL(Index $index, $table) - { - return parent::getCreateIndexSQL($index, $table) . $this->getAdvancedIndexOptionsSQL($index); - } - - /** - * {@inheritdoc} - */ - public function getCreatePrimaryKeySQL(Index $index, $table) - { - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } - - return 'ALTER TABLE ' . $table . ' ADD ' . $this->getPrimaryKeyDeclarationSQL($index); - } - - /** - * {@inheritdoc} - */ - public function getCreateTemporaryTableSnippetSQL() - { - return 'CREATE ' . $this->getTemporaryTableSQL() . ' TABLE'; - } - - /** - * {@inheritdoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritdoc} - */ - public function getCurrentDateSQL() - { - return 'CURRENT DATE'; - } - - /** - * {@inheritdoc} - */ - public function getCurrentTimeSQL() - { - return 'CURRENT TIME'; - } - - /** - * {@inheritdoc} - */ - public function getCurrentTimestampSQL() - { - return 'CURRENT TIMESTAMP'; - } - - /** - * {@inheritdoc} - */ - protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) - { - $factorClause = ''; - - if ($operator === '-') { - $factorClause = '-1 * '; - } - - return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')'; - } - - /** - * {@inheritdoc} - */ - public function getDateDiffExpression($date1, $date2) - { - return 'DATEDIFF(day, ' . $date2 . ', ' . $date1 . ')'; - } - - /** - * {@inheritdoc} - */ - public function getDateTimeFormatString() - { - return 'Y-m-d H:i:s.u'; - } - - /** - * {@inheritdoc} - */ - public function getDateTimeTypeDeclarationSQL(array $column) - { - return 'DATETIME'; - } - - /** - * {@inheritdoc} - */ - public function getDateTimeTzFormatString() - { - return $this->getDateTimeFormatString(); - } - - /** - * {@inheritdoc} - */ - public function getDateTypeDeclarationSQL(array $column) - { - return 'DATE'; - } - - /** - * {@inheritdoc} - */ - public function getDefaultTransactionIsolationLevel() - { - return TransactionIsolationLevel::READ_UNCOMMITTED; - } - - /** - * {@inheritdoc} - */ - public function getDropDatabaseSQL($database) - { - $database = new Identifier($database); - - return "DROP DATABASE '" . $database->getName() . "'"; - } - - /** - * {@inheritdoc} - */ - public function getDropIndexSQL($index, $table = null) - { - if ($index instanceof Index) { - $index = $index->getQuotedName($this); - } - - if (! is_string($index)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' - ); - } - - if (! isset($table)) { - return 'DROP INDEX ' . $index; - } - - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } - - if (! is_string($table)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Index::class . '.' - ); - } - - return 'DROP INDEX ' . $table . '.' . $index; - } - - /** - * {@inheritdoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** - * {@inheritdoc} - */ - public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey) - { - $sql = ''; - $foreignKeyName = $foreignKey->getName(); - $localColumns = $foreignKey->getQuotedLocalColumns($this); - $foreignColumns = $foreignKey->getQuotedForeignColumns($this); - $foreignTableName = $foreignKey->getQuotedForeignTableName($this); - - if (! empty($foreignKeyName)) { - $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' '; - } - - if (empty($localColumns)) { - throw new InvalidArgumentException("Incomplete definition. 'local' required."); - } - - if (empty($foreignColumns)) { - throw new InvalidArgumentException("Incomplete definition. 'foreign' required."); - } - - if (empty($foreignTableName)) { - throw new InvalidArgumentException("Incomplete definition. 'foreignTable' required."); - } - - if ($foreignKey->hasOption('notnull') && (bool) $foreignKey->getOption('notnull')) { - $sql .= 'NOT NULL '; - } - - return $sql . - 'FOREIGN KEY (' . $this->getIndexFieldDeclarationListSQL($localColumns) . ') ' . - 'REFERENCES ' . $foreignKey->getQuotedForeignTableName($this) . - ' (' . $this->getIndexFieldDeclarationListSQL($foreignColumns) . ')'; - } - - /** - * Returns foreign key MATCH clause for given type. - * - * @param int $type The foreign key match type - * - * @return string - * - * @throws InvalidArgumentException If unknown match type given. - */ - public function getForeignKeyMatchClauseSQL($type) - { - switch ((int) $type) { - case self::FOREIGN_KEY_MATCH_SIMPLE: - return 'SIMPLE'; - - case self::FOREIGN_KEY_MATCH_FULL: - return 'FULL'; - - case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE: - return 'UNIQUE SIMPLE'; - - case self::FOREIGN_KEY_MATCH_FULL_UNIQUE: - return 'UNIQUE FULL'; - - default: - throw new InvalidArgumentException('Invalid foreign key match type: ' . $type); - } - } - - /** - * {@inheritdoc} - */ - public function getForeignKeyReferentialActionSQL($action) - { - // NO ACTION is not supported, therefore falling back to RESTRICT. - if (strtoupper($action) === 'NO ACTION') { - return 'RESTRICT'; - } - - return parent::getForeignKeyReferentialActionSQL($action); - } - - /** - * {@inheritdoc} - */ - public function getForUpdateSQL() - { - return ''; - } - - /** - * {@inheritdoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'NEWID()'; - } - - /** - * {@inheritdoc} - */ - public function getGuidTypeDeclarationSQL(array $column) - { - return 'UNIQUEIDENTIFIER'; - } - - /** - * {@inheritdoc} - */ - public function getIndexDeclarationSQL($name, Index $index) - { - // Index declaration in statements like CREATE TABLE is not supported. - throw Exception::notSupported(__METHOD__); - } - - /** - * {@inheritdoc} - */ - public function getIntegerTypeDeclarationSQL(array $column) - { - $column['integer_type'] = 'INT'; - - return $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritdoc} - */ - public function getListDatabasesSQL() - { - return 'SELECT db_name(number) AS name FROM sa_db_list()'; - } - - /** - * {@inheritdoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - $user = 'USER_NAME()'; - - if (strpos($table, '.') !== false) { - [$user, $table] = explode('.', $table); - $user = $this->quoteStringLiteral($user); - } - - return sprintf( - <<<'SQL' -SELECT col.column_name, - COALESCE(def.user_type_name, def.domain_name) AS 'type', - def.declared_width AS 'length', - def.scale, - CHARINDEX('unsigned', def.domain_name) AS 'unsigned', - IF col.nulls = 'Y' THEN 0 ELSE 1 ENDIF AS 'notnull', - col."default", - def.is_autoincrement AS 'autoincrement', - rem.remarks AS 'comment' -FROM sa_describe_query('SELECT * FROM "%s"') AS def -JOIN SYS.SYSTABCOL AS col -ON col.table_id = def.base_table_id AND col.column_id = def.base_column_id -LEFT JOIN SYS.SYSREMARK AS rem -ON col.object_id = rem.object_id -WHERE def.base_owner_name = %s -ORDER BY def.base_column_id ASC -SQL - , - $table, - $user - ); - } - - /** - * {@inheritdoc} - * - * @todo Where is this used? Which information should be retrieved? - */ - public function getListTableConstraintsSQL($table) - { - $user = ''; - - if (strpos($table, '.') !== false) { - [$user, $table] = explode('.', $table); - $user = $this->quoteStringLiteral($user); - $table = $this->quoteStringLiteral($table); - } else { - $table = $this->quoteStringLiteral($table); - } - - return sprintf( - <<<'SQL' -SELECT con.* -FROM SYS.SYSCONSTRAINT AS con -JOIN SYS.SYSTAB AS tab ON con.table_object_id = tab.object_id -WHERE tab.table_name = %s -AND tab.creator = USER_ID(%s) -SQL - , - $table, - $user - ); - } - - /** - * {@inheritdoc} - */ - public function getListTableForeignKeysSQL($table) - { - $user = ''; - - if (strpos($table, '.') !== false) { - [$user, $table] = explode('.', $table); - $user = $this->quoteStringLiteral($user); - $table = $this->quoteStringLiteral($table); - } else { - $table = $this->quoteStringLiteral($table); - } - - return sprintf( - <<<'SQL' -SELECT fcol.column_name AS local_column, - ptbl.table_name AS foreign_table, - pcol.column_name AS foreign_column, - idx.index_name, - IF fk.nulls = 'N' - THEN 1 - ELSE NULL - ENDIF AS notnull, - CASE ut.referential_action - WHEN 'C' THEN 'CASCADE' - WHEN 'D' THEN 'SET DEFAULT' - WHEN 'N' THEN 'SET NULL' - WHEN 'R' THEN 'RESTRICT' - ELSE NULL - END AS on_update, - CASE dt.referential_action - WHEN 'C' THEN 'CASCADE' - WHEN 'D' THEN 'SET DEFAULT' - WHEN 'N' THEN 'SET NULL' - WHEN 'R' THEN 'RESTRICT' - ELSE NULL - END AS on_delete, - IF fk.check_on_commit = 'Y' - THEN 1 - ELSE NULL - ENDIF AS check_on_commit, -- check_on_commit flag - IF ftbl.clustered_index_id = idx.index_id - THEN 1 - ELSE NULL - ENDIF AS 'clustered', -- clustered flag - IF fk.match_type = 0 - THEN NULL - ELSE fk.match_type - ENDIF AS 'match', -- match option - IF pidx.max_key_distance = 1 - THEN 1 - ELSE NULL - ENDIF AS for_olap_workload -- for_olap_workload flag -FROM SYS.SYSFKEY AS fk -JOIN SYS.SYSIDX AS idx -ON fk.foreign_table_id = idx.table_id -AND fk.foreign_index_id = idx.index_id -JOIN SYS.SYSPHYSIDX pidx -ON idx.table_id = pidx.table_id -AND idx.phys_index_id = pidx.phys_index_id -JOIN SYS.SYSTAB AS ptbl -ON fk.primary_table_id = ptbl.table_id -JOIN SYS.SYSTAB AS ftbl -ON fk.foreign_table_id = ftbl.table_id -JOIN SYS.SYSIDXCOL AS idxcol -ON idx.table_id = idxcol.table_id -AND idx.index_id = idxcol.index_id -JOIN SYS.SYSTABCOL AS pcol -ON ptbl.table_id = pcol.table_id -AND idxcol.primary_column_id = pcol.column_id -JOIN SYS.SYSTABCOL AS fcol -ON ftbl.table_id = fcol.table_id -AND idxcol.column_id = fcol.column_id -LEFT JOIN SYS.SYSTRIGGER ut -ON fk.foreign_table_id = ut.foreign_table_id -AND fk.foreign_index_id = ut.foreign_key_id -AND ut.event = 'C' -LEFT JOIN SYS.SYSTRIGGER dt -ON fk.foreign_table_id = dt.foreign_table_id -AND fk.foreign_index_id = dt.foreign_key_id -AND dt.event = 'D' -WHERE ftbl.table_name = %s -AND ftbl.creator = USER_ID(%s) -ORDER BY fk.foreign_index_id ASC, idxcol.sequence ASC -SQL - , - $table, - $user - ); - } - - /** - * {@inheritdoc} - */ - public function getListTableIndexesSQL($table, $database = null) - { - $user = ''; - - if (strpos($table, '.') !== false) { - [$user, $table] = explode('.', $table); - $user = $this->quoteStringLiteral($user); - $table = $this->quoteStringLiteral($table); - } else { - $table = $this->quoteStringLiteral($table); - } - - return sprintf( - <<<'SQL' -SELECT idx.index_name AS key_name, - IF idx.index_category = 1 - THEN 1 - ELSE 0 - ENDIF AS 'primary', - col.column_name, - IF idx."unique" IN(1, 2, 5) - THEN 0 - ELSE 1 - ENDIF AS non_unique, - IF tbl.clustered_index_id = idx.index_id - THEN 1 - ELSE NULL - ENDIF AS 'clustered', -- clustered flag - IF idx."unique" = 5 - THEN 1 - ELSE NULL - ENDIF AS with_nulls_not_distinct, -- with_nulls_not_distinct flag - IF pidx.max_key_distance = 1 - THEN 1 - ELSE NULL - ENDIF AS for_olap_workload -- for_olap_workload flag -FROM SYS.SYSIDX AS idx -JOIN SYS.SYSPHYSIDX pidx -ON idx.table_id = pidx.table_id -AND idx.phys_index_id = pidx.phys_index_id -JOIN SYS.SYSIDXCOL AS idxcol -ON idx.table_id = idxcol.table_id AND idx.index_id = idxcol.index_id -JOIN SYS.SYSTABCOL AS col -ON idxcol.table_id = col.table_id AND idxcol.column_id = col.column_id -JOIN SYS.SYSTAB AS tbl -ON idx.table_id = tbl.table_id -WHERE tbl.table_name = %s -AND tbl.creator = USER_ID(%s) -AND idx.index_category != 2 -- exclude indexes implicitly created by foreign key constraints -ORDER BY idx.index_id ASC, idxcol.sequence ASC -SQL - , - $table, - $user - ); - } - - /** - * {@inheritdoc} - */ - public function getListTablesSQL() - { - return "SELECT tbl.table_name - FROM SYS.SYSTAB AS tbl - JOIN SYS.SYSUSER AS usr ON tbl.creator = usr.user_id - JOIN dbo.SYSOBJECTS AS obj ON tbl.object_id = obj.id - WHERE tbl.table_type IN(1, 3) -- 'BASE', 'GBL TEMP' - AND usr.user_name NOT IN('SYS', 'dbo', 'rs_systabgroup') -- exclude system users - AND obj.type = 'U' -- user created tables only - ORDER BY tbl.table_name ASC"; - } - - /** - * {@inheritdoc} - * - * @todo Where is this used? Which information should be retrieved? - */ - public function getListUsersSQL() - { - return 'SELECT * FROM SYS.SYSUSER ORDER BY user_name ASC'; - } - - /** - * {@inheritdoc} - */ - public function getListViewsSQL($database) - { - return "SELECT tbl.table_name, v.view_def - FROM SYS.SYSVIEW v - JOIN SYS.SYSTAB tbl ON v.view_object_id = tbl.object_id - JOIN SYS.SYSUSER usr ON tbl.creator = usr.user_id - JOIN dbo.SYSOBJECTS obj ON tbl.object_id = obj.id - WHERE usr.user_name NOT IN('SYS', 'dbo', 'rs_systabgroup') -- exclude system users - ORDER BY tbl.table_name ASC"; - } - - /** - * {@inheritdoc} - */ - public function getLocateExpression($str, $substr, $startPos = false) - { - if ($startPos === false) { - return 'LOCATE(' . $str . ', ' . $substr . ')'; - } - - return 'LOCATE(' . $str . ', ' . $substr . ', ' . $startPos . ')'; - } - - /** - * {@inheritdoc} - */ - public function getMaxIdentifierLength() - { - return 128; - } - - /** - * {@inheritdoc} - */ - public function getMd5Expression($column) - { - return 'HASH(' . $column . ", 'MD5')"; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'sqlanywhere'; - } - - /** - * Obtain DBMS specific SQL code portion needed to set a primary key - * declaration to be used in statements like ALTER TABLE. - * - * @param Index $index Index definition - * @param string $name Name of the primary key - * - * @return string DBMS specific SQL code portion needed to set a primary key - * - * @throws InvalidArgumentException If the given index is not a primary key. - */ - public function getPrimaryKeyDeclarationSQL(Index $index, $name = null) - { - if (! $index->isPrimary()) { - throw new InvalidArgumentException( - 'Can only create primary key declarations with getPrimaryKeyDeclarationSQL()' - ); - } - - return $this->getTableConstraintDeclarationSQL($index, $name); - } - - /** - * {@inheritdoc} - */ - public function getSetTransactionIsolationSQL($level) - { - return 'SET TEMPORARY OPTION isolation_level = ' . $this->_getTransactionIsolationLevelSQL($level); - } - - /** - * {@inheritdoc} - */ - public function getSmallIntTypeDeclarationSQL(array $column) - { - $column['integer_type'] = 'SMALLINT'; - - return $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * Returns the SQL statement for starting an existing database. - * - * In SQL Anywhere you can start and stop databases on a - * database server instance. - * This is a required statement after having created a new database - * as it has to be explicitly started to be usable. - * SQL Anywhere does not automatically start a database after creation! - * - * @param string $database Name of the database to start. - * - * @return string - */ - public function getStartDatabaseSQL($database) - { - $database = new Identifier($database); - - return "START DATABASE '" . $database->getName() . "' AUTOSTOP OFF"; - } - - /** - * Returns the SQL statement for stopping a running database. - * - * In SQL Anywhere you can start and stop databases on a - * database server instance. - * This is a required statement before dropping an existing database - * as it has to be explicitly stopped before it can be dropped. - * - * @param string $database Name of the database to stop. - * - * @return string - */ - public function getStopDatabaseSQL($database) - { - $database = new Identifier($database); - - return 'STOP DATABASE "' . $database->getName() . '" UNCONDITIONALLY'; - } - - /** - * {@inheritdoc} - */ - public function getSubstringExpression($string, $start, $length = null) - { - if ($length === null) { - return 'SUBSTRING(' . $string . ', ' . $start . ')'; - } - - return 'SUBSTRING(' . $string . ', ' . $start . ', ' . $length . ')'; - } - - /** - * {@inheritdoc} - */ - public function getTemporaryTableSQL() - { - return 'GLOBAL TEMPORARY'; - } - - /** - * {@inheritdoc} - */ - public function getTimeFormatString() - { - return 'H:i:s.u'; - } - - /** - * {@inheritdoc} - */ - public function getTimeTypeDeclarationSQL(array $column) - { - return 'TIME'; - } - - /** - * {@inheritdoc} - */ - public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) - { - if (! $char) { - switch ($mode) { - case TrimMode::LEADING: - return $this->getLtrimExpression($str); - - case TrimMode::TRAILING: - return $this->getRtrimExpression($str); - - default: - return 'TRIM(' . $str . ')'; - } - } - - $pattern = "'%[^' + " . $char . " + ']%'"; - - switch ($mode) { - case TrimMode::LEADING: - return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))'; - - case TrimMode::TRAILING: - return 'REVERSE(SUBSTR(REVERSE(' . $str . '), PATINDEX(' . $pattern . ', REVERSE(' . $str . '))))'; - - default: - return 'REVERSE(SUBSTR(REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))), ' . - 'PATINDEX(' . $pattern . ', ' . - 'REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))))))'; - } - } - - /** - * {@inheritdoc} - */ - public function getTruncateTableSQL($tableName, $cascade = false) - { - $tableIdentifier = new Identifier($tableName); - - return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this); - } - - /** - * {@inheritdoc} - */ - public function getUniqueConstraintDeclarationSQL($name, Index $index) - { - if ($index->isPrimary()) { - throw new InvalidArgumentException( - 'Cannot create primary key constraint declarations with getUniqueConstraintDeclarationSQL().' - ); - } - - if (! $index->isUnique()) { - throw new InvalidArgumentException( - 'Can only create unique constraint declarations, no common index declarations with ' . - 'getUniqueConstraintDeclarationSQL().' - ); - } - - return $this->getTableConstraintDeclarationSQL($index, $name); - } - - /** - * {@inheritdoc} - */ - public function getVarcharDefaultLength() - { - return 1; - } - - /** - * {@inheritdoc} - */ - public function getVarcharMaxLength() - { - return 32767; - } - - /** - * {@inheritdoc} - */ - public function hasNativeGuidType() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function prefersIdentityColumns() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function supportsCommentOnStatement() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function supportsIdentityColumns() - { - return true; - } - - /** - * {@inheritdoc} - */ - protected function _getCommonIntegerTypeDeclarationSQL(array $column) - { - $unsigned = ! empty($column['unsigned']) ? 'UNSIGNED ' : ''; - $autoincrement = ! empty($column['autoincrement']) ? ' IDENTITY' : ''; - - return $unsigned . $column['integer_type'] . $autoincrement; - } - - /** - * {@inheritdoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = []) - { - $columnListSql = $this->getColumnDeclarationListSQL($columns); - $indexSql = []; - - if (! empty($options['uniqueConstraints'])) { - foreach ((array) $options['uniqueConstraints'] as $name => $definition) { - $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); - } - } - - if (! empty($options['indexes'])) { - foreach ((array) $options['indexes'] as $index) { - assert($index instanceof Index); - $indexSql[] = $this->getCreateIndexSQL($index, $name); - } - } - - if (! empty($options['primary'])) { - $flags = ''; - - if (isset($options['primary_index']) && $options['primary_index']->hasFlag('clustered')) { - $flags = ' CLUSTERED '; - } - - $columnListSql .= ', PRIMARY KEY' . $flags - . ' (' . implode(', ', array_unique(array_values((array) $options['primary']))) . ')'; - } - - if (! empty($options['foreignKeys'])) { - foreach ((array) $options['foreignKeys'] as $definition) { - $columnListSql .= ', ' . $this->getForeignKeyDeclarationSQL($definition); - } - } - - $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; - $check = $this->getCheckDeclarationSQL($columns); - - if (! empty($check)) { - $query .= ', ' . $check; - } - - $query .= ')'; - - return array_merge([$query], $indexSql); - } - - /** - * {@inheritdoc} - */ - protected function _getTransactionIsolationLevelSQL($level) - { - switch ($level) { - case TransactionIsolationLevel::READ_UNCOMMITTED: - return '0'; - - case TransactionIsolationLevel::READ_COMMITTED: - return '1'; - - case TransactionIsolationLevel::REPEATABLE_READ: - return '2'; - - case TransactionIsolationLevel::SERIALIZABLE: - return '3'; - - default: - throw new InvalidArgumentException('Invalid isolation level:' . $level); - } - } - - /** - * {@inheritdoc} - */ - protected function doModifyLimitQuery($query, $limit, $offset) - { - $limitOffsetClause = $this->getTopClauseSQL($limit, $offset); - - if ($limitOffsetClause === '') { - return $query; - } - - if (! preg_match('/^\s*(SELECT\s+(DISTINCT\s+)?)(.*)/i', $query, $matches)) { - return $query; - } - - return $matches[1] . $limitOffsetClause . ' ' . $matches[3]; - } - - private function getTopClauseSQL(?int $limit, ?int $offset): string - { - if ($offset > 0) { - return sprintf('TOP %s START AT %d', $limit ?? 'ALL', $offset + 1); - } - - return $limit === null ? '' : 'TOP ' . $limit; - } - - /** - * Return the INDEX query section dealing with non-standard - * SQL Anywhere options. - * - * @param Index $index Index definition - * - * @return string - */ - protected function getAdvancedIndexOptionsSQL(Index $index) - { - $sql = ''; - - if (! $index->isPrimary() && $index->hasFlag('for_olap_workload')) { - $sql .= ' FOR OLAP WORKLOAD'; - } - - return $sql; - } - - /** - * {@inheritdoc} - */ - protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed - ? 'BINARY(' . ($length ?: $this->getBinaryDefaultLength()) . ')' - : 'VARBINARY(' . ($length ?: $this->getBinaryDefaultLength()) . ')'; - } - - /** - * Returns the SQL snippet for creating a table constraint. - * - * @param Constraint $constraint The table constraint to create the SQL snippet for. - * @param string|null $name The table constraint name to use if any. - * - * @return string - * - * @throws InvalidArgumentException If the given table constraint type is not supported by this method. - */ - protected function getTableConstraintDeclarationSQL(Constraint $constraint, $name = null) - { - if ($constraint instanceof ForeignKeyConstraint) { - return $this->getForeignKeyDeclarationSQL($constraint); - } - - if (! $constraint instanceof Index) { - throw new InvalidArgumentException('Unsupported constraint type: ' . get_class($constraint)); - } - - if (! $constraint->isPrimary() && ! $constraint->isUnique()) { - throw new InvalidArgumentException( - 'Can only create primary, unique or foreign key constraint declarations, no common index declarations' - . ' with getTableConstraintDeclarationSQL().' - ); - } - - $constraintColumns = $constraint->getQuotedColumns($this); - - if (empty($constraintColumns)) { - throw new InvalidArgumentException("Incomplete definition. 'columns' required."); - } - - $sql = ''; - $flags = ''; - - if (! empty($name)) { - $name = new Identifier($name); - $sql .= 'CONSTRAINT ' . $name->getQuotedName($this) . ' '; - } - - if ($constraint->hasFlag('clustered')) { - $flags = 'CLUSTERED '; - } - - if ($constraint->isPrimary()) { - return $sql . 'PRIMARY KEY ' . $flags - . '(' . $this->getIndexFieldDeclarationListSQL($constraintColumns) . ')'; - } - - return $sql . 'UNIQUE ' . $flags . '(' . $this->getIndexFieldDeclarationListSQL($constraintColumns) . ')'; - } - - /** - * {@inheritdoc} - */ - protected function getCreateIndexSQLFlags(Index $index) - { - $type = ''; - if ($index->hasFlag('virtual')) { - $type .= 'VIRTUAL '; - } - - if ($index->isUnique()) { - $type .= 'UNIQUE '; - } - - if ($index->hasFlag('clustered')) { - $type .= 'CLUSTERED '; - } - - return $type; - } - - /** - * {@inheritdoc} - */ - protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) - { - return ['ALTER INDEX ' . $oldIndexName . ' ON ' . $tableName . ' RENAME TO ' . $index->getQuotedName($this)]; - } - - /** - * {@inheritdoc} - */ - protected function getReservedKeywordsClass() - { - return Keywords\SQLAnywhereKeywords::class; - } - - /** - * {@inheritdoc} - */ - protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed - ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(' . $this->getVarcharDefaultLength() . ')') - : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(' . $this->getVarcharDefaultLength() . ')'); - } - - /** - * {@inheritdoc} - */ - protected function initializeDoctrineTypeMappings() - { - $this->doctrineTypeMapping = [ - 'char' => 'string', - 'long nvarchar' => 'text', - 'long varchar' => 'text', - 'nchar' => 'string', - 'ntext' => 'text', - 'nvarchar' => 'string', - 'text' => 'text', - 'uniqueidentifierstr' => 'guid', - 'varchar' => 'string', - 'xml' => 'text', - 'bigint' => 'bigint', - 'unsigned bigint' => 'bigint', - 'bit' => 'boolean', - 'decimal' => 'decimal', - 'double' => 'float', - 'float' => 'float', - 'int' => 'integer', - 'integer' => 'integer', - 'unsigned int' => 'integer', - 'numeric' => 'decimal', - 'smallint' => 'smallint', - 'unsigned smallint' => 'smallint', - 'tinyint' => 'smallint', - 'unsigned tinyint' => 'smallint', - 'money' => 'decimal', - 'smallmoney' => 'decimal', - 'long varbit' => 'text', - 'varbit' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'smalldatetime' => 'datetime', - 'time' => 'time', - 'timestamp' => 'datetime', - 'binary' => 'binary', - 'image' => 'blob', - 'long binary' => 'blob', - 'uniqueidentifier' => 'guid', - 'varbinary' => 'binary', - ]; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php deleted file mode 100644 index f281f4fc4..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php +++ /dev/null @@ -1,35 +0,0 @@ -hasOption('azure.federatedOnColumnName')) { - $distributionName = $table->getOption('azure.federatedOnDistributionName'); - $columnName = $table->getOption('azure.federatedOnColumnName'); - $stmt = ' FEDERATED ON (' . $distributionName . ' = ' . $columnName . ')'; - - $sql[0] .= $stmt; - } - - return $sql; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php deleted file mode 100644 index 6f02bb8ff..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php +++ /dev/null @@ -1,48 +0,0 @@ -doctrineTypeMapping['datetime2'] = 'datetime'; - $this->doctrineTypeMapping['date'] = 'date'; - $this->doctrineTypeMapping['time'] = 'time'; - $this->doctrineTypeMapping['datetimeoffset'] = 'datetimetz'; - } - - /** - * {@inheritdoc} - * - * Returns Microsoft SQL Server 2008 specific keywords class - */ - protected function getReservedKeywordsClass() - { - return Keywords\SQLServer2008Keywords::class; - } - - protected function getLikeWildcardCharacters(): string - { - return parent::getLikeWildcardCharacters() . '[]^'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php deleted file mode 100644 index 337d0f1ec..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php +++ /dev/null @@ -1,146 +0,0 @@ -getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize(); - } - - /** - * {@inheritdoc} - */ - public function getCreateSequenceSQL(Sequence $sequence) - { - return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . - ' START WITH ' . $sequence->getInitialValue() . - ' INCREMENT BY ' . $sequence->getAllocationSize() . - ' MINVALUE ' . $sequence->getInitialValue(); - } - - /** - * {@inheritdoc} - */ - public function getDropSequenceSQL($sequence) - { - if ($sequence instanceof Sequence) { - $sequence = $sequence->getQuotedName($this); - } - - return 'DROP SEQUENCE ' . $sequence; - } - - /** - * {@inheritdoc} - */ - public function getListSequencesSQL($database) - { - return 'SELECT seq.name, - CAST( - seq.increment AS VARCHAR(MAX) - ) AS increment, -- CAST avoids driver error for sql_variant type - CAST( - seq.start_value AS VARCHAR(MAX) - ) AS start_value -- CAST avoids driver error for sql_variant type - FROM sys.sequences AS seq'; - } - - /** - * {@inheritdoc} - */ - public function getSequenceNextValSQL($sequence) - { - return 'SELECT NEXT VALUE FOR ' . $sequence; - } - - /** - * {@inheritdoc} - */ - public function supportsSequences() - { - return true; - } - - /** - * {@inheritdoc} - * - * Returns Microsoft SQL Server 2012 specific keywords class - */ - protected function getReservedKeywordsClass() - { - return Keywords\SQLServer2012Keywords::class; - } - - /** - * {@inheritdoc} - */ - protected function doModifyLimitQuery($query, $limit, $offset = null) - { - if ($limit === null && $offset <= 0) { - return $query; - } - - // Queries using OFFSET... FETCH MUST have an ORDER BY clause - // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement - // but can be in a newline - $matches = []; - $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE); - $orderByPos = false; - if ($matchesCount > 0) { - $orderByPos = $matches[0][$matchesCount - 1][1]; - } - - if ( - $orderByPos === false - || substr_count($query, '(', $orderByPos) - substr_count($query, ')', $orderByPos) - ) { - if (preg_match('/^SELECT\s+DISTINCT/im', $query)) { - // SQL Server won't let us order by a non-selected column in a DISTINCT query, - // so we have to do this madness. This says, order by the first column in the - // result. SQL Server's docs say that a nonordered query's result order is non- - // deterministic anyway, so this won't do anything that a bunch of update and - // deletes to the table wouldn't do anyway. - $query .= ' ORDER BY 1'; - } else { - // In another DBMS, we could do ORDER BY 0, but SQL Server gets angry if you - // use constant expressions in the order by list. - $query .= ' ORDER BY (SELECT 0)'; - } - } - - if ($offset === null) { - $offset = 0; - } - - // This looks somewhat like MYSQL, but limit/offset are in inverse positions - // Supposedly SQL:2008 core standard. - // Per TSQL spec, FETCH NEXT n ROWS ONLY is not valid without OFFSET n ROWS. - $query .= ' OFFSET ' . (int) $offset . ' ROWS'; - - if ($limit !== null) { - $query .= ' FETCH NEXT ' . (int) $limit . ' ROWS ONLY'; - } - - return $query; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php b/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php deleted file mode 100644 index ba4729262..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php +++ /dev/null @@ -1,128 +0,0 @@ -getParams(); - if (isset($params['portability'])) { - $this->portability = $params['portability'] = (new OptimizeFlags())( - $this->getDatabasePlatform(), - $params['portability'] - ); - } - - if (isset($params['fetch_case']) && $this->portability & self::PORTABILITY_FIX_CASE) { - if ($this->_conn instanceof PDOConnection) { - // make use of c-level support for case handling - $this->_conn->setAttribute(PDO::ATTR_CASE, $params['fetch_case']); - } else { - $this->case = $params['fetch_case'] === ColumnCase::LOWER ? CASE_LOWER : CASE_UPPER; - } - } - } - - return $ret; - } - - /** - * @return int - */ - public function getPortability() - { - return $this->portability; - } - - /** - * @return int - */ - public function getFetchCase() - { - return $this->case; - } - - /** - * {@inheritdoc} - */ - public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null) - { - $stmt = new Statement(parent::executeQuery($sql, $params, $types, $qcp), $this); - $stmt->setFetchMode($this->defaultFetchMode); - - return $stmt; - } - - /** - * {@inheritdoc} - * - * @return Statement - */ - public function prepare($sql) - { - $stmt = new Statement(parent::prepare($sql), $this); - $stmt->setFetchMode($this->defaultFetchMode); - - return $stmt; - } - - /** - * {@inheritdoc} - */ - public function query() - { - $connection = $this->getWrappedConnection(); - - $stmt = $connection->query(...func_get_args()); - $stmt = new Statement($stmt, $this); - $stmt->setFetchMode($this->defaultFetchMode); - - return $stmt; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php b/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php deleted file mode 100644 index 9a476c338..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php +++ /dev/null @@ -1,400 +0,0 @@ -Statement and applies portability measures. - * - * @param DriverStatement|ResultStatement $stmt - */ - public function __construct($stmt, Connection $conn) - { - $this->stmt = $stmt; - $this->portability = $conn->getPortability(); - $this->case = $conn->getFetchCase(); - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->bindParam($param, $variable, $type, $length); - } - - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->bindValue($param, $value, $type); - } - - /** - * {@inheritdoc} - * - * @deprecated Use free() instead. - */ - public function closeCursor() - { - return $this->stmt->closeCursor(); - } - - /** - * {@inheritdoc} - */ - public function columnCount() - { - return $this->stmt->columnCount(); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->errorCode(); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->errorInfo(); - } - - /** - * {@inheritdoc} - */ - public function execute($params = null) - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->execute($params); - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - $this->defaultFetchMode = $fetchMode; - - return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3); - } - - /** - * {@inheritdoc} - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - */ - public function getIterator() - { - return new StatementIterator($this); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - $row = $this->stmt->fetch($fetchMode); - - $iterateRow = ( - $this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL | Connection::PORTABILITY_RTRIM) - ) !== 0; - - $fixCase = $this->case !== null - && ($fetchMode === FetchMode::ASSOCIATIVE || $fetchMode === FetchMode::MIXED) - && ($this->portability & Connection::PORTABILITY_FIX_CASE); - - $row = $this->fixRow($row, $iterateRow, $fixCase); - - return $row; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - $fetchMode = $fetchMode ?: $this->defaultFetchMode; - - if ($fetchArgument) { - $rows = $this->stmt->fetchAll($fetchMode, $fetchArgument); - } else { - $rows = $this->stmt->fetchAll($fetchMode); - } - - $fixCase = $this->case !== null - && ($fetchMode === FetchMode::ASSOCIATIVE || $fetchMode === FetchMode::MIXED) - && ($this->portability & Connection::PORTABILITY_FIX_CASE); - - return $this->fixResultSet($rows, $fixCase, $fetchMode !== FetchMode::COLUMN); - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - if ($this->stmt instanceof Result) { - $row = $this->stmt->fetchNumeric(); - } else { - $row = $this->stmt->fetch(FetchMode::NUMERIC); - } - - return $this->fixResult($row, false); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - if ($this->stmt instanceof Result) { - $row = $this->stmt->fetchAssociative(); - } else { - $row = $this->stmt->fetch(FetchMode::ASSOCIATIVE); - } - - return $this->fixResult($row, true); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - if ($this->stmt instanceof Result) { - $value = $this->stmt->fetchOne(); - } else { - $value = $this->stmt->fetch(FetchMode::COLUMN); - } - - if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) !== 0 && $value === '') { - $value = null; - } elseif (($this->portability & Connection::PORTABILITY_RTRIM) !== 0 && is_string($value)) { - $value = rtrim($value); - } - - return $value; - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - if ($this->stmt instanceof Result) { - $data = $this->stmt->fetchAllNumeric(); - } else { - $data = $this->stmt->fetchAll(FetchMode::NUMERIC); - } - - return $this->fixResultSet($data, false, true); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - if ($this->stmt instanceof Result) { - $data = $this->stmt->fetchAllAssociative(); - } else { - $data = $this->stmt->fetchAll(FetchMode::ASSOCIATIVE); - } - - return $this->fixResultSet($data, true, true); - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - if ($this->stmt instanceof Result) { - $data = $this->stmt->fetchFirstColumn(); - } else { - $data = $this->stmt->fetchAll(FetchMode::COLUMN); - } - - return $this->fixResultSet($data, true, false); - } - - public function free(): void - { - if ($this->stmt instanceof Result) { - $this->stmt->free(); - - return; - } - - $this->stmt->closeCursor(); - } - - /** - * @param mixed $result - * - * @return mixed - */ - private function fixResult($result, bool $fixCase) - { - $iterateRow = ( - $this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL | Connection::PORTABILITY_RTRIM) - ) !== 0; - - $fixCase = $fixCase && $this->case !== null && ($this->portability & Connection::PORTABILITY_FIX_CASE) !== 0; - - return $this->fixRow($result, $iterateRow, $fixCase); - } - - /** - * @param array $resultSet - * - * @return array - */ - private function fixResultSet(array $resultSet, bool $fixCase, bool $isArray): array - { - $iterateRow = ( - $this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL | Connection::PORTABILITY_RTRIM) - ) !== 0; - - $fixCase = $fixCase && $this->case !== null && ($this->portability & Connection::PORTABILITY_FIX_CASE) !== 0; - - if (! $iterateRow && ! $fixCase) { - return $resultSet; - } - - if (! $isArray) { - foreach ($resultSet as $num => $value) { - $resultSet[$num] = [$value]; - } - } - - foreach ($resultSet as $num => $row) { - $resultSet[$num] = $this->fixRow($row, $iterateRow, $fixCase); - } - - if (! $isArray) { - foreach ($resultSet as $num => $row) { - $resultSet[$num] = $row[0]; - } - } - - return $resultSet; - } - - /** - * @param mixed $row - * @param bool $iterateRow - * @param bool $fixCase - * - * @return mixed - */ - protected function fixRow($row, $iterateRow, $fixCase) - { - if (! $row) { - return $row; - } - - if ($fixCase) { - $row = array_change_key_case($row, $this->case); - } - - if ($iterateRow) { - foreach ($row as $k => $v) { - if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $v === '') { - $row[$k] = null; - } elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) { - $row[$k] = rtrim($v); - } - } - } - - return $row; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - $value = $this->stmt->fetchColumn($columnIndex); - - if ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL | Connection::PORTABILITY_RTRIM)) { - if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $value === '') { - $value = null; - } elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($value)) { - $value = rtrim($value); - } - } - - return $value; - } - - /** - * {@inheritdoc} - */ - public function rowCount() - { - assert($this->stmt instanceof DriverStatement); - - return $this->stmt->rowCount(); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php b/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php deleted file mode 100644 index 5b558f013..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php +++ /dev/null @@ -1,309 +0,0 @@ - - */ - private static function getPositionalPlaceholderPositions(string $statement): array - { - return self::collectPlaceholders( - $statement, - '?', - self::POSITIONAL_TOKEN, - static function (string $_, int $placeholderPosition, int $fragmentPosition, array &$carry): void { - $carry[] = $placeholderPosition + $fragmentPosition; - } - ); - } - - /** - * Returns a map of placeholder positions to their parameter names. - * - * @return array - */ - private static function getNamedPlaceholderPositions(string $statement): array - { - return self::collectPlaceholders( - $statement, - ':', - self::NAMED_TOKEN, - static function ( - string $placeholder, - int $placeholderPosition, - int $fragmentPosition, - array &$carry - ): void { - $carry[$placeholderPosition + $fragmentPosition] = substr($placeholder, 1); - } - ); - } - - /** - * @return mixed[] - */ - private static function collectPlaceholders( - string $statement, - string $match, - string $token, - callable $collector - ): array { - if (strpos($statement, $match) === false) { - return []; - } - - $carry = []; - - foreach (self::getUnquotedStatementFragments($statement) as $fragment) { - preg_match_all('/' . $token . '/', $fragment[0], $matches, PREG_OFFSET_CAPTURE); - foreach ($matches[0] as $placeholder) { - $collector($placeholder[0], $placeholder[1], $fragment[1], $carry); - } - } - - return $carry; - } - - /** - * For a positional query this method can rewrite the sql statement with regard to array parameters. - * - * @param string $query SQL query - * @param mixed[] $params Query parameters - * @param array|array $types Parameter types - * - * @return mixed[] - * - * @throws SQLParserUtilsException - */ - public static function expandListParameters($query, $params, $types) - { - $isPositional = is_int(key($params)); - $arrayPositions = []; - $bindIndex = -1; - - if ($isPositional) { - // make sure that $types has the same keys as $params - // to allow omitting parameters with unspecified types - $types += array_fill_keys(array_keys($params), null); - - ksort($params); - ksort($types); - } - - foreach ($types as $name => $type) { - ++$bindIndex; - - if ($type !== Connection::PARAM_INT_ARRAY && $type !== Connection::PARAM_STR_ARRAY) { - continue; - } - - if ($isPositional) { - $name = $bindIndex; - } - - $arrayPositions[$name] = false; - } - - if (( ! $arrayPositions && $isPositional)) { - return [$query, $params, $types]; - } - - if ($isPositional) { - $paramOffset = 0; - $queryOffset = 0; - $params = array_values($params); - $types = array_values($types); - - $paramPos = self::getPositionalPlaceholderPositions($query); - - foreach ($paramPos as $needle => $needlePos) { - if (! isset($arrayPositions[$needle])) { - continue; - } - - $needle += $paramOffset; - $needlePos += $queryOffset; - $count = count($params[$needle]); - - $params = array_merge( - array_slice($params, 0, $needle), - $params[$needle], - array_slice($params, $needle + 1) - ); - - $types = array_merge( - array_slice($types, 0, $needle), - $count ? - // array needles are at {@link \Doctrine\DBAL\ParameterType} constants - // + {@link \Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET} - array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) : - [], - array_slice($types, $needle + 1) - ); - - $expandStr = $count ? implode(', ', array_fill(0, $count, '?')) : 'NULL'; - $query = substr($query, 0, $needlePos) . $expandStr . substr($query, $needlePos + 1); - - $paramOffset += $count - 1; // Grows larger by number of parameters minus the replaced needle. - $queryOffset += strlen($expandStr) - 1; - } - - return [$query, $params, $types]; - } - - $queryOffset = 0; - $typesOrd = []; - $paramsOrd = []; - - $paramPos = self::getNamedPlaceholderPositions($query); - - foreach ($paramPos as $pos => $paramName) { - $paramLen = strlen($paramName) + 1; - $value = static::extractParam($paramName, $params, true); - - if (! isset($arrayPositions[$paramName]) && ! isset($arrayPositions[':' . $paramName])) { - $pos += $queryOffset; - $queryOffset -= $paramLen - 1; - $paramsOrd[] = $value; - $typesOrd[] = static::extractParam($paramName, $types, false, ParameterType::STRING); - $query = substr($query, 0, $pos) . '?' . substr($query, $pos + $paramLen); - - continue; - } - - $count = count($value); - $expandStr = $count > 0 ? implode(', ', array_fill(0, $count, '?')) : 'NULL'; - - foreach ($value as $val) { - $paramsOrd[] = $val; - $typesOrd[] = static::extractParam($paramName, $types, false) - Connection::ARRAY_PARAM_OFFSET; - } - - $pos += $queryOffset; - $queryOffset += strlen($expandStr) - $paramLen; - $query = substr($query, 0, $pos) . $expandStr . substr($query, $pos + $paramLen); - } - - return [$query, $paramsOrd, $typesOrd]; - } - - /** - * Slice the SQL statement around pairs of quotes and - * return string fragments of SQL outside of quoted literals. - * Each fragment is captured as a 2-element array: - * - * 0 => matched fragment string, - * 1 => offset of fragment in $statement - * - * @param string $statement - * - * @return mixed[][] - */ - private static function getUnquotedStatementFragments($statement) - { - $literal = self::ESCAPED_SINGLE_QUOTED_TEXT . '|' . - self::ESCAPED_DOUBLE_QUOTED_TEXT . '|' . - self::ESCAPED_BACKTICK_QUOTED_TEXT . '|' . - self::ESCAPED_BRACKET_QUOTED_TEXT; - $expression = sprintf('/((.+(?i:ARRAY)\\[.+\\])|([^\'"`\\[]+))(?:%s)?/s', $literal); - - preg_match_all($expression, $statement, $fragments, PREG_OFFSET_CAPTURE); - - return $fragments[1]; - } - - /** - * @param string $paramName The name of the parameter (without a colon in front) - * @param mixed $paramsOrTypes A hash of parameters or types - * @param bool $isParam - * @param mixed $defaultValue An optional default value. If omitted, an exception is thrown - * - * @return mixed - * - * @throws SQLParserUtilsException - */ - private static function extractParam($paramName, $paramsOrTypes, $isParam, $defaultValue = null) - { - if (array_key_exists($paramName, $paramsOrTypes)) { - return $paramsOrTypes[$paramName]; - } - - // Hash keys can be prefixed with a colon for compatibility - if (array_key_exists(':' . $paramName, $paramsOrTypes)) { - return $paramsOrTypes[':' . $paramName]; - } - - if ($defaultValue !== null) { - return $defaultValue; - } - - if ($isParam) { - throw SQLParserUtilsException::missingParam($paramName); - } - - throw SQLParserUtilsException::missingType($paramName); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php b/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php deleted file mode 100644 index 297b0761b..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php +++ /dev/null @@ -1,37 +0,0 @@ -_platform->getDoctrineTypeMapping($dbType); - $type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); - $tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); - - $options = [ - 'notnull' => ! (bool) $tableColumn['IS_NULLABLE'], - 'length' => (int) $tableColumn['CHARACTER_MAXIMUM_LENGTH'], - 'default' => $tableColumn['COLUMN_DEFAULT'] ?? null, - 'autoincrement' => (bool) $tableColumn['IS_AUTO_INCREMENT'], - 'scale' => (int) $tableColumn['NUMERIC_SCALE'], - 'precision' => (int) $tableColumn['NUMERIC_PRECISION'], - 'comment' => isset($tableColumn['COLUMN_COMMENT']) && $tableColumn['COLUMN_COMMENT'] !== '' - ? $tableColumn['COLUMN_COMMENT'] - : null, - ]; - - $column = new Column($tableColumn['COLUMN_NAME'], Type::getType($type), $options); - - if (! empty($tableColumn['COLLATION_NAME'])) { - $column->setPlatformOption('collation', $tableColumn['COLLATION_NAME']); - } - - return $column; - } - - /** - * {@inheritdoc} - */ - protected function _getPortableDatabaseDefinition($database) - { - return $database['SCHEMA_NAME']; - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableDefinition($table) - { - return $table['TABLE_NAME']; - } - - /** - * {@inheritdoc} - */ - public function _getPortableTableForeignKeyDefinition($tableForeignKey) - { - $columns = []; - foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) { - $columns[] = trim($value, ' `'); - } - - $refColumns = []; - foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) { - $refColumns[] = trim($value, ' `'); - } - - return new ForeignKeyConstraint( - $columns, - $tableForeignKey['REFERENCED_TABLE_NAME'], - $refColumns, - $tableForeignKey['CONSTRAINT_NAME'], - [ - 'onUpdate' => $tableForeignKey['UPDATE_RULE'], - 'onDelete' => $tableForeignKey['DELETE_RULE'], - ] - ); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) - { - $indexes = []; - foreach ($tableIndexes as $k) { - $k['primary'] = (bool) $k['primary']; - $indexes[] = $k; - } - - return parent::_getPortableTableIndexesList($indexes, $tableName); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php deleted file mode 100644 index c909c7e58..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ /dev/null @@ -1,238 +0,0 @@ -startDatabase($database); - } - - /** - * {@inheritdoc} - * - * Tries stopping a database before dropping - * as SQL Anywhere needs a database to be stopped - * before it can be dropped. - * - * @see stopDatabase - */ - public function dropDatabase($database) - { - $this->tryMethod('stopDatabase', $database); - parent::dropDatabase($database); - } - - /** - * Starts a database. - * - * @param string $database The name of the database to start. - * - * @return void - */ - public function startDatabase($database) - { - assert($this->_platform instanceof SQLAnywherePlatform); - $this->_execSql($this->_platform->getStartDatabaseSQL($database)); - } - - /** - * Stops a database. - * - * @param string $database The name of the database to stop. - * - * @return void - */ - public function stopDatabase($database) - { - assert($this->_platform instanceof SQLAnywherePlatform); - $this->_execSql($this->_platform->getStopDatabaseSQL($database)); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableDatabaseDefinition($database) - { - return $database['name']; - } - - /** - * {@inheritdoc} - */ - protected function _getPortableSequenceDefinition($sequence) - { - return new Sequence($sequence['sequence_name'], $sequence['increment_by'], $sequence['start_with']); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableColumnDefinition($tableColumn) - { - $type = $this->_platform->getDoctrineTypeMapping($tableColumn['type']); - $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); - $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); - $precision = null; - $scale = null; - $fixed = false; - $default = null; - - if ($tableColumn['default'] !== null) { - // Strip quotes from default value. - $default = preg_replace(["/^'(.*)'$/", "/''/"], ['$1', "'"], $tableColumn['default']); - - if ($default === 'autoincrement') { - $default = null; - } - } - - switch ($tableColumn['type']) { - case 'binary': - case 'char': - case 'nchar': - $fixed = true; - break; - } - - switch ($type) { - case 'decimal': - case 'float': - $precision = $tableColumn['length']; - $scale = $tableColumn['scale']; - break; - } - - return new Column( - $tableColumn['column_name'], - Type::getType($type), - [ - 'length' => $type === 'string' ? $tableColumn['length'] : null, - 'precision' => $precision, - 'scale' => $scale, - 'unsigned' => (bool) $tableColumn['unsigned'], - 'fixed' => $fixed, - 'notnull' => (bool) $tableColumn['notnull'], - 'default' => $default, - 'autoincrement' => (bool) $tableColumn['autoincrement'], - 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== '' - ? $tableColumn['comment'] - : null, - ] - ); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableDefinition($table) - { - return $table['table_name']; - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) - { - return new ForeignKeyConstraint( - $tableForeignKey['local_columns'], - $tableForeignKey['foreign_table'], - $tableForeignKey['foreign_columns'], - $tableForeignKey['name'], - $tableForeignKey['options'] - ); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) - { - $foreignKeys = []; - - foreach ($tableForeignKeys as $tableForeignKey) { - if (! isset($foreignKeys[$tableForeignKey['index_name']])) { - $foreignKeys[$tableForeignKey['index_name']] = [ - 'local_columns' => [$tableForeignKey['local_column']], - 'foreign_table' => $tableForeignKey['foreign_table'], - 'foreign_columns' => [$tableForeignKey['foreign_column']], - 'name' => $tableForeignKey['index_name'], - 'options' => [ - 'notnull' => $tableForeignKey['notnull'], - 'match' => $tableForeignKey['match'], - 'onUpdate' => $tableForeignKey['on_update'], - 'onDelete' => $tableForeignKey['on_delete'], - 'check_on_commit' => $tableForeignKey['check_on_commit'], - 'clustered' => $tableForeignKey['clustered'], - 'for_olap_workload' => $tableForeignKey['for_olap_workload'], - ], - ]; - } else { - $foreignKeys[$tableForeignKey['index_name']]['local_columns'][] = $tableForeignKey['local_column']; - $foreignKeys[$tableForeignKey['index_name']]['foreign_columns'][] = $tableForeignKey['foreign_column']; - } - } - - return parent::_getPortableTableForeignKeysList($foreignKeys); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) - { - foreach ($tableIndexes as &$tableIndex) { - $tableIndex['primary'] = (bool) $tableIndex['primary']; - $tableIndex['flags'] = []; - - if ($tableIndex['clustered']) { - $tableIndex['flags'][] = 'clustered'; - } - - if ($tableIndex['with_nulls_not_distinct']) { - $tableIndex['flags'][] = 'with_nulls_not_distinct'; - } - - if (! $tableIndex['for_olap_workload']) { - continue; - } - - $tableIndex['flags'][] = 'for_olap_workload'; - } - - return parent::_getPortableTableIndexesList($tableIndexes, $tableName); - } - - /** - * {@inheritdoc} - */ - protected function _getPortableViewDefinition($view) - { - $definition = preg_replace('/^.*\s+as\s+SELECT(.*)/i', 'SELECT$1', $view['view_def']); - assert(is_string($definition)); - - return new View($view['table_name'], $definition); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php b/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php deleted file mode 100644 index 7cfd1f2c0..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php +++ /dev/null @@ -1,49 +0,0 @@ -conn = $conn; - } - - /** - * @param string[] $sql - * - * @return void - */ - protected function processSqlSafely(array $sql) - { - foreach ($sql as $s) { - try { - $this->conn->exec($s); - } catch (Throwable $e) { - } - } - } - - /** - * @param string[] $sql - * - * @return void - */ - protected function processSql(array $sql) - { - foreach ($sql as $s) { - $this->conn->exec($s); - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php b/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php deleted file mode 100644 index a10d3b7f3..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Synchronizer/SchemaSynchronizer.php +++ /dev/null @@ -1,74 +0,0 @@ -platform = $conn->getDatabasePlatform(); - } - - /** - * {@inheritdoc} - */ - public function getCreateSchema(Schema $createSchema) - { - return $createSchema->toSql($this->platform); - } - - /** - * {@inheritdoc} - */ - public function getUpdateSchema(Schema $toSchema, $noDrops = false) - { - $comparator = new Comparator(); - $sm = $this->conn->getSchemaManager(); - - $fromSchema = $sm->createSchema(); - $schemaDiff = $comparator->compare($fromSchema, $toSchema); - - if ($noDrops) { - return $schemaDiff->toSaveSql($this->platform); - } - - return $schemaDiff->toSql($this->platform); - } - - /** - * {@inheritdoc} - */ - public function getDropSchema(Schema $dropSchema) - { - $visitor = new DropSchemaSqlCollector($this->platform); - $sm = $this->conn->getSchemaManager(); - - $fullSchema = $sm->createSchema(); - - foreach ($fullSchema->getTables() as $table) { - if ($dropSchema->hasTable($table->getName())) { - $visitor->acceptTable($table); - } - - foreach ($table->getForeignKeys() as $foreignKey) { - if (! $dropSchema->hasTable($table->getName())) { - continue; - } - - if (! $dropSchema->hasTable($foreignKey->getForeignTableName())) { - continue; - } - - $visitor->acceptForeignKey($table, $foreignKey); - } - } - - if (! $this->platform->supportsSequences()) { - return $visitor->getQueries(); - } - - foreach ($dropSchema->getSequences() as $sequence) { - $visitor->acceptSequence($sequence); - } - - foreach ($dropSchema->getTables() as $table) { - $primaryKey = $table->getPrimaryKey(); - - if ($primaryKey === null) { - continue; - } - - $columns = $primaryKey->getColumns(); - - if (count($columns) > 1) { - continue; - } - - $checkSequence = $table->getName() . '_' . $columns[0] . '_seq'; - if (! $fullSchema->hasSequence($checkSequence)) { - continue; - } - - $visitor->acceptSequence($fullSchema->getSequence($checkSequence)); - } - - return $visitor->getQueries(); - } - - /** - * {@inheritdoc} - */ - public function getDropAllSchema() - { - $sm = $this->conn->getSchemaManager(); - $visitor = new DropSchemaSqlCollector($this->platform); - - $schema = $sm->createSchema(); - $schema->visit($visitor); - - return $visitor->getQueries(); - } - - /** - * {@inheritdoc} - */ - public function createSchema(Schema $createSchema) - { - $this->processSql($this->getCreateSchema($createSchema)); - } - - /** - * {@inheritdoc} - */ - public function updateSchema(Schema $toSchema, $noDrops = false) - { - $this->processSql($this->getUpdateSchema($toSchema, $noDrops)); - } - - /** - * {@inheritdoc} - */ - public function dropSchema(Schema $dropSchema) - { - $this->processSqlSafely($this->getDropSchema($dropSchema)); - } - - /** - * {@inheritdoc} - */ - public function dropAllSchema() - { - $this->processSql($this->getDropAllSchema()); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php deleted file mode 100644 index 70f63c76d..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php +++ /dev/null @@ -1,264 +0,0 @@ - "client" to the ShardChoser interface. - * - An exception is thrown if trying to switch shards during an open - * transaction. - * - * Instantiation through the DriverManager looks like: - * - * @deprecated - * - * @example - * - * $conn = DriverManager::getConnection(array( - * 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', - * 'driver' => 'pdo_mysql', - * 'global' => array('user' => '', 'password' => '', 'host' => '', 'dbname' => ''), - * 'shards' => array( - * array('id' => 1, 'user' => 'slave1', 'password', 'host' => '', 'dbname' => ''), - * array('id' => 2, 'user' => 'slave2', 'password', 'host' => '', 'dbname' => ''), - * ), - * 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', - * )); - * $shardManager = $conn->getShardManager(); - * $shardManager->selectGlobal(); - * $shardManager->selectShard($value); - */ -class PoolingShardConnection extends Connection -{ - /** @var DriverConnection[] */ - private $activeConnections = []; - - /** @var string|int|null */ - private $activeShardId; - - /** @var mixed[] */ - private $connectionParameters = []; - - /** - * {@inheritDoc} - * - * @internal The connection can be only instantiated by the driver manager. - * - * @throws InvalidArgumentException - */ - public function __construct( - array $params, - Driver $driver, - ?Configuration $config = null, - ?EventManager $eventManager = null - ) { - if (! isset($params['global'], $params['shards'])) { - throw new InvalidArgumentException("Connection Parameters require 'global' and 'shards' configurations."); - } - - if (! isset($params['shardChoser'])) { - throw new InvalidArgumentException("Missing Shard Choser configuration 'shardChoser'"); - } - - if (is_string($params['shardChoser'])) { - $params['shardChoser'] = new $params['shardChoser'](); - } - - if (! ($params['shardChoser'] instanceof ShardChoser)) { - throw new InvalidArgumentException( - "The 'shardChoser' configuration is not a valid instance of " . ShardChoser::class - ); - } - - $this->connectionParameters[0] = array_merge($params, $params['global']); - - foreach ($params['shards'] as $shard) { - if (! isset($shard['id'])) { - throw new InvalidArgumentException( - "Missing 'id' for one configured shard. Please specify a unique shard-id." - ); - } - - if (! is_numeric($shard['id']) || $shard['id'] < 1) { - throw new InvalidArgumentException('Shard Id has to be a non-negative number.'); - } - - if (isset($this->connectionParameters[$shard['id']])) { - throw new InvalidArgumentException('Shard ' . $shard['id'] . ' is duplicated in the configuration.'); - } - - $this->connectionParameters[$shard['id']] = array_merge($params, $shard); - } - - parent::__construct($params, $driver, $config, $eventManager); - } - - /** - * Get active shard id. - * - * @return string|int|null - */ - public function getActiveShardId() - { - return $this->activeShardId; - } - - /** - * {@inheritdoc} - */ - public function getParams() - { - return $this->activeShardId - ? $this->connectionParameters[$this->activeShardId] - : $this->connectionParameters[0]; - } - - /** - * {@inheritdoc} - */ - public function getHost() - { - $params = $this->getParams(); - - return $params['host'] ?? parent::getHost(); - } - - /** - * {@inheritdoc} - */ - public function getPort() - { - $params = $this->getParams(); - - return $params['port'] ?? parent::getPort(); - } - - /** - * {@inheritdoc} - */ - public function getUsername() - { - $params = $this->getParams(); - - return $params['user'] ?? parent::getUsername(); - } - - /** - * {@inheritdoc} - */ - public function getPassword() - { - $params = $this->getParams(); - - return $params['password'] ?? parent::getPassword(); - } - - /** - * Connects to a given shard. - * - * @param string|int|null $shardId - * - * @return bool - * - * @throws ShardingException - */ - public function connect($shardId = null) - { - if ($shardId === null && $this->_conn) { - return false; - } - - if ($shardId !== null && $shardId === $this->activeShardId) { - return false; - } - - if ($this->getTransactionNestingLevel() > 0) { - throw new ShardingException('Cannot switch shard when transaction is active.'); - } - - $activeShardId = $this->activeShardId = (int) $shardId; - - if (isset($this->activeConnections[$activeShardId])) { - $this->_conn = $this->activeConnections[$activeShardId]; - - return false; - } - - $this->_conn = $this->activeConnections[$activeShardId] = $this->connectTo($activeShardId); - - if ($this->_eventManager->hasListeners(Events::postConnect)) { - $eventArgs = new ConnectionEventArgs($this); - $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); - } - - return true; - } - - /** - * Connects to a specific connection. - * - * @param string|int $shardId - * - * @return \Doctrine\DBAL\Driver\Connection - */ - protected function connectTo($shardId) - { - $params = $this->getParams(); - - $driverOptions = $params['driverOptions'] ?? []; - - $connectionParams = $this->connectionParameters[$shardId]; - - $user = $connectionParams['user'] ?? null; - $password = $connectionParams['password'] ?? null; - - return $this->_driver->connect($connectionParams, $user, $password, $driverOptions); - } - - /** - * @param string|int|null $shardId - * - * @return bool - */ - public function isConnected($shardId = null) - { - if ($shardId === null) { - return $this->_conn !== null; - } - - return isset($this->activeConnections[$shardId]); - } - - /** - * @return void - */ - public function close() - { - $this->_conn = null; - $this->activeConnections = []; - $this->activeShardId = null; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardManager.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardManager.php deleted file mode 100644 index 81a197ee1..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/PoolingShardManager.php +++ /dev/null @@ -1,103 +0,0 @@ -getParams(); - $this->conn = $conn; - $this->choser = $params['shardChoser']; - } - - /** - * {@inheritDoc} - */ - public function selectGlobal() - { - $this->conn->connect(0); - $this->currentDistributionValue = null; - } - - /** - * {@inheritDoc} - */ - public function selectShard($distributionValue) - { - $shardId = $this->choser->pickShard($distributionValue, $this->conn); - $this->conn->connect($shardId); - $this->currentDistributionValue = $distributionValue; - } - - /** - * {@inheritDoc} - */ - public function getCurrentDistributionValue() - { - return $this->currentDistributionValue; - } - - /** - * {@inheritDoc} - */ - public function getShards() - { - $params = $this->conn->getParams(); - $shards = []; - - foreach ($params['shards'] as $shard) { - $shards[] = ['id' => $shard['id']]; - } - - return $shards; - } - - /** - * {@inheritDoc} - * - * @throws RuntimeException - */ - public function queryAll($sql, array $params, array $types) - { - $shards = $this->getShards(); - if (! $shards) { - throw new RuntimeException('No shards found.'); - } - - $result = []; - $oldDistribution = $this->getCurrentDistributionValue(); - - foreach ($shards as $shard) { - $this->conn->connect($shard['id']); - foreach ($this->conn->fetchAllAssociative($sql, $params, $types) as $row) { - $result[] = $row; - } - } - - if ($oldDistribution === null) { - $this->selectGlobal(); - } else { - $this->selectShard($oldDistribution); - } - - return $result; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php deleted file mode 100644 index 5fa2aa782..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php +++ /dev/null @@ -1,284 +0,0 @@ -shardManager = $shardManager; - $this->synchronizer = $sync ?: new SingleDatabaseSynchronizer($conn); - } - - /** - * {@inheritdoc} - */ - public function getCreateSchema(Schema $createSchema) - { - $sql = []; - - [$global, $federation] = $this->partitionSchema($createSchema); - - $globalSql = $this->synchronizer->getCreateSchema($global); - if ($globalSql) { - $sql[] = "-- Create Root Federation\n" . - 'USE FEDERATION ROOT WITH RESET;'; - $sql = array_merge($sql, $globalSql); - } - - $federationSql = $this->synchronizer->getCreateSchema($federation); - - if ($federationSql) { - $defaultValue = $this->getFederationTypeDefaultValue(); - - $sql[] = $this->getCreateFederationStatement(); - $sql[] = 'USE FEDERATION ' . $this->shardManager->getFederationName() - . ' (' . $this->shardManager->getDistributionKey() . ' = ' . $defaultValue . ')' - . ' WITH RESET, FILTERING = OFF;'; - $sql = array_merge($sql, $federationSql); - } - - return $sql; - } - - /** - * {@inheritdoc} - */ - public function getUpdateSchema(Schema $toSchema, $noDrops = false) - { - return $this->work($toSchema, static function ($synchronizer, $schema) use ($noDrops) { - return $synchronizer->getUpdateSchema($schema, $noDrops); - }); - } - - /** - * {@inheritdoc} - */ - public function getDropSchema(Schema $dropSchema) - { - return $this->work($dropSchema, static function ($synchronizer, $schema) { - return $synchronizer->getDropSchema($schema); - }); - } - - /** - * {@inheritdoc} - */ - public function createSchema(Schema $createSchema) - { - $this->processSql($this->getCreateSchema($createSchema)); - } - - /** - * {@inheritdoc} - */ - public function updateSchema(Schema $toSchema, $noDrops = false) - { - $this->processSql($this->getUpdateSchema($toSchema, $noDrops)); - } - - /** - * {@inheritdoc} - */ - public function dropSchema(Schema $dropSchema) - { - $this->processSqlSafely($this->getDropSchema($dropSchema)); - } - - /** - * {@inheritdoc} - */ - public function getDropAllSchema() - { - $this->shardManager->selectGlobal(); - $globalSql = $this->synchronizer->getDropAllSchema(); - - $sql = []; - - if ($globalSql) { - $sql[] = "-- Work on Root Federation\nUSE FEDERATION ROOT WITH RESET;"; - $sql = array_merge($sql, $globalSql); - } - - $shards = $this->shardManager->getShards(); - foreach ($shards as $shard) { - $this->shardManager->selectShard($shard['rangeLow']); - - $federationSql = $this->synchronizer->getDropAllSchema(); - if (! $federationSql) { - continue; - } - - $sql[] = '-- Work on Federation ID ' . $shard['id'] . "\n" . - 'USE FEDERATION ' . $this->shardManager->getFederationName() - . ' (' . $this->shardManager->getDistributionKey() . ' = ' . $shard['rangeLow'] . ')' - . ' WITH RESET, FILTERING = OFF;'; - $sql = array_merge($sql, $federationSql); - } - - $sql[] = 'USE FEDERATION ROOT WITH RESET;'; - $sql[] = 'DROP FEDERATION ' . $this->shardManager->getFederationName(); - - return $sql; - } - - /** - * {@inheritdoc} - */ - public function dropAllSchema() - { - $this->processSqlSafely($this->getDropAllSchema()); - } - - /** - * @return Schema[] - */ - private function partitionSchema(Schema $schema) - { - return [ - $this->extractSchemaFederation($schema, false), - $this->extractSchemaFederation($schema, true), - ]; - } - - /** - * @param bool $isFederation - * - * @return Schema - * - * @throws RuntimeException - */ - private function extractSchemaFederation(Schema $schema, $isFederation) - { - $partitionedSchema = clone $schema; - - foreach ($partitionedSchema->getTables() as $table) { - if ($isFederation) { - $table->addOption(self::FEDERATION_DISTRIBUTION_NAME, $this->shardManager->getDistributionKey()); - } - - if ($table->hasOption(self::FEDERATION_TABLE_FEDERATED) !== $isFederation) { - $partitionedSchema->dropTable($table->getName()); - } else { - foreach ($table->getForeignKeys() as $fk) { - $foreignTable = $schema->getTable($fk->getForeignTableName()); - if ($foreignTable->hasOption(self::FEDERATION_TABLE_FEDERATED) !== $isFederation) { - throw new RuntimeException('Cannot have foreign key between global/federation.'); - } - } - } - } - - return $partitionedSchema; - } - - /** - * Work on the Global/Federation based on currently existing shards and - * perform the given operation on the underlying schema synchronizer given - * the different partitioned schema instances. - * - * @return string[] - */ - private function work(Schema $schema, Closure $operation) - { - [$global, $federation] = $this->partitionSchema($schema); - $sql = []; - - $this->shardManager->selectGlobal(); - $globalSql = $operation($this->synchronizer, $global); - - if ($globalSql) { - $sql[] = "-- Work on Root Federation\nUSE FEDERATION ROOT WITH RESET;"; - $sql = array_merge($sql, $globalSql); - } - - $shards = $this->shardManager->getShards(); - - foreach ($shards as $shard) { - $this->shardManager->selectShard($shard['rangeLow']); - - $federationSql = $operation($this->synchronizer, $federation); - if (! $federationSql) { - continue; - } - - $sql[] = '-- Work on Federation ID ' . $shard['id'] . "\n" - . 'USE FEDERATION ' . $this->shardManager->getFederationName() - . ' (' . $this->shardManager->getDistributionKey() . ' = ' . $shard['rangeLow'] . ')' - . ' WITH RESET, FILTERING = OFF;'; - $sql = array_merge($sql, $federationSql); - } - - return $sql; - } - - /** - * @return string - */ - private function getFederationTypeDefaultValue() - { - $federationType = Type::getType($this->shardManager->getDistributionType()); - - switch ($federationType->getName()) { - case Types::GUID: - $defaultValue = '00000000-0000-0000-0000-000000000000'; - break; - case Types::INTEGER: - case Types::SMALLINT: - case Types::BIGINT: - $defaultValue = '0'; - break; - default: - $defaultValue = ''; - break; - } - - return $defaultValue; - } - - /** - * @return string - */ - private function getCreateFederationStatement() - { - $federationType = Type::getType($this->shardManager->getDistributionType()); - $federationTypeSql = $federationType->getSQLDeclaration([], $this->conn->getDatabasePlatform()); - - return "--Create Federation\n" - . 'CREATE FEDERATION ' . $this->shardManager->getFederationName() - . ' (' . $this->shardManager->getDistributionKey() - . ' ' . $federationTypeSql . ' RANGE)'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php deleted file mode 100644 index d511553c1..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php +++ /dev/null @@ -1,211 +0,0 @@ -conn = $conn; - $params = $conn->getParams(); - - if (! isset($params['sharding']['federationName'])) { - throw ShardingException::missingDefaultFederationName(); - } - - if (! isset($params['sharding']['distributionKey'])) { - throw ShardingException::missingDefaultDistributionKey(); - } - - if (! isset($params['sharding']['distributionType'])) { - throw ShardingException::missingDistributionType(); - } - - $this->federationName = $params['sharding']['federationName']; - $this->distributionKey = $params['sharding']['distributionKey']; - $this->distributionType = $params['sharding']['distributionType']; - $this->filteringEnabled = (bool) ($params['sharding']['filteringEnabled'] ?? false); - } - - /** - * Gets the name of the federation. - * - * @return string - */ - public function getFederationName() - { - return $this->federationName; - } - - /** - * Gets the distribution key. - * - * @return string - */ - public function getDistributionKey() - { - return $this->distributionKey; - } - - /** - * Gets the Doctrine Type name used for the distribution. - * - * @return string - */ - public function getDistributionType() - { - return $this->distributionType; - } - - /** - * Sets Enabled/Disable filtering on the fly. - * - * @param bool $flag - * - * @return void - */ - public function setFilteringEnabled($flag) - { - $this->filteringEnabled = (bool) $flag; - } - - /** - * {@inheritDoc} - */ - public function selectGlobal() - { - if ($this->conn->isTransactionActive()) { - throw ShardingException::activeTransaction(); - } - - $sql = 'USE FEDERATION ROOT WITH RESET'; - $this->conn->exec($sql); - $this->currentDistributionValue = null; - } - - /** - * {@inheritDoc} - */ - public function selectShard($distributionValue) - { - if ($this->conn->isTransactionActive()) { - throw ShardingException::activeTransaction(); - } - - $platform = $this->conn->getDatabasePlatform(); - $sql = sprintf( - 'USE FEDERATION %s (%s = %s) WITH RESET, FILTERING = %s;', - $platform->quoteIdentifier($this->federationName), - $platform->quoteIdentifier($this->distributionKey), - $this->conn->quote($distributionValue), - ($this->filteringEnabled ? 'ON' : 'OFF') - ); - - $this->conn->exec($sql); - $this->currentDistributionValue = $distributionValue; - } - - /** - * {@inheritDoc} - */ - public function getCurrentDistributionValue() - { - return $this->currentDistributionValue; - } - - /** - * {@inheritDoc} - */ - public function getShards() - { - $sql = 'SELECT member_id as id, - distribution_name as distribution_key, - CAST(range_low AS CHAR) AS rangeLow, - CAST(range_high AS CHAR) AS rangeHigh - FROM sys.federation_member_distributions d - INNER JOIN sys.federations f ON f.federation_id = d.federation_id - WHERE f.name = ' . $this->conn->quote($this->federationName); - - return $this->conn->fetchAllAssociative($sql); - } - - /** - * {@inheritDoc} - */ - public function queryAll($sql, array $params = [], array $types = []) - { - $shards = $this->getShards(); - if (! $shards) { - throw new RuntimeException('No shards found for ' . $this->federationName); - } - - $result = []; - $oldDistribution = $this->getCurrentDistributionValue(); - - foreach ($shards as $shard) { - $this->selectShard($shard['rangeLow']); - foreach ($this->conn->fetchAllAssociative($sql, $params, $types) as $row) { - $result[] = $row; - } - } - - if ($oldDistribution === null) { - $this->selectGlobal(); - } else { - $this->selectShard($oldDistribution); - } - - return $result; - } - - /** - * Splits Federation at a given distribution value. - * - * @param mixed $splitDistributionValue - * - * @return void - */ - public function splitFederation($splitDistributionValue) - { - $type = Type::getType($this->distributionType); - - $sql = 'ALTER FEDERATION ' . $this->getFederationName() . ' ' . - 'SPLIT AT (' . $this->getDistributionKey() . ' = ' . - $this->conn->quote($splitDistributionValue, $type->getBindingType()) . ')'; - $this->conn->exec($sql); - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php deleted file mode 100644 index d9ef9e896..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php +++ /dev/null @@ -1,152 +0,0 @@ -excludedTables = $excludedTables; - $this->tenantColumnName = $tenantColumnName; - $this->distributionName = $distributionName ?: $tenantColumnName; - } - - /** - * {@inheritdoc} - */ - public function acceptTable(Table $table) - { - if (in_array($table->getName(), $this->excludedTables)) { - return; - } - - $table->addColumn($this->tenantColumnName, $this->tenantColumnType, [ - 'default' => "federation_filtering_value('" . $this->distributionName . "')", - ]); - - $clusteredIndex = $this->getClusteredIndex($table); - - $indexColumns = $clusteredIndex->getColumns(); - $indexColumns[] = $this->tenantColumnName; - - if ($clusteredIndex->isPrimary()) { - $table->dropPrimaryKey(); - $table->setPrimaryKey($indexColumns); - } else { - $table->dropIndex($clusteredIndex->getName()); - $table->addIndex($indexColumns, $clusteredIndex->getName()); - $table->getIndex($clusteredIndex->getName())->addFlag('clustered'); - } - } - - /** - * @param Table $table - * - * @return Index - * - * @throws RuntimeException - */ - private function getClusteredIndex($table) - { - foreach ($table->getIndexes() as $index) { - if ($index->isPrimary() && ! $index->hasFlag('nonclustered')) { - return $index; - } - - if ($index->hasFlag('clustered')) { - return $index; - } - } - - throw new RuntimeException('No clustered index found on table ' . $table->getName()); - } - - /** - * {@inheritdoc} - */ - public function acceptSchema(Schema $schema) - { - } - - /** - * {@inheritdoc} - */ - public function acceptColumn(Table $table, Column $column) - { - } - - /** - * {@inheritdoc} - */ - public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) - { - } - - /** - * {@inheritdoc} - */ - public function acceptIndex(Table $table, Index $index) - { - } - - /** - * {@inheritdoc} - */ - public function acceptSequence(Sequence $sequence) - { - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/MultiTenantShardChoser.php b/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/MultiTenantShardChoser.php deleted file mode 100644 index f44c3af43..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Sharding/ShardChoser/MultiTenantShardChoser.php +++ /dev/null @@ -1,22 +0,0 @@ -Statement for the given SQL and Connection. - * - * @internal The statement can be only instantiated by {@link Connection}. - * - * @param string $sql The SQL of the statement. - * @param Connection $conn The connection on which the statement should be executed. - */ - public function __construct($sql, Connection $conn) - { - $this->sql = $sql; - $this->stmt = $conn->getWrappedConnection()->prepare($sql); - $this->conn = $conn; - $this->platform = $conn->getDatabasePlatform(); - } - - /** - * Binds a parameter value to the statement. - * - * The value can optionally be bound with a PDO binding type or a DBAL mapping type. - * If bound with a DBAL mapping type, the binding type is derived from the mapping - * type and the value undergoes the conversion routines of the mapping type before - * being bound. - * - * @param string|int $param The name or position of the parameter. - * @param mixed $value The value of the parameter. - * @param mixed $type Either a PDO binding type or a DBAL mapping type name or instance. - * - * @return bool TRUE on success, FALSE on failure. - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - $this->params[$param] = $value; - $this->types[$param] = $type; - if ($type !== null) { - if (is_string($type)) { - $type = Type::getType($type); - } - - if ($type instanceof Type) { - $value = $type->convertToDatabaseValue($value, $this->platform); - $bindingType = $type->getBindingType(); - } else { - $bindingType = $type; - } - - return $this->stmt->bindValue($param, $value, $bindingType); - } - - return $this->stmt->bindValue($param, $value); - } - - /** - * Binds a parameter to a value by reference. - * - * Binding a parameter by reference does not support DBAL mapping types. - * - * @param string|int $param The name or position of the parameter. - * @param mixed $variable The reference to the variable to bind. - * @param int $type The PDO binding type. - * @param int|null $length Must be specified when using an OUT bind - * so that PHP allocates enough memory to hold the returned value. - * - * @return bool TRUE on success, FALSE on failure. - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - $this->params[$param] = $variable; - $this->types[$param] = $type; - - if ($this->stmt instanceof PDOStatement) { - $length = $length ?? 0; - } - - return $this->stmt->bindParam($param, $variable, $type, $length); - } - - /** - * Executes the statement with the currently bound parameters. - * - * @param mixed[]|null $params - * - * @return bool TRUE on success, FALSE on failure. - * - * @throws Exception - */ - public function execute($params = null) - { - if (is_array($params)) { - $this->params = $params; - } - - $logger = $this->conn->getConfiguration()->getSQLLogger(); - if ($logger) { - $logger->startQuery($this->sql, $this->params, $this->types); - } - - try { - $stmt = $this->stmt->execute($params); - } catch (Throwable $ex) { - if ($logger) { - $logger->stopQuery(); - } - - $this->conn->handleExceptionDuringQuery($ex, $this->sql, $this->params, $this->types); - } - - if ($logger) { - $logger->stopQuery(); - } - - return $stmt; - } - - /** - * Closes the cursor, freeing the database resources used by this statement. - * - * @deprecated Use Result::free() instead. - * - * @return bool TRUE on success, FALSE on failure. - */ - public function closeCursor() - { - return $this->stmt->closeCursor(); - } - - /** - * Returns the number of columns in the result set. - * - * @return int - */ - public function columnCount() - { - return $this->stmt->columnCount(); - } - - /** - * Fetches the SQLSTATE associated with the last operation on the statement. - * - * @deprecated The error information is available via exceptions. - * - * @return string|int|bool - */ - public function errorCode() - { - return $this->stmt->errorCode(); - } - - /** - * {@inheritDoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return $this->stmt->errorInfo(); - } - - /** - * {@inheritdoc} - * - * @deprecated Use one of the fetch- or iterate-related methods. - */ - public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) - { - if ($arg2 === null) { - return $this->stmt->setFetchMode($fetchMode); - } - - if ($arg3 === null) { - return $this->stmt->setFetchMode($fetchMode, $arg2); - } - - return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3); - } - - /** - * Required by interface IteratorAggregate. - * - * @deprecated Use iterateNumeric(), iterateAssociative() or iterateColumn() instead. - * - * {@inheritdoc} - */ - public function getIterator() - { - return $this->stmt; - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead. - */ - public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) - { - return $this->stmt->fetch($fetchMode); - } - - /** - * {@inheritdoc} - * - * @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead. - */ - public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) - { - if ($ctorArgs !== null) { - return $this->stmt->fetchAll($fetchMode, $fetchArgument, $ctorArgs); - } - - if ($fetchArgument !== null) { - return $this->stmt->fetchAll($fetchMode, $fetchArgument); - } - - return $this->stmt->fetchAll($fetchMode); - } - - /** - * {@inheritDoc} - * - * @deprecated Use fetchOne() instead. - */ - public function fetchColumn($columnIndex = 0) - { - return $this->stmt->fetchColumn($columnIndex); - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchNumeric() - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchNumeric(); - } - - return $this->stmt->fetch(FetchMode::NUMERIC); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchAssociative() - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchAssociative(); - } - - return $this->stmt->fetch(FetchMode::ASSOCIATIVE); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritDoc} - * - * @throws Exception - */ - public function fetchOne() - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchOne(); - } - - return $this->stmt->fetch(FetchMode::COLUMN); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchAllNumeric(): array - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchAllNumeric(); - } - - return $this->stmt->fetchAll(FetchMode::NUMERIC); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchAllAssociative(): array - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchAllAssociative(); - } - - return $this->stmt->fetchAll(FetchMode::ASSOCIATIVE); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * Returns an associative array with the keys mapped to the first column and the values mapped to the second column. - * - * The result must contain at least two columns. - * - * @return array - * - * @throws Exception - */ - public function fetchAllKeyValue(): array - { - $this->ensureHasKeyValue(); - - $data = []; - - foreach ($this->fetchAllNumeric() as [$key, $value]) { - $data[$key] = $value; - } - - return $data; - } - - /** - * Returns an associative array with the keys mapped to the first column and the values being - * an associative array representing the rest of the columns and their values. - * - * @return array> - * - * @throws Exception - */ - public function fetchAllAssociativeIndexed(): array - { - $data = []; - - foreach ($this->fetchAll(FetchMode::ASSOCIATIVE) as $row) { - $data[array_shift($row)] = $row; - } - - return $data; - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function fetchFirstColumn(): array - { - try { - if ($this->stmt instanceof Result) { - return $this->stmt->fetchFirstColumn(); - } - - return $this->stmt->fetchAll(FetchMode::COLUMN); - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritDoc} - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateNumeric(): Traversable - { - try { - if ($this->stmt instanceof Result) { - while (($row = $this->stmt->fetchNumeric()) !== false) { - yield $row; - } - } else { - while (($row = $this->stmt->fetch(FetchMode::NUMERIC)) !== false) { - yield $row; - } - } - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * {@inheritDoc} - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociative(): Traversable - { - try { - if ($this->stmt instanceof Result) { - while (($row = $this->stmt->fetchAssociative()) !== false) { - yield $row; - } - } else { - while (($row = $this->stmt->fetch(FetchMode::ASSOCIATIVE)) !== false) { - yield $row; - } - } - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * Returns an iterator over the result set with the keys mapped to the first column - * and the values mapped to the second column. - * - * The result must contain at least two columns. - * - * @return Traversable - * - * @throws Exception - */ - public function iterateKeyValue(): Traversable - { - $this->ensureHasKeyValue(); - - foreach ($this->iterateNumeric() as [$key, $value]) { - yield $key => $value; - } - } - - /** - * Returns an iterator over the result set with the keys mapped to the first column and the values being - * an associative array representing the rest of the columns and their values. - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociativeIndexed(): Traversable - { - while (($row = $this->stmt->fetch(FetchMode::ASSOCIATIVE)) !== false) { - yield array_shift($row) => $row; - } - } - - /** - * {@inheritDoc} - * - * @return Traversable - * - * @throws Exception - */ - public function iterateColumn(): Traversable - { - try { - if ($this->stmt instanceof Result) { - while (($value = $this->stmt->fetchOne()) !== false) { - yield $value; - } - } else { - while (($value = $this->stmt->fetch(FetchMode::COLUMN)) !== false) { - yield $value; - } - } - } catch (Exception $e) { - $this->conn->handleDriverException($e); - } - } - - /** - * Returns the number of rows affected by the last execution of this statement. - * - * @return int The number of affected rows. - */ - public function rowCount() - { - return $this->stmt->rowCount(); - } - - public function free(): void - { - if ($this->stmt instanceof Result) { - $this->stmt->free(); - - return; - } - - $this->stmt->closeCursor(); - } - - /** - * Gets the wrapped driver statement. - * - * @return \Doctrine\DBAL\Driver\Statement - */ - public function getWrappedStatement() - { - return $this->stmt; - } - - private function ensureHasKeyValue(): void - { - $columnCount = $this->columnCount(); - - if ($columnCount < 2) { - throw NoKeyValue::fromColumnCount($columnCount); - } - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php b/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php deleted file mode 100644 index 26456bde0..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php +++ /dev/null @@ -1,143 +0,0 @@ -setName('dbal:import') - ->setDescription('Import SQL file(s) directly to Database.') - ->setDefinition([new InputArgument( - 'file', - InputArgument::REQUIRED | InputArgument::IS_ARRAY, - 'File path(s) of SQL to be executed.' - ), - ]) - ->setHelp(<<getHelper('db')->getConnection(); - - $fileNames = $input->getArgument('file'); - - if ($fileNames === null) { - return 0; - } - - foreach ((array) $fileNames as $fileName) { - $filePath = realpath($fileName); - - // Phar compatibility. - if ($filePath === false) { - $filePath = $fileName; - } - - if (! file_exists($filePath)) { - throw new InvalidArgumentException( - sprintf("SQL file '%s' does not exist.", $filePath) - ); - } - - if (! is_readable($filePath)) { - throw new InvalidArgumentException( - sprintf("SQL file '%s' does not have read permissions.", $filePath) - ); - } - - $output->write(sprintf("Processing file '%s'... ", $filePath)); - $sql = @file_get_contents($filePath); - - if ($sql === false) { - $message = sprintf("Unable to read SQL file '%s'", $filePath); - $error = error_get_last(); - - if ($error !== null) { - $message .= ': ' . $error['message']; - } - - throw new RuntimeException($message); - } - - if ($conn instanceof PDOConnection) { - // PDO Drivers - try { - $lines = 0; - - $stmt = $conn->prepare($sql); - assert($stmt instanceof PDOStatement); - - $stmt->execute(); - - do { - // Required due to "MySQL has gone away!" issue - $stmt->fetch(); - $stmt->closeCursor(); - - $lines++; - } while ($stmt->nextRowset()); - - $output->write(sprintf('%d statements executed!', $lines) . PHP_EOL); - } catch (PDOException $e) { - $output->write('error!' . PHP_EOL); - - throw new RuntimeException($e->getMessage(), $e->getCode(), $e); - } - } else { - // Non-PDO Drivers (ie. OCI8 driver) - $stmt = $conn->prepare($sql); - $rs = $stmt->execute(); - - if (! $rs) { - $error = $stmt->errorInfo(); - - $output->write('error!' . PHP_EOL); - - throw new RuntimeException($error[2], $error[0]); - } - - $output->writeln('OK!' . PHP_EOL); - - $stmt->closeCursor(); - } - } - - return 0; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php b/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php deleted file mode 100644 index 3d73388c7..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php +++ /dev/null @@ -1,118 +0,0 @@ - new ConnectionHelper($connection), - ]); - } - - /** - * Runs console with the given connection provider or helperset (deprecated). - * - * @param ConnectionProvider|HelperSet $helperSetOrConnectionProvider - * @param Command[] $commands - * - * @return void - */ - public static function run($helperSetOrConnectionProvider, $commands = []) - { - $cli = new Application('Doctrine Command Line Interface', Version::VERSION); - - $cli->setCatchExceptions(true); - - $connectionProvider = null; - if ($helperSetOrConnectionProvider instanceof HelperSet) { - @trigger_error(sprintf( - 'Passing an instance of "%s" as the first argument is deprecated. Pass an instance of "%s" instead.', - HelperSet::class, - ConnectionProvider::class - ), E_USER_DEPRECATED); - $connectionProvider = null; - $cli->setHelperSet($helperSetOrConnectionProvider); - } elseif ($helperSetOrConnectionProvider instanceof ConnectionProvider) { - $connectionProvider = $helperSetOrConnectionProvider; - } else { - throw new TypeError(sprintf( - 'First argument must be an instance of "%s" or "%s"', - HelperSet::class, - ConnectionProvider::class - )); - } - - self::addCommands($cli, $connectionProvider); - - $cli->addCommands($commands); - $cli->run(); - } - - /** - * @return void - */ - public static function addCommands(Application $cli, ?ConnectionProvider $connectionProvider = null) - { - $cli->addCommands([ - new RunSqlCommand($connectionProvider), - new ImportCommand(), - new ReservedWordsCommand($connectionProvider), - ]); - } - - /** - * Prints the instructions to create a configuration file - * - * @return void - */ - public static function printCliConfigTemplate() - { - echo <<<'HELP' -You are missing a "cli-config.php" or "config/cli-config.php" file in your -project, which is required to get the Doctrine-DBAL Console working. You can use the -following sample as a template: - -_connection = $connection; - } - - /** - * Retrieves the Doctrine database Connection. - * - * @return Connection - */ - public function getConnection() - { - return $this->_connection; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'connection'; - } -} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php b/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php deleted file mode 100644 index 400e0ef38..000000000 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonArrayType.php +++ /dev/null @@ -1,47 +0,0 @@ -data = $data; + if (count($data) === 0) { + return; + } + + $this->columnCount = count($data[0]); + } + + /** + * {@inheritdoc} + */ + public function fetchNumeric() + { + $row = $this->fetch(); + + if ($row === false) { + return false; + } + + return array_values($row); + } + + /** + * {@inheritdoc} + */ + public function fetchAssociative() + { + return $this->fetch(); + } + + /** + * {@inheritdoc} + */ + public function fetchOne() + { + $row = $this->fetch(); + + if ($row === false) { + return false; + } + + return reset($row); + } + + /** + * {@inheritdoc} + */ + public function fetchAllNumeric(): array + { + return FetchUtils::fetchAllNumeric($this); + } + + /** + * {@inheritdoc} + */ + public function fetchAllAssociative(): array + { + return FetchUtils::fetchAllAssociative($this); + } + + /** + * {@inheritdoc} + */ + public function fetchFirstColumn(): array + { + return FetchUtils::fetchFirstColumn($this); + } + + public function rowCount(): int + { + if ($this->data === null) { + return 0; + } + + return count($this->data); + } + + public function columnCount(): int + { + return $this->columnCount; + } + + public function free(): void + { + $this->data = []; + } + + /** + * @return mixed|false + */ + private function fetch() + { + if (! isset($this->data[$this->num])) { + return false; + } + + return $this->data[$this->num++]; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php b/doctrine/dbal/src/Cache/CacheException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php rename to doctrine/dbal/src/Cache/CacheException.php diff --git a/doctrine/dbal/src/Cache/CachingResult.php b/doctrine/dbal/src/Cache/CachingResult.php new file mode 100644 index 000000000..c060673c5 --- /dev/null +++ b/doctrine/dbal/src/Cache/CachingResult.php @@ -0,0 +1,184 @@ +>|null */ + private $data; + + /** + * @param string $cacheKey + * @param string $realKey + * @param int $lifetime + */ + public function __construct(Result $result, Cache $cache, $cacheKey, $realKey, $lifetime) + { + $this->result = $result; + $this->cache = $cache; + $this->cacheKey = $cacheKey; + $this->realKey = $realKey; + $this->lifetime = $lifetime; + } + + /** + * {@inheritdoc} + */ + public function fetchNumeric() + { + $row = $this->fetch(); + + if ($row === false) { + return false; + } + + return array_values($row); + } + + /** + * {@inheritdoc} + */ + public function fetchAssociative() + { + return $this->fetch(); + } + + /** + * {@inheritdoc} + */ + public function fetchOne() + { + return FetchUtils::fetchOne($this); + } + + /** + * {@inheritdoc} + */ + public function fetchAllNumeric(): array + { + return array_map('array_values', $this->fetchAllAssociative()); + } + + /** + * {@inheritdoc} + */ + public function fetchAllAssociative(): array + { + $data = $this->result->fetchAllAssociative(); + + $this->store($data); + + return $data; + } + + /** + * {@inheritdoc} + */ + public function fetchFirstColumn(): array + { + return FetchUtils::fetchFirstColumn($this); + } + + public function rowCount(): int + { + return $this->result->rowCount(); + } + + public function columnCount(): int + { + return $this->result->columnCount(); + } + + public function free(): void + { + $this->data = null; + } + + /** + * @return array|false + * + * @throws Exception + */ + private function fetch() + { + if ($this->data === null) { + $this->data = []; + } + + $row = $this->result->fetchAssociative(); + + if ($row !== false) { + $this->data[] = $row; + + return $row; + } + + $this->saveToCache(); + + return false; + } + + /** + * @param array> $data + */ + private function store(array $data): void + { + $this->data = $data; + + $this->saveToCache(); + } + + private function saveToCache(): void + { + if ($this->data === null) { + return; + } + + $data = $this->cache->fetch($this->cacheKey); + + if ($data === false) { + $data = []; + } + + $data[$this->realKey] = $this->data; + + $this->cache->save($this->cacheKey, $data, $this->lifetime); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php b/doctrine/dbal/src/Cache/QueryCacheProfile.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php rename to doctrine/dbal/src/Cache/QueryCacheProfile.php index 3a57358fa..3d5b814d2 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php +++ b/doctrine/dbal/src/Cache/QueryCacheProfile.php @@ -70,7 +70,7 @@ public function getCacheKey() * Generates the real cache key from query, params, types and connection parameters. * * @param string $sql - * @param array|array $params + * @param list|array $params * @param array|array $types * @param array $connectionParams * diff --git a/doctrine/dbal/lib/Doctrine/DBAL/ColumnCase.php b/doctrine/dbal/src/ColumnCase.php similarity index 69% rename from doctrine/dbal/lib/Doctrine/DBAL/ColumnCase.php rename to doctrine/dbal/src/ColumnCase.php index c26aac162..cb0dd409b 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/ColumnCase.php +++ b/doctrine/dbal/src/ColumnCase.php @@ -2,8 +2,6 @@ namespace Doctrine\DBAL; -use PDO; - /** * Contains portable column case conversions. */ @@ -11,17 +9,13 @@ final class ColumnCase { /** * Convert column names to upper case. - * - * @see \PDO::CASE_UPPER */ - public const UPPER = PDO::CASE_UPPER; + public const UPPER = 1; /** * Convert column names to lower case. - * - * @see \PDO::CASE_LOWER */ - public const LOWER = PDO::CASE_LOWER; + public const LOWER = 2; /** * This class cannot be instantiated. diff --git a/doctrine/dbal/src/Configuration.php b/doctrine/dbal/src/Configuration.php new file mode 100644 index 000000000..109289f5a --- /dev/null +++ b/doctrine/dbal/src/Configuration.php @@ -0,0 +1,140 @@ +sqlLogger = $logger; + } + + /** + * Gets the SQL logger that is used. + */ + public function getSQLLogger(): ?SQLLogger + { + return $this->sqlLogger; + } + + /** + * Gets the cache driver implementation that is used for query result caching. + */ + public function getResultCacheImpl(): ?Cache + { + return $this->resultCacheImpl; + } + + /** + * Sets the cache driver implementation that is used for query result caching. + */ + public function setResultCacheImpl(Cache $cacheImpl): void + { + $this->resultCacheImpl = $cacheImpl; + } + + /** + * Sets the callable to use to filter schema assets. + */ + public function setSchemaAssetsFilter(?callable $callable = null): void + { + $this->schemaAssetsFilter = $callable; + } + + /** + * Returns the callable to use to filter schema assets. + */ + public function getSchemaAssetsFilter(): ?callable + { + return $this->schemaAssetsFilter; + } + + /** + * Sets the default auto-commit mode for connections. + * + * If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual + * transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either + * the method commit or the method rollback. By default, new connections are in auto-commit mode. + * + * @see getAutoCommit + * + * @param bool $autoCommit True to enable auto-commit mode; false to disable it + */ + public function setAutoCommit(bool $autoCommit): void + { + $this->autoCommit = $autoCommit; + } + + /** + * Returns the default auto-commit mode for connections. + * + * @see setAutoCommit + * + * @return bool True if auto-commit mode is enabled by default for connections, false otherwise. + */ + public function getAutoCommit(): bool + { + return $this->autoCommit; + } + + /** + * @param Middleware[] $middlewares + * + * @return $this + */ + public function setMiddlewares(array $middlewares): self + { + $this->middlewares = $middlewares; + + return $this; + } + + /** + * @return Middleware[] + */ + public function getMiddlewares(): array + { + return $this->middlewares; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Connection.php b/doctrine/dbal/src/Connection.php similarity index 65% rename from doctrine/dbal/lib/Doctrine/DBAL/Connection.php rename to doctrine/dbal/src/Connection.php index 2d5d4402b..9477b54e5 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Connection.php +++ b/doctrine/dbal/src/Connection.php @@ -4,70 +4,40 @@ use Closure; use Doctrine\Common\EventManager; -use Doctrine\DBAL\Abstraction\Result; -use Doctrine\DBAL\Cache\ArrayStatement; +use Doctrine\DBAL\Cache\ArrayResult; use Doctrine\DBAL\Cache\CacheException; +use Doctrine\DBAL\Cache\CachingResult; use Doctrine\DBAL\Cache\QueryCacheProfile; -use Doctrine\DBAL\Cache\ResultCacheStatement; +use Doctrine\DBAL\Driver\API\ExceptionConverter; use Doctrine\DBAL\Driver\Connection as DriverConnection; -use Doctrine\DBAL\Driver\PingableConnection; -use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; +use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Exception\ConnectionLost; +use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\InvalidArgumentException; -use Doctrine\DBAL\Exception\NoKeyValue; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; use Doctrine\DBAL\Query\QueryBuilder; use Doctrine\DBAL\Schema\AbstractSchemaManager; +use Doctrine\DBAL\SQL\Parser; use Doctrine\DBAL\Types\Type; use Throwable; use Traversable; use function array_key_exists; -use function array_shift; use function assert; -use function func_get_args; +use function count; use function implode; use function is_int; use function is_string; use function key; /** - * A wrapper around a Doctrine\DBAL\Driver\Connection that adds features like - * events, transaction isolation levels, configuration, emulated transaction nesting, - * lazy connecting and more. + * A database abstraction-level connection that implements features like events, transaction isolation levels, + * configuration, emulated transaction nesting, lazy connecting and more. */ -class Connection implements DriverConnection +class Connection { - /** - * Constant for transaction isolation level READ UNCOMMITTED. - * - * @deprecated Use TransactionIsolationLevel::READ_UNCOMMITTED. - */ - public const TRANSACTION_READ_UNCOMMITTED = TransactionIsolationLevel::READ_UNCOMMITTED; - - /** - * Constant for transaction isolation level READ COMMITTED. - * - * @deprecated Use TransactionIsolationLevel::READ_COMMITTED. - */ - public const TRANSACTION_READ_COMMITTED = TransactionIsolationLevel::READ_COMMITTED; - - /** - * Constant for transaction isolation level REPEATABLE READ. - * - * @deprecated Use TransactionIsolationLevel::REPEATABLE_READ. - */ - public const TRANSACTION_REPEATABLE_READ = TransactionIsolationLevel::REPEATABLE_READ; - - /** - * Constant for transaction isolation level SERIALIZABLE. - * - * @deprecated Use TransactionIsolationLevel::SERIALIZABLE. - */ - public const TRANSACTION_SERIALIZABLE = TransactionIsolationLevel::SERIALIZABLE; - /** * Represents an array of ints to be expanded by Doctrine SQL parsing. */ @@ -142,6 +112,12 @@ class Connection implements DriverConnection */ private $platform; + /** @var ExceptionConverter|null */ + private $exceptionConverter; + + /** @var Parser|null */ + private $parser; + /** * The schema manager. * @@ -163,9 +139,6 @@ class Connection implements DriverConnection */ private $isRollbackOnly = false; - /** @var int */ - protected $defaultFetchMode = FetchMode::ASSOCIATIVE; - /** * Initializes a new instance of the Connection class. * @@ -187,11 +160,6 @@ public function __construct( $this->_driver = $driver; $this->params = $params; - if (isset($params['pdo'])) { - $this->_conn = $params['pdo']; - unset($this->params['pdo']); - } - if (isset($params['platform'])) { if (! $params['platform'] instanceof Platforms\AbstractPlatform) { throw Exception::invalidPlatformType($params['platform']); @@ -201,11 +169,11 @@ public function __construct( } // Create default config and event manager if none given - if (! $config) { + if ($config === null) { $config = new Configuration(); } - if (! $eventManager) { + if ($eventManager === null) { $eventManager = new EventManager(); } @@ -230,61 +198,23 @@ public function getParams() } /** - * Gets the name of the database this Connection is connected to. + * Gets the name of the currently selected database. * - * @return string - */ - public function getDatabase() - { - return $this->_driver->getDatabase($this); - } - - /** - * Gets the hostname of the currently connected database. + * @return string|null The name of the database or NULL if a database is not selected. + * The platforms which don't support the concept of a database (e.g. embedded databases) + * must always return a string as an indicator of an implicitly selected database. * - * @deprecated - * - * @return string|null + * @throws Exception */ - public function getHost() + public function getDatabase() { - return $this->params['host'] ?? null; - } + $platform = $this->getDatabasePlatform(); + $query = $platform->getDummySelectSQL($platform->getCurrentDatabaseExpression()); + $database = $this->fetchOne($query); - /** - * Gets the port of the currently connected database. - * - * @deprecated - * - * @return mixed - */ - public function getPort() - { - return $this->params['port'] ?? null; - } + assert(is_string($database) || $database === null); - /** - * Gets the username used by this connection. - * - * @deprecated - * - * @return string|null - */ - public function getUsername() - { - return $this->params['user'] ?? null; - } - - /** - * Gets the password used by this connection. - * - * @deprecated - * - * @return string|null - */ - public function getPassword() - { - return $this->params['password'] ?? null; + return $database; } /** @@ -348,6 +278,8 @@ public function getExpressionBuilder() * * @return bool TRUE if the connection was successfully established, FALSE if * the connection is already open. + * + * @throws Exception */ public function connect() { @@ -355,11 +287,11 @@ public function connect() return false; } - $driverOptions = $this->params['driverOptions'] ?? []; - $user = $this->params['user'] ?? null; - $password = $this->params['password'] ?? null; - - $this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions); + try { + $this->_conn = $this->_driver->connect($this->params); + } catch (Driver\Exception $e) { + throw $this->convertException($e); + } $this->transactionNestingLevel = 0; @@ -425,8 +357,8 @@ private function getDatabasePlatformVersion() if ($this->_conn === null) { try { $this->connect(); - } catch (Throwable $originalException) { - if (empty($this->params['dbname'])) { + } catch (Exception $originalException) { + if (! isset($this->params['dbname'])) { throw $originalException; } @@ -437,7 +369,7 @@ private function getDatabasePlatformVersion() try { $this->connect(); - } catch (Throwable $fallbackException) { + } catch (Exception $fallbackException) { // Either the platform does not support database-less connections // or something else went wrong. // Reset connection parameters and rethrow the original exception. @@ -464,14 +396,20 @@ private function getDatabasePlatformVersion() * Returns the database server version if the underlying driver supports it. * * @return string|null + * + * @throws Exception */ private function getServerVersion() { $connection = $this->getWrappedConnection(); // Automatic platform version detection. - if ($connection instanceof ServerInfoAwareConnection && ! $connection->requiresQueryForServerVersion()) { - return $connection->getServerVersion(); + if ($connection instanceof ServerInfoAwareConnection) { + try { + return $connection->getServerVersion(); + } catch (Driver\Exception $e) { + throw $this->convertException($e); + } } // Unable to detect platform version. @@ -525,82 +463,12 @@ public function setAutoCommit($autoCommit) $this->commitAll(); } - /** - * Sets the fetch mode. - * - * @deprecated Use one of the fetch- or iterate-related methods. - * - * @param int $fetchMode - * - * @return void - */ - public function setFetchMode($fetchMode) - { - $this->defaultFetchMode = $fetchMode; - } - - /** - * Prepares and executes an SQL query and returns the first row of the result - * as an associative array. - * - * @deprecated Use fetchAssociative() - * - * @param string $sql SQL query - * @param array|array $params Query parameters - * @param array|array $types Parameter types - * - * @return array|false False is returned if no rows are found. - * - * @throws Exception - */ - public function fetchAssoc($sql, array $params = [], array $types = []) - { - return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::ASSOCIATIVE); - } - - /** - * Prepares and executes an SQL query and returns the first row of the result - * as a numerically indexed array. - * - * @deprecated Use fetchNumeric() - * - * @param string $sql SQL query - * @param array|array $params Query parameters - * @param array|array $types Parameter types - * - * @return array|false False is returned if no rows are found. - */ - public function fetchArray($sql, array $params = [], array $types = []) - { - return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::NUMERIC); - } - - /** - * Prepares and executes an SQL query and returns the value of a single column - * of the first row of the result. - * - * @deprecated Use fetchOne() instead. - * - * @param string $sql SQL query - * @param array|array $params Query parameters - * @param int $column 0-indexed column number - * @param array|array $types Parameter types - * - * @return mixed|false False is returned if no rows are found. - * - * @throws Exception - */ - public function fetchColumn($sql, array $params = [], $column = 0, array $types = []) - { - return $this->executeQuery($sql, $params, $types)->fetchColumn($column); - } - /** * Prepares and executes an SQL query and returns the first row of the result * as an associative array. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return array|false False is returned if no rows are found. @@ -610,15 +478,9 @@ public function fetchColumn($sql, array $params = [], $column = 0, array $types public function fetchAssociative(string $query, array $params = [], array $types = []) { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchAssociative(); - } - - return $stmt->fetch(FetchMode::ASSOCIATIVE); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchAssociative(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -627,25 +489,19 @@ public function fetchAssociative(string $query, array $params = [], array $types * as a numerically indexed array. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return array|false False is returned if no rows are found. + * @return list< mixed>|false False is returned if no rows are found. * * @throws Exception */ public function fetchNumeric(string $query, array $params = [], array $types = []) { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchNumeric(); - } - - return $stmt->fetch(FetchMode::NUMERIC); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchNumeric(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -654,7 +510,7 @@ public function fetchNumeric(string $query, array $params = [], array $types = [ * of the first row of the result. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return mixed|false False is returned if no rows are found. @@ -664,15 +520,9 @@ public function fetchNumeric(string $query, array $params = [], array $types = [ public function fetchOne(string $query, array $params = [], array $types = []) { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchOne(); - } - - return $stmt->fetch(FetchMode::COLUMN); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchOne(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -741,7 +591,7 @@ private function addCriteriaCondition( */ public function delete($table, array $criteria, array $types = []) { - if (empty($criteria)) { + if (count($criteria) === 0) { throw InvalidArgumentException::fromEmptyCriteria(); } @@ -772,6 +622,8 @@ public function close() * @param int $level The level to set. * * @return int + * + * @throws Exception */ public function setTransactionIsolation($level) { @@ -784,6 +636,8 @@ public function setTransactionIsolation($level) * Gets the currently active transaction isolation level. * * @return int The current transaction isolation level. + * + * @throws Exception */ public function getTransactionIsolation() { @@ -845,7 +699,7 @@ public function update($table, array $data, array $criteria, array $types = []) */ public function insert($table, array $data, array $types = []) { - if (empty($data)) { + if (count($data) === 0) { return $this->executeStatement('INSERT INTO ' . $table . ' () VALUES ()'); } @@ -906,9 +760,10 @@ public function quoteIdentifier($str) } /** - * {@inheritDoc} - * + * @param mixed $value * @param int|string|Type|null $type + * + * @return mixed */ public function quote($value, $type = ParameterType::STRING) { @@ -919,45 +774,23 @@ public function quote($value, $type = ParameterType::STRING) return $connection->quote($value, $bindingType); } - /** - * Prepares and executes an SQL query and returns the result as an associative array. - * - * @deprecated Use fetchAllAssociative() - * - * @param string $sql The SQL query. - * @param mixed[] $params The query parameters. - * @param int[]|string[] $types The query parameter types. - * - * @return mixed[] - */ - public function fetchAll($sql, array $params = [], $types = []) - { - return $this->executeQuery($sql, $params, $types)->fetchAll(); - } - /** * Prepares and executes an SQL query and returns the result as an array of numeric arrays. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return array> + * @return list> * * @throws Exception */ public function fetchAllNumeric(string $query, array $params = [], array $types = []): array { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchAllNumeric(); - } - - return $stmt->fetchAll(FetchMode::NUMERIC); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchAllNumeric(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -965,25 +798,19 @@ public function fetchAllNumeric(string $query, array $params = [], array $types * Prepares and executes an SQL query and returns the result as an array of associative arrays. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return array> + * @return list> * * @throws Exception */ public function fetchAllAssociative(string $query, array $params = [], array $types = []): array { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchAllAssociative(); - } - - return $stmt->fetchAll(FetchMode::ASSOCIATIVE); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchAllAssociative(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -991,9 +818,9 @@ public function fetchAllAssociative(string $query, array $params = [], array $ty * Prepares and executes an SQL query and returns the result as an associative array with the keys * mapped to the first column and the values mapped to the second column. * - * @param string $query SQL query - * @param array|array $params Query parameters - * @param array|array $types Parameter types + * @param string $query SQL query + * @param list|array $params Query parameters + * @param array|array $types Parameter types * * @return array * @@ -1001,17 +828,7 @@ public function fetchAllAssociative(string $query, array $params = [], array $ty */ public function fetchAllKeyValue(string $query, array $params = [], array $types = []): array { - $stmt = $this->executeQuery($query, $params, $types); - - $this->ensureHasKeyValue($stmt); - - $data = []; - - foreach ($stmt->fetchAll(FetchMode::NUMERIC) as [$key, $value]) { - $data[$key] = $value; - } - - return $data; + return $this->executeQuery($query, $params, $types)->fetchAllKeyValue(); } /** @@ -1020,7 +837,7 @@ public function fetchAllKeyValue(string $query, array $params = [], array $types * and their values. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return array> @@ -1029,40 +846,26 @@ public function fetchAllKeyValue(string $query, array $params = [], array $types */ public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []): array { - $stmt = $this->executeQuery($query, $params, $types); - - $data = []; - - foreach ($stmt->fetchAll(FetchMode::ASSOCIATIVE) as $row) { - $data[array_shift($row)] = $row; - } - - return $data; + return $this->executeQuery($query, $params, $types)->fetchAllAssociativeIndexed(); } /** * Prepares and executes an SQL query and returns the result as an array of the first column values. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return array + * @return list * * @throws Exception */ public function fetchFirstColumn(string $query, array $params = [], array $types = []): array { try { - $stmt = $this->executeQuery($query, $params, $types); - - if ($stmt instanceof Result) { - return $stmt->fetchFirstColumn(); - } - - return $stmt->fetchAll(FetchMode::COLUMN); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + return $this->executeQuery($query, $params, $types)->fetchFirstColumn(); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -1070,27 +873,23 @@ public function fetchFirstColumn(string $query, array $params = [], array $types * Prepares and executes an SQL query and returns the result as an iterator over rows represented as numeric arrays. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return Traversable> + * @return Traversable> * * @throws Exception */ public function iterateNumeric(string $query, array $params = [], array $types = []): Traversable { try { - $stmt = $this->executeQuery($query, $params, $types); + $result = $this->executeQuery($query, $params, $types); - if ($stmt instanceof Result) { - yield from $stmt->iterateNumeric(); - } else { - while (($row = $stmt->fetch(FetchMode::NUMERIC)) !== false) { - yield $row; - } + while (($row = $result->fetchNumeric()) !== false) { + yield $row; } - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -1099,7 +898,7 @@ public function iterateNumeric(string $query, array $params = [], array $types = * as associative arrays. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return Traversable> @@ -1109,17 +908,13 @@ public function iterateNumeric(string $query, array $params = [], array $types = public function iterateAssociative(string $query, array $params = [], array $types = []): Traversable { try { - $stmt = $this->executeQuery($query, $params, $types); + $result = $this->executeQuery($query, $params, $types); - if ($stmt instanceof Result) { - yield from $stmt->iterateAssociative(); - } else { - while (($row = $stmt->fetch(FetchMode::ASSOCIATIVE)) !== false) { - yield $row; - } + while (($row = $result->fetchAssociative()) !== false) { + yield $row; } - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -1127,9 +922,9 @@ public function iterateAssociative(string $query, array $params = [], array $typ * Prepares and executes an SQL query and returns the result as an iterator with the keys * mapped to the first column and the values mapped to the second column. * - * @param string $query SQL query - * @param array|array $params Query parameters - * @param array|array $types Parameter types + * @param string $query SQL query + * @param list|array $params Query parameters + * @param array|array $types Parameter types * * @return Traversable * @@ -1137,13 +932,7 @@ public function iterateAssociative(string $query, array $params = [], array $typ */ public function iterateKeyValue(string $query, array $params = [], array $types = []): Traversable { - $stmt = $this->executeQuery($query, $params, $types); - - $this->ensureHasKeyValue($stmt); - - while (($row = $stmt->fetch(FetchMode::NUMERIC)) !== false) { - yield $row[0] => $row[1]; - } + return $this->executeQuery($query, $params, $types)->iterateKeyValue(); } /** @@ -1152,7 +941,7 @@ public function iterateKeyValue(string $query, array $params = [], array $types * and their values. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return Traversable> @@ -1161,18 +950,14 @@ public function iterateKeyValue(string $query, array $params = [], array $types */ public function iterateAssociativeIndexed(string $query, array $params = [], array $types = []): Traversable { - $stmt = $this->executeQuery($query, $params, $types); - - while (($row = $stmt->fetch(FetchMode::ASSOCIATIVE)) !== false) { - yield array_shift($row) => $row; - } + return $this->executeQuery($query, $params, $types)->iterateAssociativeIndexed(); } /** * Prepares and executes an SQL query and returns the result as an iterator over the first column values. * * @param string $query SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * * @return Traversable @@ -1182,17 +967,13 @@ public function iterateAssociativeIndexed(string $query, array $params = [], arr public function iterateColumn(string $query, array $params = [], array $types = []): Traversable { try { - $stmt = $this->executeQuery($query, $params, $types); + $result = $this->executeQuery($query, $params, $types); - if ($stmt instanceof Result) { - yield from $stmt->iterateColumn(); - } else { - while (($value = $stmt->fetch(FetchMode::COLUMN)) !== false) { - yield $value; - } + while (($value = $result->fetchOne()) !== false) { + yield $value; } - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $query, $params, $types); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $query, $params, $types); } } @@ -1201,21 +982,11 @@ public function iterateColumn(string $query, array $params = [], array $types = * * @param string $sql The SQL statement to prepare. * - * @return Statement The prepared statement. - * * @throws Exception */ - public function prepare($sql) + public function prepare(string $sql): Statement { - try { - $stmt = new Statement($sql, $this); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $sql); - } - - $stmt->setFetchMode($this->defaultFetchMode); - - return $stmt; + return new Statement($sql, $this); } /** @@ -1225,15 +996,17 @@ public function prepare($sql) * If an SQLLogger is configured, the execution is logged. * * @param string $sql SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return ResultStatement The executed statement. - * * @throws Exception */ - public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null) - { + public function executeQuery( + string $sql, + array $params = [], + $types = [], + ?QueryCacheProfile $qcp = null + ): Result { if ($qcp !== null) { return $this->executeCacheQuery($sql, $params, $types, $qcp); } @@ -1241,54 +1014,48 @@ public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheP $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); - if ($logger) { + if ($logger !== null) { $logger->startQuery($sql, $params, $types); } try { - if ($params) { - [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); + if (count($params) > 0) { + if ($this->needsArrayParameterConversion($params, $types)) { + [$sql, $params, $types] = $this->expandArrayParameters($sql, $params, $types); + } $stmt = $connection->prepare($sql); - if ($types) { + if (count($types) > 0) { $this->_bindTypedValues($stmt, $params, $types); - $stmt->execute(); + $result = $stmt->execute(); } else { - $stmt->execute($params); + $result = $stmt->execute($params); } } else { - $stmt = $connection->query($sql); + $result = $connection->query($sql); } - } catch (Throwable $e) { - $this->handleExceptionDuringQuery( - $e, - $sql, - $params, - $types - ); - } - - $stmt->setFetchMode($this->defaultFetchMode); - if ($logger) { - $logger->stopQuery(); + return new Result($result, $this); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $sql, $params, $types); + } finally { + if ($logger !== null) { + $logger->stopQuery(); + } } - - return $stmt; } /** * Executes a caching query. * * @param string $sql SQL query - * @param array|array $params Query parameters + * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return ResultStatement - * * @throws CacheException + * @throws Exception */ - public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) + public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp): Result { $resultCache = $qcp->getResultCacheDriver() ?? $this->_config->getResultCacheImpl(); @@ -1307,14 +1074,14 @@ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) if ($data !== false) { // is the real key part of this row pointers map or is the cache only pointing to other cache keys? if (isset($data[$realKey])) { - $stmt = new ArrayStatement($data[$realKey]); + $result = new ArrayResult($data[$realKey]); } elseif (array_key_exists($realKey, $data)) { - $stmt = new ArrayStatement([]); + $result = new ArrayResult([]); } } - if (! isset($stmt)) { - $stmt = new ResultCacheStatement( + if (! isset($result)) { + $result = new CachingResult( $this->executeQuery($sql, $params, $types), $resultCache, $cacheKey, @@ -1323,93 +1090,7 @@ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) ); } - $stmt->setFetchMode($this->defaultFetchMode); - - return $stmt; - } - - /** - * Executes an, optionally parametrized, SQL query and returns the result, - * applying a given projection/transformation function on each row of the result. - * - * @deprecated - * - * @param string $sql The SQL query to execute. - * @param mixed[] $params The parameters, if any. - * @param Closure $function The transformation function that is applied on each row. - * The function receives a single parameter, an array, that - * represents a row of the result set. - * - * @return mixed[] The projected result of the query. - */ - public function project($sql, array $params, Closure $function) - { - $result = []; - $stmt = $this->executeQuery($sql, $params); - - while ($row = $stmt->fetch()) { - $result[] = $function($row); - } - - $stmt->closeCursor(); - - return $result; - } - - /** - * Executes an SQL statement, returning a result set as a Statement object. - * - * @deprecated Use {@link executeQuery()} instead. - * - * @return \Doctrine\DBAL\Driver\Statement - * - * @throws Exception - */ - public function query() - { - $connection = $this->getWrappedConnection(); - - $args = func_get_args(); - - $logger = $this->_config->getSQLLogger(); - if ($logger) { - $logger->startQuery($args[0]); - } - - try { - $statement = $connection->query(...$args); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $args[0]); - } - - $statement->setFetchMode($this->defaultFetchMode); - - if ($logger) { - $logger->stopQuery(); - } - - return $statement; - } - - /** - * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters - * and returns the number of affected rows. - * - * This method supports PDO binding types as well as DBAL mapping types. - * - * @deprecated Use {@link executeStatement()} instead. - * - * @param string $sql SQL statement - * @param array|array $params Statement parameters - * @param array|array $types Parameter types - * - * @return int The number of affected rows. - * - * @throws Exception - */ - public function executeUpdate($sql, array $params = [], array $types = []) - { - return $this->executeStatement($sql, $params, $types); + return new Result($result, $this); } /** @@ -1425,7 +1106,7 @@ public function executeUpdate($sql, array $params = [], array $types = []) * This method supports PDO binding types as well as DBAL mapping types. * * @param string $sql SQL statement - * @param array|array $params Statement parameters + * @param list|array $params Statement parameters * @param array|array $types Parameter types * * @return int The number of affected rows. @@ -1437,74 +1118,37 @@ public function executeStatement($sql, array $params = [], array $types = []) $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); - if ($logger) { + if ($logger !== null) { $logger->startQuery($sql, $params, $types); } try { - if ($params) { - [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); + if (count($params) > 0) { + if ($this->needsArrayParameterConversion($params, $types)) { + [$sql, $params, $types] = $this->expandArrayParameters($sql, $params, $types); + } $stmt = $connection->prepare($sql); - if ($types) { + if (count($types) > 0) { $this->_bindTypedValues($stmt, $params, $types); - $stmt->execute(); + + $result = $stmt->execute(); } else { - $stmt->execute($params); + $result = $stmt->execute($params); } - $result = $stmt->rowCount(); - } else { - $result = $connection->exec($sql); + return $result->rowCount(); } - } catch (Throwable $e) { - $this->handleExceptionDuringQuery( - $e, - $sql, - $params, - $types - ); - } - if ($logger) { - $logger->stopQuery(); - } - - return $result; - } - - /** - * Executes an SQL statement and return the number of affected rows. - * - * @deprecated Use {@link executeStatement()} instead. - * - * @param string $sql - * - * @return int The number of affected rows. - * - * @throws Exception - */ - public function exec($sql) - { - $connection = $this->getWrappedConnection(); - - $logger = $this->_config->getSQLLogger(); - if ($logger) { - $logger->startQuery($sql); - } - - try { - $result = $connection->exec($sql); - } catch (Throwable $e) { - $this->handleExceptionDuringQuery($e, $sql); - } - - if ($logger) { - $logger->stopQuery(); + return $connection->exec($sql); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $sql, $params, $types); + } finally { + if ($logger !== null) { + $logger->stopQuery(); + } } - - return $result; } /** @@ -1517,28 +1161,6 @@ public function getTransactionNestingLevel() return $this->transactionNestingLevel; } - /** - * Fetches the SQLSTATE associated with the last database operation. - * - * @deprecated The error information is available via exceptions. - * - * @return string|null The last error code. - */ - public function errorCode() - { - return $this->getWrappedConnection()->errorCode(); - } - - /** - * {@inheritDoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return $this->getWrappedConnection()->errorInfo(); - } - /** * Returns the ID of the last inserted row, or the last value from a sequence object, * depending on the underlying driver. @@ -1550,10 +1172,16 @@ public function errorInfo() * @param string|null $name Name of the sequence object from which the ID should be returned. * * @return string A string representation of the last inserted ID. + * + * @throws Exception */ public function lastInsertId($name = null) { - return $this->getWrappedConnection()->lastInsertId($name); + try { + return $this->getWrappedConnection()->lastInsertId($name); + } catch (Driver\Exception $e) { + throw $this->convertException($e); + } } /** @@ -1592,7 +1220,7 @@ public function transactional(Closure $func) * * @return void * - * @throws ConnectionException + * @throws Exception */ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) { @@ -1629,7 +1257,9 @@ protected function _getNestedTransactionSavePointName() } /** - * {@inheritDoc} + * @return bool + * + * @throws Exception */ public function beginTransaction() { @@ -1640,22 +1270,22 @@ public function beginTransaction() $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"START TRANSACTION"'); } $connection->beginTransaction(); - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"SAVEPOINT"'); } $this->createSavepoint($this->_getNestedTransactionSavePointName()); - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } } @@ -1664,10 +1294,9 @@ public function beginTransaction() } /** - * {@inheritDoc} + * @return bool * - * @throws ConnectionException If the commit failed due to no active transaction or - * because the transaction was marked for rollback only. + * @throws Exception */ public function commit() { @@ -1686,22 +1315,22 @@ public function commit() $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"COMMIT"'); } $result = $connection->commit(); - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"RELEASE SAVEPOINT"'); } $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } } @@ -1719,6 +1348,8 @@ public function commit() /** * Commits all current nesting transactions. + * + * @throws Exception */ private function commitAll(): void { @@ -1740,7 +1371,7 @@ private function commitAll(): void * * @return bool * - * @throws ConnectionException If the rollback operation failed. + * @throws Exception */ public function rollBack() { @@ -1753,14 +1384,14 @@ public function rollBack() $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"ROLLBACK"'); } $this->transactionNestingLevel = 0; $connection->rollBack(); $this->isRollbackOnly = false; - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } @@ -1768,13 +1399,13 @@ public function rollBack() $this->beginTransaction(); } } elseif ($this->nestTransactionsWithSavepoints) { - if ($logger) { + if ($logger !== null) { $logger->startQuery('"ROLLBACK TO SAVEPOINT"'); } $this->rollbackSavepoint($this->_getNestedTransactionSavePointName()); --$this->transactionNestingLevel; - if ($logger) { + if ($logger !== null) { $logger->stopQuery(); } } else { @@ -1792,7 +1423,7 @@ public function rollBack() * * @return void * - * @throws ConnectionException + * @throws Exception */ public function createSavepoint($savepoint) { @@ -1800,7 +1431,7 @@ public function createSavepoint($savepoint) throw ConnectionException::savepointsNotSupported(); } - $this->getWrappedConnection()->exec($this->platform->createSavePoint($savepoint)); + $this->executeStatement($this->platform->createSavePoint($savepoint)); } /** @@ -1810,7 +1441,7 @@ public function createSavepoint($savepoint) * * @return void * - * @throws ConnectionException + * @throws Exception */ public function releaseSavepoint($savepoint) { @@ -1822,7 +1453,7 @@ public function releaseSavepoint($savepoint) return; } - $this->getWrappedConnection()->exec($this->platform->releaseSavePoint($savepoint)); + $this->executeStatement($this->platform->releaseSavePoint($savepoint)); } /** @@ -1832,7 +1463,7 @@ public function releaseSavepoint($savepoint) * * @return void * - * @throws ConnectionException + * @throws Exception */ public function rollbackSavepoint($savepoint) { @@ -1840,13 +1471,15 @@ public function rollbackSavepoint($savepoint) throw ConnectionException::savepointsNotSupported(); } - $this->getWrappedConnection()->exec($this->platform->rollbackSavePoint($savepoint)); + $this->executeStatement($this->platform->rollbackSavePoint($savepoint)); } /** * Gets the wrapped driver connection. * * @return DriverConnection + * + * @throws Exception */ public function getWrappedConnection() { @@ -1862,11 +1495,16 @@ public function getWrappedConnection() * database schema through the connection. * * @return AbstractSchemaManager + * + * @throws Exception */ public function getSchemaManager() { if ($this->_schemaManager === null) { - $this->_schemaManager = $this->_driver->getSchemaManager($this); + $this->_schemaManager = $this->_driver->getSchemaManager( + $this, + $this->getDatabasePlatform() + ); } return $this->_schemaManager; @@ -1913,6 +1551,8 @@ public function isRollbackOnly() * @param string $type The name of the DBAL mapping type. * * @return mixed The converted value. + * + * @throws Exception */ public function convertToDatabaseValue($value, $type) { @@ -1927,6 +1567,8 @@ public function convertToDatabaseValue($value, $type) * @param string $type The name of the DBAL mapping type. * * @return mixed The converted type. + * + * @throws Exception */ public function convertToPHPValue($value, $type) { @@ -1937,26 +1579,21 @@ public function convertToPHPValue($value, $type) * Binds a set of parameters, some or all of which are typed with a PDO binding type * or DBAL mapping type, to a given statement. * - * @internal Duck-typing used on the $stmt parameter to support driver statements as well as - * raw PDOStatement instances. - * - * @param \Doctrine\DBAL\Driver\Statement $stmt Prepared statement - * @param array|array $params Statement parameters + * @param DriverStatement $stmt Prepared statement + * @param list|array $params Statement parameters * @param array|array $types Parameter types * - * @return void + * @throws Exception */ - private function _bindTypedValues($stmt, array $params, array $types) + private function _bindTypedValues(DriverStatement $stmt, array $params, array $types): void { - // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO. + // Check whether parameters are positional or named. Mixing is not allowed. if (is_int(key($params))) { - // Positional parameters - $typeOffset = array_key_exists(0, $types) ? -1 : 0; - $bindIndex = 1; - foreach ($params as $value) { - $typeIndex = $bindIndex + $typeOffset; - if (isset($types[$typeIndex])) { - $type = $types[$typeIndex]; + $bindIndex = 1; + + foreach ($params as $key => $value) { + if (isset($types[$key])) { + $type = $types[$key]; [$value, $bindingType] = $this->getBindingInfo($value, $type); $stmt->bindValue($bindIndex, $value, $bindingType); } else { @@ -1980,12 +1617,14 @@ private function _bindTypedValues($stmt, array $params, array $types) } /** - * Gets the binding type of a given type. The given type can be a PDO or DBAL mapping type. + * Gets the binding type of a given type. * * @param mixed $value The value to bind. * @param int|string|Type|null $type The type to bind (PDO or DBAL). * * @return mixed[] [0] => the (escaped) value, [1] => the binding type. + * + * @throws Exception */ private function getBindingInfo($value, $type) { @@ -2004,164 +1643,127 @@ private function getBindingInfo($value, $type) } /** - * Resolves the parameters to a format which can be displayed. - * - * @internal This is a purely internal method. If you rely on this method, you are advised to - * copy/paste the code as this method may change, or be removed without prior notice. - * - * @param array|array $params Query parameters - * @param array|array $types Parameter types + * Creates a new instance of a SQL query builder. * - * @return array|array + * @return QueryBuilder */ - public function resolveParams(array $params, array $types) + public function createQueryBuilder() { - $resolvedParams = []; - - // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO. - if (is_int(key($params))) { - // Positional parameters - $typeOffset = array_key_exists(0, $types) ? -1 : 0; - $bindIndex = 1; - foreach ($params as $value) { - $typeIndex = $bindIndex + $typeOffset; - if (isset($types[$typeIndex])) { - $type = $types[$typeIndex]; - [$value] = $this->getBindingInfo($value, $type); - $resolvedParams[$bindIndex] = $value; - } else { - $resolvedParams[$bindIndex] = $value; - } - - ++$bindIndex; - } - } else { - // Named parameters - foreach ($params as $name => $value) { - if (isset($types[$name])) { - $type = $types[$name]; - [$value] = $this->getBindingInfo($value, $type); - $resolvedParams[$name] = $value; - } else { - $resolvedParams[$name] = $value; - } - } - } - - return $resolvedParams; + return new Query\QueryBuilder($this); } /** - * Creates a new instance of a SQL query builder. + * @internal * - * @return QueryBuilder + * @param list|array $params + * @param array|array $types */ - public function createQueryBuilder() + final public function convertExceptionDuringQuery( + Driver\Exception $e, + string $sql, + array $params = [], + array $types = [] + ): DriverException { + return $this->handleDriverException($e, new Query($sql, $params, $types)); + } + + /** + * @internal + */ + final public function convertException(Driver\Exception $e): DriverException { - return new Query\QueryBuilder($this); + return $this->handleDriverException($e, null); } /** - * Ping the server - * - * When the server is not available the method returns FALSE. - * It is responsibility of the developer to handle this case - * and abort the request or reconnect manually: - * - * @deprecated - * - * @return bool - * - * @example - * - * if ($conn->ping() === false) { - * $conn->close(); - * $conn->connect(); - * } + * @param array|array $params + * @param array|array $types * - * It is undefined if the underlying driver attempts to reconnect - * or disconnect when the connection is not available anymore - * as long it returns TRUE when a reconnect succeeded and - * FALSE when the connection was dropped. + * @return array{string, list, array} */ - public function ping() + private function expandArrayParameters(string $sql, array $params, array $types): array { - $connection = $this->getWrappedConnection(); - - if ($connection instanceof PingableConnection) { - return $connection->ping(); + if ($this->parser === null) { + $this->parser = $this->getDatabasePlatform()->createSQLParser(); } - try { - $this->query($this->getDatabasePlatform()->getDummySelectSQL()); + $visitor = new ExpandArrayParameters($params, $types); - return true; - } catch (DBALException $e) { - return false; - } + $this->parser->parse($sql, $visitor); + + return [ + $visitor->getSQL(), + $visitor->getParameters(), + $visitor->getTypes(), + ]; } /** - * @internal - * * @param array|array $params * @param array|array $types - * - * @throws Exception - * - * @psalm-return never-return */ - public function handleExceptionDuringQuery(Throwable $e, string $sql, array $params = [], array $types = []): void + private function needsArrayParameterConversion(array $params, array $types): bool { - $this->throw( - Exception::driverExceptionDuringQuery( - $this->_driver, - $e, - $sql, - $this->resolveParams($params, $types) - ) - ); + if (is_string(key($params))) { + return true; + } + + foreach ($types as $type) { + if ($type === self::PARAM_INT_ARRAY || $type === self::PARAM_STR_ARRAY) { + return true; + } + } + + return false; + } + + private function handleDriverException( + Driver\Exception $driverException, + ?Query $query + ): DriverException { + if ($this->exceptionConverter === null) { + $this->exceptionConverter = $this->_driver->getExceptionConverter(); + } + + $exception = $this->exceptionConverter->convert($driverException, $query); + + if ($exception instanceof ConnectionLost) { + $this->close(); + } + + return $exception; } /** - * @internal + * BC layer for a wide-spread use-case of old DBAL APIs * - * @throws Exception + * @deprecated This API is deprecated and will be removed after 2022 * - * @psalm-return never-return + * @param array $params The query parameters + * @param array $types The parameter types */ - public function handleDriverException(Throwable $e): void + public function executeUpdate(string $sql, array $params = [], array $types = []): int { - $this->throw( - Exception::driverException( - $this->_driver, - $e - ) - ); + return $this->executeStatement($sql, $params, $types); } /** - * @internal + * BC layer for a wide-spread use-case of old DBAL APIs * - * @throws Exception - * - * @psalm-return never-return + * @deprecated This API is deprecated and will be removed after 2022 */ - private function throw(Exception $e): void + public function query(string $sql): Result { - if ($e instanceof ConnectionLost) { - $this->close(); - } - - throw $e; + return $this->executeQuery($sql); } - private function ensureHasKeyValue(ResultStatement $stmt): void + /** + * BC layer for a wide-spread use-case of old DBAL APIs + * + * @deprecated This API is deprecated and will be removed after 2022 + */ + public function exec(string $sql): int { - $columnCount = $stmt->columnCount(); - - if ($columnCount < 2) { - throw NoKeyValue::fromColumnCount($columnCount); - } + return $this->executeStatement($sql); } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php b/doctrine/dbal/src/ConnectionException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php rename to doctrine/dbal/src/ConnectionException.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Connections/PrimaryReadReplicaConnection.php b/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php similarity index 80% rename from doctrine/dbal/lib/Doctrine/DBAL/Connections/PrimaryReadReplicaConnection.php rename to doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php index 81f4accfd..8d52d8595 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Connections/PrimaryReadReplicaConnection.php +++ b/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php @@ -7,14 +7,15 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\Connection as DriverConnection; +use Doctrine\DBAL\Driver\Exception as DriverException; use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Events; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Statement; use InvalidArgumentException; use function array_rand; -use function assert; use function count; -use function func_get_args; /** * Primary-Replica Connection @@ -26,9 +27,8 @@ * * 1. Replica if primary was never picked before and ONLY if 'getWrappedConnection' * or 'executeQuery' is used. - * 2. Primary picked when 'exec', 'executeUpdate', 'executeStatement', 'insert', 'delete', 'update', 'createSavepoint', - * 'releaseSavepoint', 'beginTransaction', 'rollback', 'commit', 'query' or - * 'prepare' is called. + * 2. Primary picked when 'executeStatement', 'insert', 'delete', 'update', 'createSavepoint', + * 'releaseSavepoint', 'beginTransaction', 'rollback', 'commit' or 'prepare' is called. * 3. If Primary was picked once during the lifetime of the connection it will always get picked afterwards. * 4. One replica connection is randomly picked ONCE during a request. * @@ -95,6 +95,7 @@ class PrimaryReadReplicaConnection extends Connection * * @param mixed[] $params * + * @throws Exception * @throws InvalidArgumentException */ public function __construct( @@ -149,7 +150,7 @@ public function connect($connectionName = null) protected function performConnect(?string $connectionName = null): bool { $requestedConnectionChange = ($connectionName !== null); - $connectionName = $connectionName ?: 'replica'; + $connectionName = $connectionName ?? 'replica'; if ($connectionName !== 'replica' && $connectionName !== 'primary') { throw new InvalidArgumentException('Invalid option to connect(), only primary or replica allowed.'); @@ -226,19 +227,20 @@ public function ensureConnectedToReplica(): bool * @param string $connectionName * * @return DriverConnection + * + * @throws Exception */ protected function connectTo($connectionName) { $params = $this->getParams(); - $driverOptions = $params['driverOptions'] ?? []; - $connectionParams = $this->chooseConnectionConfiguration($connectionName, $params); - $user = $connectionParams['user'] ?? null; - $password = $connectionParams['password'] ?? null; - - return $this->_driver->connect($connectionParams, $user, $password, $driverOptions); + try { + return $this->_driver->connect($connectionParams); + } catch (DriverException $e) { + throw $this->convertException($e); + } } /** @@ -262,18 +264,6 @@ protected function chooseConnectionConfiguration($connectionName, $params) return $config; } - /** - * {@inheritDoc} - * - * @deprecated Use {@link executeStatement()} instead. - */ - public function executeUpdate($sql, array $params = [], array $types = []) - { - $this->ensureConnectedToPrimary(); - - return parent::executeUpdate($sql, $params, $types); - } - /** * {@inheritDoc} */ @@ -314,16 +304,6 @@ public function rollBack() return parent::rollBack(); } - /** - * {@inheritDoc} - */ - public function delete($table, array $criteria, array $types = []) - { - $this->ensureConnectedToPrimary(); - - return parent::delete($table, $criteria, $types); - } - /** * {@inheritDoc} */ @@ -337,36 +317,6 @@ public function close() $this->connections = ['primary' => null, 'replica' => null]; } - /** - * {@inheritDoc} - */ - public function update($table, array $data, array $criteria, array $types = []) - { - $this->ensureConnectedToPrimary(); - - return parent::update($table, $data, $criteria, $types); - } - - /** - * {@inheritDoc} - */ - public function insert($table, array $data, array $types = []) - { - $this->ensureConnectedToPrimary(); - - return parent::insert($table, $data, $types); - } - - /** - * {@inheritDoc} - */ - public function exec($statement) - { - $this->ensureConnectedToPrimary(); - - return parent::exec($statement); - } - /** * {@inheritDoc} */ @@ -397,39 +347,10 @@ public function rollbackSavepoint($savepoint) parent::rollbackSavepoint($savepoint); } - /** - * {@inheritDoc} - */ - public function query() - { - $this->ensureConnectedToPrimary(); - assert($this->_conn instanceof DriverConnection); - - $args = func_get_args(); - - $logger = $this->getConfiguration()->getSQLLogger(); - if ($logger) { - $logger->startQuery($args[0]); - } - - $statement = $this->_conn->query(...$args); - - $statement->setFetchMode($this->defaultFetchMode); - - if ($logger) { - $logger->stopQuery(); - } - - return $statement; - } - - /** - * {@inheritDoc} - */ - public function prepare($statement) + public function prepare(string $sql): Statement { $this->ensureConnectedToPrimary(); - return parent::prepare($statement); + return parent::prepare($sql); } } diff --git a/doctrine/dbal/src/Driver.php b/doctrine/dbal/src/Driver.php new file mode 100644 index 000000000..50a6005f9 --- /dev/null +++ b/doctrine/dbal/src/Driver.php @@ -0,0 +1,48 @@ +getCode()) { + case 1213: + return new DeadlockException($exception, $query); + + case 1205: + return new LockWaitTimeoutException($exception, $query); + + case 1050: + return new TableExistsException($exception, $query); + + case 1051: + case 1146: + return new TableNotFoundException($exception, $query); + + case 1216: + case 1217: + case 1451: + case 1452: + case 1701: + return new ForeignKeyConstraintViolationException($exception, $query); + + case 1062: + case 1557: + case 1569: + case 1586: + return new UniqueConstraintViolationException($exception, $query); + + case 1054: + case 1166: + case 1611: + return new InvalidFieldNameException($exception, $query); + + case 1052: + case 1060: + case 1110: + return new NonUniqueFieldNameException($exception, $query); + + case 1064: + case 1149: + case 1287: + case 1341: + case 1342: + case 1343: + case 1344: + case 1382: + case 1479: + case 1541: + case 1554: + case 1626: + return new SyntaxErrorException($exception, $query); + + case 1044: + case 1045: + case 1046: + case 1049: + case 1095: + case 1142: + case 1143: + case 1227: + case 1370: + case 1429: + case 2002: + case 2005: + return new ConnectionException($exception, $query); + + case 2006: + return new ConnectionLost($exception, $query); + + case 1048: + case 1121: + case 1138: + case 1171: + case 1252: + case 1263: + case 1364: + case 1566: + return new NotNullConstraintViolationException($exception, $query); + } + + return new DriverException($exception, $query); + } +} diff --git a/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php new file mode 100644 index 000000000..f25e58d6c --- /dev/null +++ b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php @@ -0,0 +1,68 @@ +getCode()) { + case 1: + case 2299: + case 38911: + return new UniqueConstraintViolationException($exception, $query); + + case 904: + return new InvalidFieldNameException($exception, $query); + + case 918: + case 960: + return new NonUniqueFieldNameException($exception, $query); + + case 923: + return new SyntaxErrorException($exception, $query); + + case 942: + return new TableNotFoundException($exception, $query); + + case 955: + return new TableExistsException($exception, $query); + + case 1017: + case 12545: + return new ConnectionException($exception, $query); + + case 1400: + return new NotNullConstraintViolationException($exception, $query); + + case 2266: + case 2291: + case 2292: + return new ForeignKeyConstraintViolationException($exception, $query); + } + + return new DriverException($exception, $query); + } +} diff --git a/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php new file mode 100644 index 000000000..b9530d0b2 --- /dev/null +++ b/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php @@ -0,0 +1,85 @@ +getSQLState()) { + case '40001': + case '40P01': + return new DeadlockException($exception, $query); + + case '0A000': + // Foreign key constraint violations during a TRUNCATE operation + // are considered "feature not supported" in PostgreSQL. + if (strpos($exception->getMessage(), 'truncate') !== false) { + return new ForeignKeyConstraintViolationException($exception, $query); + } + + break; + + case '23502': + return new NotNullConstraintViolationException($exception, $query); + + case '23503': + return new ForeignKeyConstraintViolationException($exception, $query); + + case '23505': + return new UniqueConstraintViolationException($exception, $query); + + case '42601': + return new SyntaxErrorException($exception, $query); + + case '42702': + return new NonUniqueFieldNameException($exception, $query); + + case '42703': + return new InvalidFieldNameException($exception, $query); + + case '42P01': + return new TableNotFoundException($exception, $query); + + case '42P07': + return new TableExistsException($exception, $query); + + case '08006': + return new ConnectionException($exception, $query); + } + + // Prior to fixing https://bugs.php.net/bug.php?id=64705 (PHP 7.3.22 and PHP 7.4.10), + // in some cases (mainly connection errors) the PDO exception wouldn't provide a SQLSTATE via its code. + // We have to match against the SQLSTATE in the error message in these cases. + if ($exception->getCode() === 7 && strpos($exception->getMessage(), 'SQLSTATE[08006]') !== false) { + return new ConnectionException($exception, $query); + } + + return new DriverException($exception, $query); + } +} diff --git a/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php new file mode 100644 index 000000000..3fc3ff081 --- /dev/null +++ b/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php @@ -0,0 +1,21 @@ +getMessage(), 'database is locked') !== false) { - return new LockWaitTimeoutException($message, $exception); + return new LockWaitTimeoutException($exception, $query); } if ( @@ -45,72 +41,44 @@ public function convertException($message, DeprecatedDriverException $exception) strpos($exception->getMessage(), 'are not unique') !== false || strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false ) { - return new UniqueConstraintViolationException($message, $exception); + return new UniqueConstraintViolationException($exception, $query); } if ( strpos($exception->getMessage(), 'may not be NULL') !== false || strpos($exception->getMessage(), 'NOT NULL constraint failed') !== false ) { - return new NotNullConstraintViolationException($message, $exception); + return new NotNullConstraintViolationException($exception, $query); } if (strpos($exception->getMessage(), 'no such table:') !== false) { - return new TableNotFoundException($message, $exception); + return new TableNotFoundException($exception, $query); } if (strpos($exception->getMessage(), 'already exists') !== false) { - return new TableExistsException($message, $exception); + return new TableExistsException($exception, $query); } if (strpos($exception->getMessage(), 'has no column named') !== false) { - return new InvalidFieldNameException($message, $exception); + return new InvalidFieldNameException($exception, $query); } if (strpos($exception->getMessage(), 'ambiguous column name') !== false) { - return new NonUniqueFieldNameException($message, $exception); + return new NonUniqueFieldNameException($exception, $query); } if (strpos($exception->getMessage(), 'syntax error') !== false) { - return new SyntaxErrorException($message, $exception); + return new SyntaxErrorException($exception, $query); } if (strpos($exception->getMessage(), 'attempt to write a readonly database') !== false) { - return new ReadOnlyException($message, $exception); + return new ReadOnlyException($exception, $query); } if (strpos($exception->getMessage(), 'unable to open database file') !== false) { - return new ConnectionException($message, $exception); + return new ConnectionException($exception, $query); } - return new DriverException($message, $exception); - } - - /** - * {@inheritdoc} - * - * @deprecated Use Connection::getDatabase() instead. - */ - public function getDatabase(Connection $conn) - { - $params = $conn->getParams(); - - return $params['path'] ?? null; - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform() - { - return new SqlitePlatform(); - } - - /** - * {@inheritdoc} - */ - public function getSchemaManager(Connection $conn) - { - return new SqliteSchemaManager($conn); + return new DriverException($exception, $query); } } diff --git a/doctrine/dbal/src/Driver/AbstractDB2Driver.php b/doctrine/dbal/src/Driver/AbstractDB2Driver.php new file mode 100644 index 000000000..d8c707bb0 --- /dev/null +++ b/doctrine/dbal/src/Driver/AbstractDB2Driver.php @@ -0,0 +1,38 @@ +sqlState = $sqlState; + } + + /** + * {@inheritdoc} + */ + public function getSQLState() + { + return $this->sqlState; + } +} diff --git a/doctrine/dbal/src/Driver/AbstractMySQLDriver.php b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php new file mode 100644 index 000000000..31949b9c1 --- /dev/null +++ b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php @@ -0,0 +1,136 @@ +getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) { + return new MariaDb1027Platform(); + } + + if (! $mariadb) { + $oracleMysqlVersion = $this->getOracleMysqlVersionNumber($version); + if (version_compare($oracleMysqlVersion, '8', '>=')) { + return new MySQL80Platform(); + } + + if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) { + return new MySQL57Platform(); + } + } + + return $this->getDatabasePlatform(); + } + + /** + * Get a normalized 'version number' from the server string + * returned by Oracle MySQL servers. + * + * @param string $versionString Version string returned by the driver, i.e. '5.7.10' + * + * @throws Exception + */ + private function getOracleMysqlVersionNumber(string $versionString): string + { + if ( + preg_match( + '/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', + $versionString, + $versionParts + ) === 0 + ) { + throw Exception::invalidPlatformVersionSpecified( + $versionString, + '..' + ); + } + + $majorVersion = $versionParts['major']; + $minorVersion = $versionParts['minor'] ?? 0; + $patchVersion = $versionParts['patch'] ?? null; + + if ($majorVersion === '5' && $minorVersion === '7' && $patchVersion === null) { + $patchVersion = '9'; + } + + return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; + } + + /** + * Detect MariaDB server version, including hack for some mariadb distributions + * that starts with the prefix '5.5.5-' + * + * @param string $versionString Version string as returned by mariadb server, i.e. '5.5.5-Mariadb-10.0.8-xenial' + * + * @throws Exception + */ + private function getMariaDbMysqlVersionNumber(string $versionString): string + { + if ( + preg_match( + '/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', + $versionString, + $versionParts + ) === 0 + ) { + throw Exception::invalidPlatformVersionSpecified( + $versionString, + '^(?:5\.5\.5-)?(mariadb-)?..' + ); + } + + return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; + } + + /** + * {@inheritdoc} + * + * @return MySQLPlatform + */ + public function getDatabasePlatform() + { + return new MySQLPlatform(); + } + + /** + * {@inheritdoc} + * + * @return MySQLSchemaManager + */ + public function getSchemaManager(Connection $conn, AbstractPlatform $platform) + { + return new MySQLSchemaManager($conn, $platform); + } + + public function getExceptionConverter(): ExceptionConverter + { + return new MySQL\ExceptionConverter(); + } +} diff --git a/doctrine/dbal/src/Driver/AbstractOracleDriver.php b/doctrine/dbal/src/Driver/AbstractOracleDriver.php new file mode 100644 index 000000000..80e4a02c8 --- /dev/null +++ b/doctrine/dbal/src/Driver/AbstractOracleDriver.php @@ -0,0 +1,51 @@ +\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', $version, $versionParts) === 0) { + throw Exception::invalidPlatformVersionSpecified( + $version, + '..' + ); + } + + $majorVersion = $versionParts['major']; + $minorVersion = $versionParts['minor'] ?? 0; + $patchVersion = $versionParts['patch'] ?? 0; + $version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion; + + if (version_compare($version, '10.0', '>=')) { + return new PostgreSQL100Platform(); + } + + return new PostgreSQL94Platform(); + } + + /** + * {@inheritdoc} + */ + public function getDatabasePlatform() + { + return new PostgreSQL94Platform(); + } + + /** + * {@inheritdoc} + */ + public function getSchemaManager(Connection $conn, AbstractPlatform $platform) + { + return new PostgreSQLSchemaManager($conn, $platform); + } + + public function getExceptionConverter(): ExceptionConverter + { + return new PostgreSQL\ExceptionConverter(); + } +} diff --git a/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php b/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php new file mode 100644 index 000000000..b3d0928bb --- /dev/null +++ b/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php @@ -0,0 +1,38 @@ +> + * @return list> * * @throws Exception */ @@ -42,7 +42,7 @@ public static function fetchAllNumeric(Result $result): array } /** - * @return array> + * @return list> * * @throws Exception */ @@ -58,7 +58,7 @@ public static function fetchAllAssociative(Result $result): array } /** - * @return array + * @return list * * @throws Exception */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php b/doctrine/dbal/src/Driver/IBMDB2/Connection.php similarity index 62% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php rename to doctrine/dbal/src/Driver/IBMDB2/Connection.php index bdc52551f..c8e36da3e 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Connection.php @@ -2,19 +2,19 @@ namespace Doctrine\DBAL\Driver\IBMDB2; -use Doctrine\DBAL\Driver\Connection as ConnectionInterface; +use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionError; use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionFailed; use Doctrine\DBAL\Driver\IBMDB2\Exception\PrepareFailed; +use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; +use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; use stdClass; use function assert; use function db2_autocommit; use function db2_commit; -use function db2_conn_error; -use function db2_conn_errormsg; use function db2_connect; use function db2_escape_string; use function db2_exec; @@ -25,16 +25,12 @@ use function db2_rollback; use function db2_server_info; use function error_get_last; -use function func_get_args; use function is_bool; use const DB2_AUTOCOMMIT_OFF; use const DB2_AUTOCOMMIT_ON; -/** - * @deprecated Use {@link Connection} instead - */ -class DB2Connection implements ConnectionInterface, ServerInfoAwareConnection +final class Connection implements ServerInfoAwareConnection { /** @var resource */ private $conn; @@ -42,21 +38,21 @@ class DB2Connection implements ConnectionInterface, ServerInfoAwareConnection /** * @internal The connection can be only instantiated by its driver. * - * @param mixed[] $params - * @param string $username - * @param string $password - * @param mixed[] $driverOptions + * @param array $driverOptions * - * @throws DB2Exception + * @throws Exception */ - public function __construct(array $params, $username, $password, $driverOptions = []) - { - $isPersistent = (isset($params['persistent']) && $params['persistent'] === true); - - if ($isPersistent) { - $conn = db2_pconnect($params['dbname'], $username, $password, $driverOptions); + public function __construct( + string $database, + bool $persistent, + string $username, + string $password, + array $driverOptions = [] + ) { + if ($persistent) { + $conn = db2_pconnect($database, $username, $password, $driverOptions); } else { - $conn = db2_connect($params['dbname'], $username, $password, $driverOptions); + $conn = db2_connect($database, $username, $password, $driverOptions); } if ($conn === false) { @@ -77,18 +73,7 @@ public function getServerVersion() return $serverInfo->DBMS_VER; } - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function prepare($sql) + public function prepare(string $sql): DriverStatement { $stmt = @db2_prepare($this->conn, $sql); @@ -99,17 +84,9 @@ public function prepare($sql) return new Statement($stmt); } - /** - * {@inheritdoc} - */ - public function query() + public function query(string $sql): ResultInterface { - $args = func_get_args(); - $sql = $args[0]; - $stmt = $this->prepare($sql); - $stmt->execute(); - - return $stmt; + return $this->prepare($sql)->execute(); } /** @@ -126,10 +103,7 @@ public function quote($value, $type = ParameterType::STRING) return "'" . $value . "'"; } - /** - * {@inheritdoc} - */ - public function exec($sql) + public function exec(string $sql): int { $stmt = @db2_exec($this->conn, $sql); @@ -188,27 +162,4 @@ public function rollBack() return $result; } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - return db2_conn_error($this->conn); - } - - /** - * {@inheritdoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return [ - 0 => db2_conn_errormsg($this->conn), - 1 => $this->errorCode(), - ]; - } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DataSourceName.php b/doctrine/dbal/src/Driver/IBMDB2/DataSourceName.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DataSourceName.php rename to doctrine/dbal/src/Driver/IBMDB2/DataSourceName.php diff --git a/doctrine/dbal/src/Driver/IBMDB2/Driver.php b/doctrine/dbal/src/Driver/IBMDB2/Driver.php new file mode 100644 index 000000000..c08165520 --- /dev/null +++ b/doctrine/dbal/src/Driver/IBMDB2/Driver.php @@ -0,0 +1,24 @@ +toString(), + isset($params['persistent']) && $params['persistent'] === true, + $params['user'] ?? '', + $params['password'] ?? '', + $params['driverOptions'] ?? [] + ); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php similarity index 81% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php index 61244c1cc..86821688c 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php @@ -4,14 +4,14 @@ namespace Doctrine\DBAL\Driver\IBMDB2\Exception; -use Doctrine\DBAL\Driver\IBMDB2\DB2Exception; +use Doctrine\DBAL\Driver\AbstractException; /** * @internal * * @psalm-immutable */ -final class CannotCopyStreamToStream extends DB2Exception +final class CannotCopyStreamToStream extends AbstractException { /** * @psalm-param array{message: string}|null $error diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php similarity index 80% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php index d5481ed9e..587ae65f4 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php @@ -4,14 +4,14 @@ namespace Doctrine\DBAL\Driver\IBMDB2\Exception; -use Doctrine\DBAL\Driver\IBMDB2\DB2Exception; +use Doctrine\DBAL\Driver\AbstractException; /** * @internal * * @psalm-immutable */ -final class CannotCreateTemporaryFile extends DB2Exception +final class CannotCreateTemporaryFile extends AbstractException { /** * @psalm-param array{message: string}|null $error diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php similarity index 80% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php index 33d0b86cc..f2287b300 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php @@ -4,14 +4,14 @@ namespace Doctrine\DBAL\Driver\IBMDB2\Exception; -use Doctrine\DBAL\Driver\IBMDB2\DB2Exception; +use Doctrine\DBAL\Driver\AbstractException; /** * @internal * * @psalm-immutable */ -final class CannotWriteToTemporaryFile extends DB2Exception +final class CannotWriteToTemporaryFile extends AbstractException { /** * @psalm-param array{message: string}|null $error diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionError.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionError.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/ConnectionFailed.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/PrepareFailed.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/PrepareFailed.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/StatementError.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/Exception/StatementError.php rename to doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php diff --git a/doctrine/dbal/src/Driver/IBMDB2/Result.php b/doctrine/dbal/src/Driver/IBMDB2/Result.php new file mode 100644 index 000000000..d8e9fc599 --- /dev/null +++ b/doctrine/dbal/src/Driver/IBMDB2/Result.php @@ -0,0 +1,113 @@ +statement = $statement; + } + + /** + * {@inheritDoc} + */ + public function fetchNumeric() + { + $row = @db2_fetch_array($this->statement); + + if ($row === false && db2_stmt_error($this->statement) !== '02000') { + throw StatementError::new($this->statement); + } + + return $row; + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + $row = @db2_fetch_assoc($this->statement); + + if ($row === false && db2_stmt_error($this->statement) !== '02000') { + throw StatementError::new($this->statement); + } + + return $row; + } + + /** + * {@inheritDoc} + */ + public function fetchOne() + { + return FetchUtils::fetchOne($this); + } + + /** + * {@inheritDoc} + */ + public function fetchAllNumeric(): array + { + return FetchUtils::fetchAllNumeric($this); + } + + /** + * {@inheritDoc} + */ + public function fetchAllAssociative(): array + { + return FetchUtils::fetchAllAssociative($this); + } + + /** + * {@inheritDoc} + */ + public function fetchFirstColumn(): array + { + return FetchUtils::fetchFirstColumn($this); + } + + public function rowCount(): int + { + return @db2_num_rows($this->statement); + } + + public function columnCount(): int + { + $count = db2_num_fields($this->statement); + + if ($count !== false) { + return $count; + } + + return 0; + } + + public function free(): void + { + db2_free_result($this->statement); + } +} diff --git a/doctrine/dbal/src/Driver/IBMDB2/Statement.php b/doctrine/dbal/src/Driver/IBMDB2/Statement.php new file mode 100644 index 000000000..1820a7352 --- /dev/null +++ b/doctrine/dbal/src/Driver/IBMDB2/Statement.php @@ -0,0 +1,198 @@ +stmt = $stmt; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + assert(is_int($param)); + + return $this->bindParam($param, $value, $type); + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + assert(is_int($param)); + + switch ($type) { + case ParameterType::INTEGER: + $this->bind($param, $variable, DB2_PARAM_IN, DB2_LONG); + break; + + case ParameterType::LARGE_OBJECT: + if (isset($this->lobs[$param])) { + [, $handle] = $this->lobs[$param]; + fclose($handle); + } + + $handle = $this->createTemporaryFile(); + $path = stream_get_meta_data($handle)['uri']; + + $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY); + + $this->lobs[$param] = [&$variable, $handle]; + break; + + default: + $this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR); + break; + } + + return true; + } + + /** + * @param int $position Parameter position + * @param mixed $variable + * + * @throws Exception + */ + private function bind($position, &$variable, int $parameterType, int $dataType): void + { + $this->bindParam[$position] =& $variable; + + if (! db2_bind_param($this->stmt, $position, 'variable', $parameterType, $dataType)) { + throw StatementError::new($this->stmt); + } + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + if ($params === null) { + ksort($this->bindParam); + + $params = []; + + foreach ($this->bindParam as $column => $value) { + $params[] = $value; + } + } + + foreach ($this->lobs as [$source, $target]) { + if (is_resource($source)) { + $this->copyStreamToStream($source, $target); + + continue; + } + + $this->writeStringToStream($source, $target); + } + + $result = db2_execute($this->stmt, $params); + + foreach ($this->lobs as [, $handle]) { + fclose($handle); + } + + $this->lobs = []; + + if ($result === false) { + throw StatementError::new($this->stmt); + } + + return new Result($this->stmt); + } + + /** + * @return resource + * + * @throws Exception + */ + private function createTemporaryFile() + { + $handle = @tmpfile(); + + if ($handle === false) { + throw CannotCreateTemporaryFile::new(error_get_last()); + } + + return $handle; + } + + /** + * @param resource $source + * @param resource $target + * + * @throws Exception + */ + private function copyStreamToStream($source, $target): void + { + if (@stream_copy_to_stream($source, $target) === false) { + throw CannotCopyStreamToStream::new(error_get_last()); + } + } + + /** + * @param resource $target + * + * @throws Exception + */ + private function writeStringToStream(string $string, $target): void + { + if (@fwrite($target, $string) === false) { + throw CannotWriteToTemporaryFile::new(error_get_last()); + } + } +} diff --git a/doctrine/dbal/src/Driver/Middleware.php b/doctrine/dbal/src/Driver/Middleware.php new file mode 100644 index 000000000..4629d9a85 --- /dev/null +++ b/doctrine/dbal/src/Driver/Middleware.php @@ -0,0 +1,12 @@ + $preInitializers + * @param iterable $postInitializers + * + * @throws Exception + */ + public function __construct( + ?string $host = null, + ?string $username = null, + ?string $password = null, + ?string $database = null, + ?int $port = null, + ?string $socket = null, + ?int $flags = null, + iterable $preInitializers = [], + iterable $postInitializers = [] + ) { + $connection = mysqli_init(); + + foreach ($preInitializers as $initializer) { + $initializer->initialize($connection); + } + + if (! @$connection->real_connect($host, $username, $password, $database, $port, $socket, $flags)) { + throw ConnectionFailed::new($connection); + } + + foreach ($postInitializers as $initializer) { + $initializer->initialize($connection); + } + + $this->conn = $connection; + } + + /** + * Retrieves mysqli native resource handle. + * + * Could be used if part of your application is not using DBAL. + * + * @return mysqli + */ + public function getWrappedResourceHandle() + { + return $this->conn; + } + + /** + * {@inheritdoc} + * + * The server version detection includes a special case for MariaDB + * to support '5.5.5-' prefixed versions introduced in Maria 10+ + * + * @link https://jira.mariadb.org/browse/MDEV-4088 + */ + public function getServerVersion() + { + $serverInfos = $this->conn->get_server_info(); + if (stripos($serverInfos, 'mariadb') !== false) { + return $serverInfos; + } + + $majorVersion = floor($this->conn->server_version / 10000); + $minorVersion = floor(($this->conn->server_version - $majorVersion * 10000) / 100); + $patchVersion = floor($this->conn->server_version - $majorVersion * 10000 - $minorVersion * 100); + + return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; + } + + public function prepare(string $sql): DriverStatement + { + return new Statement($this->conn, $sql); + } + + public function query(string $sql): ResultInterface + { + return $this->prepare($sql)->execute(); + } + + /** + * {@inheritdoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + return "'" . $this->conn->escape_string($value) . "'"; + } + + public function exec(string $sql): int + { + if ($this->conn->query($sql) === false) { + throw ConnectionError::new($this->conn); + } + + return $this->conn->affected_rows; + } + + /** + * {@inheritdoc} + */ + public function lastInsertId($name = null) + { + return $this->conn->insert_id; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->conn->query('START TRANSACTION'); + + return true; + } + + /** + * {@inheritdoc} + */ + public function commit() + { + return $this->conn->commit(); + } + + /** + * {@inheritdoc} + */ + public function rollBack() + { + return $this->conn->rollback(); + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Driver.php b/doctrine/dbal/src/Driver/Mysqli/Driver.php new file mode 100644 index 000000000..28897ed3d --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Driver.php @@ -0,0 +1,119 @@ +withOptions($preInitializers, $driverOptions); + } + + $preInitializers = $this->withSecure($preInitializers, $params); + $postInitializers = $this->withCharset($postInitializers, $params); + + return new Connection( + $host, + $params['user'] ?? null, + $params['password'] ?? null, + $params['dbname'] ?? null, + $params['port'] ?? null, + $params['unix_socket'] ?? null, + $flags, + $preInitializers, + $postInitializers + ); + } + + /** + * @param list $initializers + * @param array $options + * + * @return list + */ + private function withOptions(array $initializers, array $options): array + { + if (count($options) !== 0) { + $initializers[] = new Options($options); + } + + return $initializers; + } + + /** + * @param list $initializers + * @param array $params + * + * @return list + */ + private function withSecure(array $initializers, array $params): array + { + if ( + isset($params['ssl_key']) || + isset($params['ssl_cert']) || + isset($params['ssl_ca']) || + isset($params['ssl_capath']) || + isset($params['ssl_cipher']) + ) { + $initializers[] = new Secure( + $params['ssl_key'] ?? '', + $params['ssl_cert'] ?? '', + $params['ssl_ca'] ?? '', + $params['ssl_capath'] ?? '', + $params['ssl_cipher'] ?? '' + ); + } + + return $initializers; + } + + /** + * @param list $initializers + * @param array $params + * + * @return list + */ + private function withCharset(array $initializers, array $params): array + { + if (isset($params['charset'])) { + $initializers[] = new Charset($params['charset']); + } + + return $initializers; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php similarity index 74% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php rename to doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php index 96a05facc..25c33f065 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php @@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; -use Doctrine\DBAL\Driver\Mysqli\MysqliException; +use Doctrine\DBAL\Driver\AbstractException; use mysqli; /** @@ -12,7 +12,7 @@ * * @psalm-immutable */ -final class ConnectionError extends MysqliException +final class ConnectionError extends AbstractException { public static function new(mysqli $connection): self { diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php similarity index 74% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php rename to doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php index f73e07c32..16cab72e5 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php @@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; -use Doctrine\DBAL\Driver\Mysqli\MysqliException; +use Doctrine\DBAL\Driver\AbstractException; use mysqli; /** @@ -12,7 +12,7 @@ * * @psalm-immutable */ -final class ConnectionFailed extends MysqliException +final class ConnectionFailed extends AbstractException { public static function new(mysqli $connection): self { diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/FailedReadingStreamOffset.php b/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php similarity index 53% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/FailedReadingStreamOffset.php rename to doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php index d3aaf8fbe..6f26dbec8 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/FailedReadingStreamOffset.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php @@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; -use Doctrine\DBAL\Driver\Mysqli\MysqliException; +use Doctrine\DBAL\Driver\AbstractException; use function sprintf; @@ -13,10 +13,10 @@ * * @psalm-immutable */ -final class FailedReadingStreamOffset extends MysqliException +final class FailedReadingStreamOffset extends AbstractException { - public static function new(int $offset): self + public static function new(int $parameter): self { - return new self(sprintf('Failed reading the stream resource for parameter offset %d.', $offset)); + return new self(sprintf('Failed reading the stream resource for parameter #%d.', $parameter)); } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php b/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php new file mode 100644 index 000000000..d3359fcdf --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php @@ -0,0 +1,20 @@ +error), + $connection->sqlstate, + $connection->errno + ); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/InvalidOption.php b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php similarity index 63% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/InvalidOption.php rename to doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php index aa5887efe..962175679 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/InvalidOption.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php @@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; -use Doctrine\DBAL\Driver\Mysqli\MysqliException; +use Doctrine\DBAL\Driver\AbstractException; use function sprintf; @@ -13,13 +13,12 @@ * * @psalm-immutable */ -final class InvalidOption extends MysqliException +final class InvalidOption extends AbstractException { /** - * @param mixed $option * @param mixed $value */ - public static function fromOption($option, $value): self + public static function fromOption(int $option, $value): self { return new self( sprintf('Failed to set option %d with value "%s"', $option, $value) diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php b/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php new file mode 100644 index 000000000..c4884c0cd --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php @@ -0,0 +1,24 @@ +charset = $charset; + } + + public function initialize(mysqli $connection): void + { + if ($connection->set_charset($this->charset)) { + return; + } + + throw InvalidCharset::fromCharset($connection, $this->charset); + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Initializer/Options.php b/doctrine/dbal/src/Driver/Mysqli/Initializer/Options.php new file mode 100644 index 000000000..bcf2fc2d1 --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Initializer/Options.php @@ -0,0 +1,34 @@ + */ + private $options; + + /** + * @param array $options + */ + public function __construct(array $options) + { + $this->options = $options; + } + + public function initialize(mysqli $connection): void + { + foreach ($this->options as $option => $value) { + if (! mysqli_options($connection, $option, $value)) { + throw InvalidOption::fromOption($option, $value); + } + } + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Initializer/Secure.php b/doctrine/dbal/src/Driver/Mysqli/Initializer/Secure.php new file mode 100644 index 000000000..9d6db4e0e --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Initializer/Secure.php @@ -0,0 +1,40 @@ +key = $key; + $this->cert = $cert; + $this->ca = $ca; + $this->capath = $capath; + $this->cipher = $cipher; + } + + public function initialize(mysqli $connection): void + { + $connection->ssl_set($this->key, $this->cert, $this->ca, $this->capath, $this->cipher); + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Result.php b/doctrine/dbal/src/Driver/Mysqli/Result.php new file mode 100644 index 000000000..9d6665e9d --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Result.php @@ -0,0 +1,190 @@ + + */ + private $columnNames = []; + + /** @var mixed[] */ + private $boundValues = []; + + /** + * @internal The result can be only instantiated by its driver connection or statement. + * + * @throws Exception + */ + public function __construct(mysqli_stmt $statement) + { + $this->statement = $statement; + + $meta = $statement->result_metadata(); + + if ($meta === false) { + return; + } + + $this->hasColumns = true; + + $fields = $meta->fetch_fields(); + assert(is_array($fields)); + + $this->columnNames = array_map(static function (stdClass $field): string { + return $field->name; + }, $fields); + + $meta->free(); + + // Store result of every execution which has it. Otherwise it will be impossible + // to execute a new statement in case if the previous one has non-fetched rows + // @link http://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html + $this->statement->store_result(); + + // Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql, + // it will have to allocate as much memory as it may be needed for the given column type + // (e.g. for a LONGBLOB column it's 4 gigabytes) + // @link https://bugs.php.net/bug.php?id=51386#1270673122 + // + // Make sure that the values are bound after each execution. Otherwise, if free() has been + // previously called on the result, the values are unbound making the statement unusable. + // + // It's also important that row values are bound after _each_ call to store_result(). Otherwise, + // if mysqli is compiled with libmysql, subsequently fetched string values will get truncated + // to the length of the ones fetched during the previous execution. + $this->boundValues = array_fill(0, count($this->columnNames), null); + + $refs = []; + foreach ($this->boundValues as &$value) { + $refs[] =& $value; + } + + if (! $this->statement->bind_result(...$refs)) { + throw StatementError::new($this->statement); + } + } + + /** + * {@inheritdoc} + */ + public function fetchNumeric() + { + $ret = $this->statement->fetch(); + + if ($ret === false) { + throw StatementError::new($this->statement); + } + + if ($ret === null) { + return false; + } + + $values = []; + + foreach ($this->boundValues as $v) { + $values[] = $v; + } + + return $values; + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + $values = $this->fetchNumeric(); + + if ($values === false) { + return false; + } + + $row = array_combine($this->columnNames, $values); + assert(is_array($row)); + + return $row; + } + + /** + * {@inheritdoc} + */ + public function fetchOne() + { + return FetchUtils::fetchOne($this); + } + + /** + * {@inheritdoc} + */ + public function fetchAllNumeric(): array + { + return FetchUtils::fetchAllNumeric($this); + } + + /** + * {@inheritdoc} + */ + public function fetchAllAssociative(): array + { + return FetchUtils::fetchAllAssociative($this); + } + + /** + * {@inheritdoc} + */ + public function fetchFirstColumn(): array + { + return FetchUtils::fetchFirstColumn($this); + } + + public function rowCount(): int + { + if ($this->hasColumns) { + return $this->statement->num_rows; + } + + return $this->statement->affected_rows; + } + + public function columnCount(): int + { + return $this->statement->field_count; + } + + public function free(): void + { + $this->statement->free_result(); + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Statement.php b/doctrine/dbal/src/Driver/Mysqli/Statement.php new file mode 100644 index 000000000..b3a5ca874 --- /dev/null +++ b/doctrine/dbal/src/Driver/Mysqli/Statement.php @@ -0,0 +1,227 @@ + 's', + ParameterType::STRING => 's', + ParameterType::BINARY => 's', + ParameterType::BOOLEAN => 'i', + ParameterType::NULL => 's', + ParameterType::INTEGER => 'i', + ParameterType::LARGE_OBJECT => 'b', + ]; + + /** @var mysqli */ + protected $_conn; + + /** @var mysqli_stmt */ + protected $_stmt; + + /** @var mixed[] */ + protected $_bindedValues; + + /** @var string */ + protected $types; + + /** + * Contains ref values for bindValue(). + * + * @var mixed[] + */ + protected $_values = []; + + /** + * @internal The statement can be only instantiated by its driver connection. + * + * @param string $prepareString + * + * @throws Exception + */ + public function __construct(mysqli $conn, $prepareString) + { + $this->_conn = $conn; + + $stmt = $conn->prepare($prepareString); + + if ($stmt === false) { + throw ConnectionError::new($this->_conn); + } + + $this->_stmt = $stmt; + + $paramCount = $this->_stmt->param_count; + if (0 >= $paramCount) { + return; + } + + $this->types = str_repeat('s', $paramCount); + $this->_bindedValues = array_fill(1, $paramCount, null); + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + assert(is_int($param)); + + if (! isset(self::$_paramTypeMap[$type])) { + throw UnknownParameterType::new($type); + } + + $this->_bindedValues[$param] =& $variable; + $this->types[$param - 1] = self::$_paramTypeMap[$type]; + + return true; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + assert(is_int($param)); + + if (! isset(self::$_paramTypeMap[$type])) { + throw UnknownParameterType::new($type); + } + + $this->_values[$param] = $value; + $this->_bindedValues[$param] =& $this->_values[$param]; + $this->types[$param - 1] = self::$_paramTypeMap[$type]; + + return true; + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + if ($this->_bindedValues !== null) { + if ($params !== null) { + if (! $this->bindUntypedValues($params)) { + throw StatementError::new($this->_stmt); + } + } else { + $this->bindTypedParameters(); + } + } + + if (! $this->_stmt->execute()) { + throw StatementError::new($this->_stmt); + } + + return new Result($this->_stmt); + } + + /** + * Binds parameters with known types previously bound to the statement + * + * @throws Exception + */ + private function bindTypedParameters(): void + { + $streams = $values = []; + $types = $this->types; + + foreach ($this->_bindedValues as $parameter => $value) { + assert(is_int($parameter)); + + if (! isset($types[$parameter - 1])) { + $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; + } + + if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) { + if (is_resource($value)) { + if (get_resource_type($value) !== 'stream') { + throw NonStreamResourceUsedAsLargeObject::new($parameter); + } + + $streams[$parameter] = $value; + $values[$parameter] = null; + continue; + } + + $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; + } + + $values[$parameter] = $value; + } + + if (! $this->_stmt->bind_param($types, ...$values)) { + throw StatementError::new($this->_stmt); + } + + $this->sendLongData($streams); + } + + /** + * Handle $this->_longData after regular query parameters have been bound + * + * @param array $streams + * + * @throws Exception + */ + private function sendLongData(array $streams): void + { + foreach ($streams as $paramNr => $stream) { + while (! feof($stream)) { + $chunk = fread($stream, 8192); + + if ($chunk === false) { + throw FailedReadingStreamOffset::new($paramNr); + } + + if (! $this->_stmt->send_long_data($paramNr - 1, $chunk)) { + throw StatementError::new($this->_stmt); + } + } + } + } + + /** + * Binds a array of values to bound parameters. + * + * @param mixed[] $values + * + * @return bool + */ + private function bindUntypedValues(array $values) + { + $params = []; + $types = str_repeat('s', count($values)); + + foreach ($values as &$v) { + $params[] =& $v; + } + + return $this->_stmt->bind_param($types, ...$params); + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/Connection.php b/doctrine/dbal/src/Driver/OCI8/Connection.php new file mode 100644 index 000000000..3921b9563 --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/Connection.php @@ -0,0 +1,172 @@ +dbh = $dbh; + $this->executionMode = new ExecutionMode(); + } + + /** + * {@inheritdoc} + */ + public function getServerVersion() + { + $version = oci_server_version($this->dbh); + + if ($version === false) { + throw Error::new($this->dbh); + } + + assert(preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches) === 1); + + return $matches[1]; + } + + public function prepare(string $sql): DriverStatement + { + return new Statement($this->dbh, $sql, $this->executionMode); + } + + public function query(string $sql): ResultInterface + { + return $this->prepare($sql)->execute(); + } + + /** + * {@inheritdoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + if (is_int($value) || is_float($value)) { + return $value; + } + + $value = str_replace("'", "''", $value); + + return "'" . addcslashes($value, "\000\n\r\\\032") . "'"; + } + + public function exec(string $sql): int + { + return $this->prepare($sql)->execute()->rowCount(); + } + + /** + * {@inheritdoc} + * + * @return int|false + */ + public function lastInsertId($name = null) + { + if ($name === null) { + return false; + } + + $result = $this->query('SELECT ' . $name . '.CURRVAL FROM DUAL')->fetchOne(); + + if ($result === false) { + throw SequenceDoesNotExist::new(); + } + + return (int) $result; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->executionMode->disableAutoCommit(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function commit() + { + if (! oci_commit($this->dbh)) { + throw Error::new($this->dbh); + } + + $this->executionMode->enableAutoCommit(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function rollBack() + { + if (! oci_rollback($this->dbh)) { + throw Error::new($this->dbh); + } + + $this->executionMode->enableAutoCommit(); + + return true; + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php b/doctrine/dbal/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php new file mode 100644 index 000000000..483879d47 --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php @@ -0,0 +1,58 @@ +). + * + * Oracle does not support positional parameters, hence this method converts all + * positional parameters into artificially named parameters. + * + * @internal This class is not covered by the backward compatibility promise + */ +final class ConvertPositionalToNamedPlaceholders implements Visitor +{ + /** @var list */ + private $buffer = []; + + /** @var array */ + private $parameterMap = []; + + public function acceptOther(string $sql): void + { + $this->buffer[] = $sql; + } + + public function acceptPositionalParameter(string $sql): void + { + $position = count($this->parameterMap) + 1; + $param = ':param' . $position; + + $this->parameterMap[$position] = $param; + + $this->buffer[] = $param; + } + + public function acceptNamedParameter(string $sql): void + { + $this->buffer[] = $sql; + } + + public function getSQL(): string + { + return implode('', $this->buffer); + } + + /** + * @return array + */ + public function getParameterMap(): array + { + return $this->parameterMap; + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/Driver.php b/doctrine/dbal/src/Driver/OCI8/Driver.php new file mode 100644 index 000000000..351ffb87a --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/Driver.php @@ -0,0 +1,42 @@ +_constructDsn($params), + $params['charset'] ?? '', + $params['sessionMode'] ?? OCI_NO_AUTO_COMMIT, + $params['persistent'] ?? false + ); + } + + /** + * Constructs the Oracle DSN. + * + * @param mixed[] $params + * + * @return string The DSN. + */ + protected function _constructDsn(array $params) + { + return $this->getEasyConnectString($params); + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php new file mode 100644 index 000000000..cefe9a3ad --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php @@ -0,0 +1,26 @@ +isAutoCommitEnabled = true; + } + + public function disableAutoCommit(): void + { + $this->isAutoCommitEnabled = false; + } + + public function isAutoCommitEnabled(): bool + { + return $this->isAutoCommitEnabled; + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/Result.php b/doctrine/dbal/src/Driver/OCI8/Result.php new file mode 100644 index 000000000..5cbf007a2 --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/Result.php @@ -0,0 +1,139 @@ +statement = $statement; + } + + /** + * {@inheritDoc} + */ + public function fetchNumeric() + { + return $this->fetch(OCI_NUM); + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + return $this->fetch(OCI_ASSOC); + } + + /** + * {@inheritDoc} + */ + public function fetchOne() + { + return FetchUtils::fetchOne($this); + } + + /** + * {@inheritDoc} + */ + public function fetchAllNumeric(): array + { + return $this->fetchAll(OCI_NUM, OCI_FETCHSTATEMENT_BY_ROW); + } + + /** + * {@inheritDoc} + */ + public function fetchAllAssociative(): array + { + return $this->fetchAll(OCI_ASSOC, OCI_FETCHSTATEMENT_BY_ROW); + } + + /** + * {@inheritDoc} + */ + public function fetchFirstColumn(): array + { + return $this->fetchAll(OCI_NUM, OCI_FETCHSTATEMENT_BY_COLUMN)[0]; + } + + public function rowCount(): int + { + $count = oci_num_rows($this->statement); + + if ($count !== false) { + return $count; + } + + return 0; + } + + public function columnCount(): int + { + $count = oci_num_fields($this->statement); + + if ($count !== false) { + return $count; + } + + return 0; + } + + public function free(): void + { + oci_cancel($this->statement); + } + + /** + * @return mixed|false + */ + private function fetch(int $mode) + { + return oci_fetch_array( + $this->statement, + $mode | OCI_RETURN_NULLS | OCI_RETURN_LOBS + ); + } + + /** + * @return array + */ + private function fetchAll(int $mode, int $fetchStructure): array + { + oci_fetch_all( + $this->statement, + $result, + 0, + -1, + $mode | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS + ); + + return $result; + } +} diff --git a/doctrine/dbal/src/Driver/OCI8/Statement.php b/doctrine/dbal/src/Driver/OCI8/Statement.php new file mode 100644 index 000000000..a1621c7ed --- /dev/null +++ b/doctrine/dbal/src/Driver/OCI8/Statement.php @@ -0,0 +1,165 @@ +parse($query, $visitor); + + $stmt = oci_parse($dbh, $visitor->getSQL()); + assert(is_resource($stmt)); + + $this->_sth = $stmt; + $this->_dbh = $dbh; + $this->_paramMap = $visitor->getParameterMap(); + $this->executionMode = $executionMode; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + return $this->bindParam($param, $value, $type, null); + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + if (is_int($param)) { + if (! isset($this->_paramMap[$param])) { + throw UnknownParameterIndex::new($param); + } + + $param = $this->_paramMap[$param]; + } + + if ($type === ParameterType::LARGE_OBJECT) { + $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); + + assert($lob !== false); + + $lob->writetemporary($variable, OCI_TEMP_BLOB); + + $variable =& $lob; + } + + $this->boundValues[$param] =& $variable; + + return oci_bind_by_name( + $this->_sth, + $param, + $variable, + $length ?? -1, + $this->convertParameterType($type) + ); + } + + /** + * Converts DBAL parameter type to oci8 parameter type + */ + private function convertParameterType(int $type): int + { + switch ($type) { + case ParameterType::BINARY: + return OCI_B_BIN; + + case ParameterType::LARGE_OBJECT: + return OCI_B_BLOB; + + default: + return SQLT_CHR; + } + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + if ($params !== null) { + foreach ($params as $key => $val) { + if (is_int($key)) { + $this->bindValue($key + 1, $val); + } else { + $this->bindValue($key, $val); + } + } + } + + if ($this->executionMode->isAutoCommitEnabled()) { + $mode = OCI_COMMIT_ON_SUCCESS; + } else { + $mode = OCI_NO_AUTO_COMMIT; + } + + $ret = @oci_execute($this->_sth, $mode); + if (! $ret) { + throw Error::new($this->_sth); + } + + return new Result($this->_sth); + } +} diff --git a/doctrine/dbal/src/Driver/PDO/Connection.php b/doctrine/dbal/src/Driver/PDO/Connection.php new file mode 100644 index 000000000..169016937 --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/Connection.php @@ -0,0 +1,151 @@ +connection = new PDO($dsn, (string) $user, (string) $password, (array) $options); + $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + public function exec(string $sql): int + { + try { + $result = $this->connection->exec($sql); + + assert($result !== false); + + return $result; + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * {@inheritdoc} + */ + public function getServerVersion() + { + return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); + } + + /** + * {@inheritDoc} + * + * @return Statement + */ + public function prepare(string $sql): StatementInterface + { + try { + $stmt = $this->connection->prepare($sql); + assert($stmt instanceof PDOStatement); + + return $this->createStatement($stmt); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + public function query(string $sql): ResultInterface + { + try { + $stmt = $this->connection->query($sql); + assert($stmt instanceof PDOStatement); + + return new Result($stmt); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * {@inheritdoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + return $this->connection->quote($value, $type); + } + + /** + * {@inheritdoc} + */ + public function lastInsertId($name = null) + { + try { + if ($name === null) { + return $this->connection->lastInsertId(); + } + + return $this->connection->lastInsertId($name); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * Creates a wrapped statement + */ + protected function createStatement(PDOStatement $stmt): Statement + { + return new Statement($stmt); + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + return $this->connection->beginTransaction(); + } + + /** + * {@inheritDoc} + */ + public function commit() + { + return $this->connection->commit(); + } + + /** + * {@inheritDoc} + */ + public function rollBack() + { + return $this->connection->rollBack(); + } + + public function getWrappedConnection(): PDO + { + return $this->connection; + } +} diff --git a/doctrine/dbal/src/Driver/PDO/Exception.php b/doctrine/dbal/src/Driver/PDO/Exception.php new file mode 100644 index 000000000..49f55951d --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/Exception.php @@ -0,0 +1,28 @@ +errorInfo !== null) { + [$sqlState, $code] = $exception->errorInfo; + } else { + $code = $exception->getCode(); + $sqlState = null; + } + + return new self($exception->getMessage(), $sqlState, $code, $exception); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php similarity index 52% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php rename to doctrine/dbal/src/Driver/PDO/MySQL/Driver.php index 25eb2fbdb..50c05a40f 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php @@ -1,40 +1,36 @@ constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - } catch (PDOException $e) { - throw Exception::driverException($this, $e); + $driverOptions = $params['driverOptions'] ?? []; + + if (! empty($params['persistent'])) { + $driverOptions[PDO::ATTR_PERSISTENT] = true; } - return $conn; + return new Connection( + $this->constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); } /** - * Constructs the MySql PDO DSN. + * Constructs the MySQL PDO DSN. * * @param mixed[] $params * @@ -65,14 +61,4 @@ protected function constructPdoDsn(array $params) return $dsn; } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'pdo_mysql'; - } } diff --git a/doctrine/dbal/src/Driver/PDO/OCI/Driver.php b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php new file mode 100644 index 000000000..a2c1f4652 --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php @@ -0,0 +1,49 @@ +constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + } + + /** + * Constructs the Oracle PDO DSN. + * + * @param mixed[] $params + * + * @return string The DSN. + */ + private function constructPdoDsn(array $params) + { + $dsn = 'oci:dbname=' . $this->getEasyConnectString($params); + + if (isset($params['charset'])) { + $dsn .= ';charset=' . $params['charset']; + } + + return $dsn; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php similarity index 54% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php rename to doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php index 83076aa8c..e9620bde7 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php @@ -1,55 +1,53 @@ _constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - - if ( - defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') - && (! isset($driverOptions[\PDO::PGSQL_ATTR_DISABLE_PREPARES]) - || $driverOptions[\PDO::PGSQL_ATTR_DISABLE_PREPARES] === true - ) - ) { - $pdo->setAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES, true); - } - - /* defining client_encoding via SET NAMES to avoid inconsistent DSN support - * - the 'client_encoding' connection param only works with postgres >= 9.1 - * - passing client_encoding via the 'options' param breaks pgbouncer support - */ - if (isset($params['charset'])) { - $pdo->exec('SET NAMES \'' . $params['charset'] . '\''); - } - - return $pdo; - } catch (PDOException $e) { - throw Exception::driverException($this, $e); + $driverOptions = $params['driverOptions'] ?? []; + + if (! empty($params['persistent'])) { + $driverOptions[PDO::ATTR_PERSISTENT] = true; + } + + $connection = new Connection( + $this->_constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions, + ); + + if ( + defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') + && (! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) + || $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] === true + ) + ) { + $connection->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); } + + /* defining client_encoding via SET NAMES to avoid inconsistent DSN support + * - the 'client_encoding' connection param only works with postgres >= 9.1 + * - passing client_encoding via the 'options' param breaks pgbouncer support + */ + if (isset($params['charset'])) { + $connection->exec('SET NAMES \'' . $params['charset'] . '\''); + } + + return $connection; } /** @@ -108,14 +106,4 @@ private function _constructPdoDsn(array $params) return $dsn; } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'pdo_pgsql'; - } } diff --git a/doctrine/dbal/src/Driver/PDO/Result.php b/doctrine/dbal/src/Driver/PDO/Result.php new file mode 100644 index 000000000..888716d81 --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/Result.php @@ -0,0 +1,130 @@ +statement = $statement; + } + + /** + * {@inheritDoc} + */ + public function fetchNumeric() + { + return $this->fetch(PDO::FETCH_NUM); + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + return $this->fetch(PDO::FETCH_ASSOC); + } + + /** + * {@inheritDoc} + */ + public function fetchOne() + { + return $this->fetch(PDO::FETCH_COLUMN); + } + + /** + * {@inheritDoc} + */ + public function fetchAllNumeric(): array + { + return $this->fetchAll(PDO::FETCH_NUM); + } + + /** + * {@inheritDoc} + */ + public function fetchAllAssociative(): array + { + return $this->fetchAll(PDO::FETCH_ASSOC); + } + + /** + * {@inheritDoc} + */ + public function fetchFirstColumn(): array + { + return $this->fetchAll(PDO::FETCH_COLUMN); + } + + public function rowCount(): int + { + try { + return $this->statement->rowCount(); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + public function columnCount(): int + { + try { + return $this->statement->columnCount(); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + public function free(): void + { + $this->statement->closeCursor(); + } + + /** + * @return mixed|false + * + * @throws Exception + */ + private function fetch(int $mode) + { + try { + return $this->statement->fetch($mode); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * @return list + * + * @throws Exception + */ + private function fetchAll(int $mode): array + { + try { + $data = $this->statement->fetchAll($mode); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + + assert(is_array($data)); + + return $data; + } +} diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php new file mode 100644 index 000000000..a64f4245a --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php @@ -0,0 +1,97 @@ +connection = $connection; + } + + public function prepare(string $sql): StatementInterface + { + return new Statement( + $this->connection->prepare($sql) + ); + } + + public function query(string $sql): Result + { + return $this->connection->query($sql); + } + + /** + * {@inheritDoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + return $this->connection->quote($value, $type); + } + + public function exec(string $sql): int + { + return $this->connection->exec($sql); + } + + /** + * {@inheritDoc} + */ + public function lastInsertId($name = null) + { + if ($name === null) { + return $this->connection->lastInsertId($name); + } + + return $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') + ->execute([$name]) + ->fetchOne(); + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + return $this->connection->beginTransaction(); + } + + /** + * {@inheritDoc} + */ + public function commit() + { + return $this->connection->commit(); + } + + /** + * {@inheritDoc} + */ + public function rollBack() + { + return $this->connection->rollBack(); + } + + /** + * {@inheritDoc} + */ + public function getServerVersion() + { + return $this->connection->getServerVersion(); + } + + public function getWrappedConnection(): PDO + { + return $this->connection->getWrappedConnection(); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php similarity index 64% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php rename to doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php index d8f225055..c48425049 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php @@ -1,41 +1,48 @@ $value) { - if (is_int($option)) { - $pdoOptions[$option] = $value; - } else { - $dsnOptions[$option] = $value; + if (isset($params['driverOptions'])) { + foreach ($params['driverOptions'] as $option => $value) { + if (is_int($option)) { + $pdoOptions[$option] = $value; + } else { + $dsnOptions[$option] = $value; + } } } - return new PDO\SQLSrv\Connection( - $this->_constructPdoDsn($params, $dsnOptions), - $username, - $password, - $pdoOptions + if (! empty($params['persistent'])) { + $pdoOptions[PDO::ATTR_PERSISTENT] = true; + } + + return new Connection( + new PDOConnection( + $this->_constructPdoDsn($params, $dsnOptions), + $params['user'] ?? '', + $params['password'] ?? '', + $pdoOptions + ) ); } @@ -46,6 +53,8 @@ public function connect(array $params, $username = null, $password = null, array * @param string[] $connectionOptions * * @return string The DSN. + * + * @throws Exception */ private function _constructPdoDsn(array $params, array $connectionOptions) { @@ -87,14 +96,4 @@ private function getConnectionOptionsDsn(array $connectionOptions): string return $connectionOptionsDsn; } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'pdo_sqlsrv'; - } } diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php new file mode 100644 index 000000000..40cd2446a --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php @@ -0,0 +1,65 @@ +statement = $statement; + } + + /** + * {@inheritdoc} + * + * @param mixed $driverOptions + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) + { + switch ($type) { + case ParameterType::LARGE_OBJECT: + case ParameterType::BINARY: + if ($driverOptions === null) { + $driverOptions = PDO::SQLSRV_ENCODING_BINARY; + } + + break; + + case ParameterType::ASCII: + $type = ParameterType::STRING; + $length = 0; + $driverOptions = PDO::SQLSRV_ENCODING_SYSTEM; + break; + } + + return $this->statement->bindParam($param, $variable, $type, $length, $driverOptions); + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + return $this->bindParam($param, $value, $type); + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): Result + { + return $this->statement->execute($params); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php similarity index 63% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php rename to doctrine/dbal/src/Driver/PDO/SQLite/Driver.php index fc2b881ff..d85ba28fa 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php @@ -1,21 +1,14 @@ _userDefinedFunctions = array_merge( $this->_userDefinedFunctions, @@ -37,22 +34,20 @@ public function connect(array $params, $username = null, $password = null, array unset($driverOptions['userDefinedFunctions']); } - try { - $pdo = new PDO\Connection( - $this->_constructPdoDsn($params), - $username, - $password, - $driverOptions - ); - } catch (PDOException $ex) { - throw Exception::driverException($this, $ex); - } + $connection = new Connection( + $this->_constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + + $pdo = $connection->getWrappedConnection(); foreach ($this->_userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } - return $pdo; + return $connection; } /** @@ -73,14 +68,4 @@ protected function _constructPdoDsn(array $params) return $dsn; } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'pdo_sqlite'; - } } diff --git a/doctrine/dbal/src/Driver/PDO/Statement.php b/doctrine/dbal/src/Driver/PDO/Statement.php new file mode 100644 index 000000000..7107fa2df --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/Statement.php @@ -0,0 +1,105 @@ + PDO::PARAM_NULL, + ParameterType::INTEGER => PDO::PARAM_INT, + ParameterType::STRING => PDO::PARAM_STR, + ParameterType::ASCII => PDO::PARAM_STR, + ParameterType::BINARY => PDO::PARAM_LOB, + ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, + ParameterType::BOOLEAN => PDO::PARAM_BOOL, + ]; + + /** @var PDOStatement */ + private $stmt; + + /** + * @internal The statement can be only instantiated by its driver connection. + */ + public function __construct(PDOStatement $stmt) + { + $this->stmt = $stmt; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + $type = $this->convertParamType($type); + + try { + return $this->stmt->bindValue($param, $value, $type); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * {@inheritDoc} + * + * @param mixed $param + * @param mixed $variable + * @param int $type + * @param int|null $length + * @param mixed $driverOptions + * + * @return bool + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) + { + $type = $this->convertParamType($type); + + try { + return $this->stmt->bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + try { + $this->stmt->execute($params); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + + return new Result($this->stmt); + } + + /** + * Converts DBAL parameter type to PDO parameter type + * + * @param int $type Parameter type + * + * @throws ExceptionInterface + */ + private function convertParamType(int $type): int + { + if (! isset(self::PARAM_TYPE_MAP[$type])) { + throw UnknownParameterType::new($type); + } + + return self::PARAM_TYPE_MAP[$type]; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Result.php b/doctrine/dbal/src/Driver/Result.php similarity index 87% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/Result.php rename to doctrine/dbal/src/Driver/Result.php index a52f0563e..7843a9589 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/Result.php +++ b/doctrine/dbal/src/Driver/Result.php @@ -5,14 +5,14 @@ namespace Doctrine\DBAL\Driver; /** - * Driver-level result statement execution result. + * Driver-level statement execution result. */ interface Result { /** * Returns the next row of the result as a numeric array or FALSE if there are no more rows. * - * @return array|false + * @return list|false * * @throws Exception */ @@ -39,7 +39,7 @@ public function fetchOne(); /** * Returns an array containing all of the result rows represented as numeric arrays. * - * @return array> + * @return list> * * @throws Exception */ @@ -48,7 +48,7 @@ public function fetchAllNumeric(): array; /** * Returns an array containing all of the result rows represented as associative arrays. * - * @return array> + * @return list> * * @throws Exception */ @@ -57,7 +57,7 @@ public function fetchAllAssociative(): array; /** * Returns an array containing the values of the first column of the result. * - * @return array + * @return list * * @throws Exception */ @@ -71,16 +71,20 @@ public function fetchFirstColumn(): array; * is not guaranteed for all drivers and should not be relied on in portable applications. * * @return int The number of rows. + * + * @throws Exception */ - public function rowCount(); + public function rowCount(): int; /** * Returns the number of columns in the result * * @return int The number of columns in the result. If the columns cannot be counted, * this method must return 0. + * + * @throws Exception */ - public function columnCount(); + public function columnCount(): int; /** * Discards the non-fetched portion of the result, enabling the originating statement to be executed again. diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php b/doctrine/dbal/src/Driver/SQLSrv/Connection.php similarity index 62% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php rename to doctrine/dbal/src/Driver/SQLSrv/Connection.php index 0bc7b68cb..902a1167c 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Connection.php @@ -2,13 +2,13 @@ namespace Doctrine\DBAL\Driver\SQLSrv; -use Doctrine\DBAL\Driver\Connection as ConnectionInterface; -use Doctrine\DBAL\Driver\Result; +use Doctrine\DBAL\Driver\Exception; +use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\SQLSrv\Exception\Error; +use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; -use function func_get_args; use function is_float; use function is_int; use function sprintf; @@ -16,21 +16,13 @@ use function sqlsrv_commit; use function sqlsrv_configure; use function sqlsrv_connect; -use function sqlsrv_errors; use function sqlsrv_query; use function sqlsrv_rollback; use function sqlsrv_rows_affected; use function sqlsrv_server_info; use function str_replace; -use const SQLSRV_ERR_ERRORS; - -/** - * SQL Server implementation for the Connection interface. - * - * @deprecated Use {@link Connection} instead - */ -class SQLSrvConnection implements ConnectionInterface, ServerInfoAwareConnection +final class Connection implements ServerInfoAwareConnection { /** @var resource */ protected $conn; @@ -44,7 +36,7 @@ class SQLSrvConnection implements ConnectionInterface, ServerInfoAwareConnection * @param string $serverName * @param mixed[] $connectionOptions * - * @throws SQLSrvException + * @throws Exception */ public function __construct($serverName, $connectionOptions) { @@ -72,33 +64,14 @@ public function getServerVersion() return $serverInfo['SQLServerVersion']; } - /** - * {@inheritdoc} - */ - public function requiresQueryForServerVersion() - { - return false; - } - - /** - * {@inheritDoc} - */ - public function prepare($sql) + public function prepare(string $sql): DriverStatement { return new Statement($this->conn, $sql, $this->lastInsertId); } - /** - * {@inheritDoc} - */ - public function query() + public function query(string $sql): ResultInterface { - $args = func_get_args(); - $sql = $args[0]; - $stmt = $this->prepare($sql); - $stmt->execute(); - - return $stmt; + return $this->prepare($sql)->execute(); } /** @@ -117,10 +90,7 @@ public function quote($value, $type = ParameterType::STRING) return "'" . str_replace("'", "''", $value) . "'"; } - /** - * {@inheritDoc} - */ - public function exec($sql) + public function exec(string $sql): int { $stmt = sqlsrv_query($this->conn, $sql); @@ -143,17 +113,13 @@ public function exec($sql) public function lastInsertId($name = null) { if ($name !== null) { - $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); - $stmt->execute([$name]); + $result = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') + ->execute([$name]); } else { - $stmt = $this->query('SELECT @@IDENTITY'); + $result = $this->query('SELECT @@IDENTITY'); } - if ($stmt instanceof Result) { - return $stmt->fetchOne(); - } - - return $stmt->fetchColumn(); + return $result->fetchOne(); } /** @@ -191,29 +157,4 @@ public function rollBack() return true; } - - /** - * {@inheritDoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorCode() - { - $errors = sqlsrv_errors(SQLSRV_ERR_ERRORS); - if ($errors) { - return $errors[0]['code']; - } - - return null; - } - - /** - * {@inheritDoc} - * - * @deprecated The error information is available via exceptions. - */ - public function errorInfo() - { - return (array) sqlsrv_errors(SQLSRV_ERR_ERRORS); - } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php b/doctrine/dbal/src/Driver/SQLSrv/Driver.php similarity index 70% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php rename to doctrine/dbal/src/Driver/SQLSrv/Driver.php index a57128d9d..efa9ccfe9 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Driver.php @@ -8,12 +8,14 @@ /** * Driver for ext/sqlsrv. */ -class Driver extends AbstractSQLServerDriver +final class Driver extends AbstractSQLServerDriver { /** * {@inheritdoc} + * + * @return Connection */ - public function connect(array $params, $username = null, $password = null, array $driverOptions = []) + public function connect(array $params) { $serverName = ''; @@ -27,6 +29,8 @@ public function connect(array $params, $username = null, $password = null, array throw PortWithoutHost::new(); } + $driverOptions = $params['driverOptions'] ?? []; + if (isset($params['dbname'])) { $driverOptions['Database'] = $params['dbname']; } @@ -35,12 +39,12 @@ public function connect(array $params, $username = null, $password = null, array $driverOptions['CharacterSet'] = $params['charset']; } - if ($username !== null) { - $driverOptions['UID'] = $username; + if (isset($params['user'])) { + $driverOptions['UID'] = $params['user']; } - if ($password !== null) { - $driverOptions['PWD'] = $password; + if (isset($params['password'])) { + $driverOptions['PWD'] = $params['password']; } if (! isset($driverOptions['ReturnDatesAsStrings'])) { @@ -49,14 +53,4 @@ public function connect(array $params, $username = null, $password = null, array return new Connection($serverName, $driverOptions); } - - /** - * {@inheritdoc} - * - * @deprecated - */ - public function getName() - { - return 'sqlsrv'; - } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Exception/Error.php b/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php similarity index 67% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Exception/Error.php rename to doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php index f2e4a5208..d3e633b5d 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Exception/Error.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php @@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Driver\SQLSrv\Exception; -use Doctrine\DBAL\Driver\SQLSrv\SQLSrvException; +use Doctrine\DBAL\Driver\AbstractException; use function rtrim; use function sqlsrv_errors; @@ -16,13 +16,13 @@ * * @psalm-immutable */ -final class Error extends SQLSrvException +final class Error extends AbstractException { public static function new(): self { - $message = ''; - $sqlState = null; - $errorCode = null; + $message = ''; + $sqlState = null; + $code = 0; foreach ((array) sqlsrv_errors(SQLSRV_ERR_ERRORS) as $error) { $message .= 'SQLSTATE [' . $error['SQLSTATE'] . ', ' . $error['code'] . ']: ' . $error['message'] . "\n"; @@ -31,17 +31,17 @@ public static function new(): self $sqlState = $error['SQLSTATE']; } - if ($errorCode !== null) { + if ($code !== 0) { continue; } - $errorCode = $error['code']; + $code = $error['code']; } - if (! $message) { + if ($message === '') { $message = 'SQL Server error occurred but no error message was retrieved from driver.'; } - return new self(rtrim($message), $sqlState, $errorCode); + return new self(rtrim($message), $sqlState, $code); } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php b/doctrine/dbal/src/Driver/SQLSrv/LastInsertId.php similarity index 93% rename from doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php rename to doctrine/dbal/src/Driver/SQLSrv/LastInsertId.php index 9406c425a..0948e5876 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php +++ b/doctrine/dbal/src/Driver/SQLSrv/LastInsertId.php @@ -7,7 +7,7 @@ * * @internal */ -class LastInsertId +final class LastInsertId { /** @var int */ private $id; diff --git a/doctrine/dbal/src/Driver/SQLSrv/Result.php b/doctrine/dbal/src/Driver/SQLSrv/Result.php new file mode 100644 index 000000000..7fe5ca19a --- /dev/null +++ b/doctrine/dbal/src/Driver/SQLSrv/Result.php @@ -0,0 +1,128 @@ +statement = $stmt; + } + + /** + * {@inheritDoc} + */ + public function fetchNumeric() + { + return $this->fetch(SQLSRV_FETCH_NUMERIC); + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + return $this->fetch(SQLSRV_FETCH_ASSOC); + } + + /** + * {@inheritDoc} + */ + public function fetchOne() + { + return FetchUtils::fetchOne($this); + } + + /** + * {@inheritDoc} + */ + public function fetchAllNumeric(): array + { + return FetchUtils::fetchAllNumeric($this); + } + + /** + * {@inheritDoc} + */ + public function fetchAllAssociative(): array + { + return FetchUtils::fetchAllAssociative($this); + } + + /** + * {@inheritDoc} + */ + public function fetchFirstColumn(): array + { + return FetchUtils::fetchFirstColumn($this); + } + + public function rowCount(): int + { + if ($this->statement === null) { + return 0; + } + + $count = sqlsrv_rows_affected($this->statement); + + if ($count !== false) { + return $count; + } + + return 0; + } + + public function columnCount(): int + { + if ($this->statement === null) { + return 0; + } + + $count = sqlsrv_num_fields($this->statement); + + if ($count !== false) { + return $count; + } + + return 0; + } + + public function free(): void + { + // emulate it by fetching and discarding rows, similarly to what PDO does in this case + // @link http://php.net/manual/en/pdostatement.closecursor.php + // @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075 + // deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them + while (sqlsrv_fetch($this->statement)) { + } + } + + /** + * @return mixed|false + */ + private function fetch(int $fetchType) + { + return sqlsrv_fetch_array($this->statement, $fetchType) ?? false; + } +} diff --git a/doctrine/dbal/src/Driver/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/SQLSrv/Statement.php new file mode 100644 index 000000000..ba2e29f91 --- /dev/null +++ b/doctrine/dbal/src/Driver/SQLSrv/Statement.php @@ -0,0 +1,208 @@ +conn = $conn; + $this->sql = $sql; + + if (stripos($sql, 'INSERT INTO ') !== 0) { + return; + } + + $this->sql .= self::LAST_INSERT_ID_SQL; + $this->lastInsertId = $lastInsertId; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + assert(is_int($param)); + + $this->variables[$param] = $value; + $this->types[$param] = $type; + + return true; + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + assert(is_int($param)); + + $this->variables[$param] =& $variable; + $this->types[$param] = $type; + + // unset the statement resource if it exists as the new one will need to be bound to the new variable + $this->stmt = null; + + return true; + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + if ($params !== null) { + foreach ($params as $key => $val) { + if (is_int($key)) { + $this->bindValue($key + 1, $val); + } else { + $this->bindValue($key, $val); + } + } + } + + if ($this->stmt === null) { + $this->stmt = $this->prepare(); + } + + if (! sqlsrv_execute($this->stmt)) { + throw Error::new(); + } + + if ($this->lastInsertId !== null) { + sqlsrv_next_result($this->stmt); + sqlsrv_fetch($this->stmt); + $this->lastInsertId->setId(sqlsrv_get_field($this->stmt, 0)); + } + + return new Result($this->stmt); + } + + /** + * Prepares SQL Server statement resource + * + * @return resource + * + * @throws Exception + */ + private function prepare() + { + $params = []; + + foreach ($this->variables as $column => &$variable) { + switch ($this->types[$column]) { + case ParameterType::LARGE_OBJECT: + $params[$column - 1] = [ + &$variable, + SQLSRV_PARAM_IN, + SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), + SQLSRV_SQLTYPE_VARBINARY('max'), + ]; + break; + + case ParameterType::BINARY: + $params[$column - 1] = [ + &$variable, + SQLSRV_PARAM_IN, + SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY), + ]; + break; + + case ParameterType::ASCII: + $params[$column - 1] = [ + &$variable, + SQLSRV_PARAM_IN, + SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), + ]; + break; + + default: + $params[$column - 1] =& $variable; + break; + } + } + + $stmt = sqlsrv_prepare($this->conn, $this->sql, $params); + + if ($stmt === false) { + throw Error::new(); + } + + return $stmt; + } +} diff --git a/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php b/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php new file mode 100644 index 000000000..622f98c6c --- /dev/null +++ b/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php @@ -0,0 +1,18 @@ +bindValue(), + * mark placeholder in the SQL statement that was use to prepare the statement. Unlike {@link bindValue()}, * the variable is bound as a reference and will only be evaluated at the time * that PDOStatement->execute() is called. * @@ -44,66 +43,34 @@ public function bindValue($param, $value, $type = ParameterType::STRING); * of stored procedures that return data as output parameters, and some also as input/output * parameters that both send in data and are updated to receive it. * - * @param int|string $param Parameter identifier. For a prepared statement using named placeholders, + * @param string|int $param Parameter identifier. For a prepared statement using named placeholders, * this will be a parameter name of the form :name. For a prepared statement using * question mark placeholders, this will be the 1-indexed position of the parameter. * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter. * @param int $type Explicit data type for the parameter using the {@link ParameterType} - * constants. To return an INOUT parameter from a stored procedure, use the bitwise - * OR operator to set the PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter. + * constants. * @param int|null $length You must specify maxlength when using an OUT bind * so that PHP allocates enough memory to hold the returned value. * * @return bool TRUE on success or FALSE on failure. - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null); - - /** - * Fetches the SQLSTATE associated with the last operation on the statement handle. * - * @deprecated The error information is available via exceptions. - * - * @see Doctrine_Adapter_Interface::errorCode() - * - * @return string|int|bool The error code string. + * @throws Exception */ - public function errorCode(); - - /** - * Fetches extended error information associated with the last operation on the statement handle. - * - * @deprecated The error information is available via exceptions. - * - * @return mixed[] The error info array. - */ - public function errorInfo(); + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null); /** * Executes a prepared statement * * If the prepared statement included parameter markers, you must either: - * call PDOStatement->bindParam() to bind PHP variables to the parameter markers: + * call {@link bindParam()} to bind PHP variables to the parameter markers: * bound variables pass their value as input and receive the output value, * if any, of their associated parameter markers or pass an array of input-only * parameter values. * - * @param mixed[]|null $params An array of values with as many elements as there are + * @param mixed[]|null $params A numeric array of values with as many elements as there are * bound parameters in the SQL statement being executed. * - * @return bool TRUE on success or FALSE on failure. - */ - public function execute($params = null); - - /** - * Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement - * executed by the corresponding object. - * - * If the last SQL statement executed by the associated Statement object was a SELECT statement, - * some databases may return the number of rows returned by that statement. However, - * this behaviour is not guaranteed for all databases and should not be - * relied on for portable applications. - * - * @return int The number of rows. + * @throws Exception */ - public function rowCount(); + public function execute($params = null): Result; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php b/doctrine/dbal/src/DriverManager.php similarity index 78% rename from doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php rename to doctrine/dbal/src/DriverManager.php index 17ba8584d..dd02fcd7c 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php +++ b/doctrine/dbal/src/DriverManager.php @@ -3,12 +3,10 @@ namespace Doctrine\DBAL; use Doctrine\Common\EventManager; -use Doctrine\DBAL\Driver\DrizzlePDOMySql; use Doctrine\DBAL\Driver\IBMDB2; use Doctrine\DBAL\Driver\Mysqli; use Doctrine\DBAL\Driver\OCI8; use Doctrine\DBAL\Driver\PDO; -use Doctrine\DBAL\Driver\SQLAnywhere; use Doctrine\DBAL\Driver\SQLSrv; use function array_keys; @@ -36,10 +34,8 @@ final class DriverManager * * To add your own driver use the 'driverClass' parameter to * {@link DriverManager::getConnection()}. - * - * @var string[] */ - private static $_driverMap = [ + private const DRIVER_MAP = [ 'pdo_mysql' => PDO\MySQL\Driver::class, 'pdo_sqlite' => PDO\SQLite\Driver::class, 'pdo_pgsql' => PDO\PgSQL\Driver::class, @@ -48,8 +44,6 @@ final class DriverManager 'ibm_db2' => IBMDB2\Driver::class, 'pdo_sqlsrv' => PDO\SQLSrv\Driver::class, 'mysqli' => Mysqli\Driver::class, - 'drizzle_pdo_mysql' => DrizzlePDOMySql\Driver::class, - 'sqlanywhere' => SQLAnywhere\Driver::class, 'sqlsrv' => SQLSrv\Driver::class, ]; @@ -86,7 +80,7 @@ private function __construct() * * $params must contain at least one of the following. * - * Either 'driver' with one of the array keys of {@link $_driverMap}, + * Either 'driver' with one of the array keys of {@link DRIVER_MAP}, * OR 'driverClass' that contains the full class name (with namespace) of the * driver class to instantiate. * @@ -102,10 +96,6 @@ private function __construct() * Any additional driver-specific options for the driver. These are just passed * through to the driver. * - * pdo: - * You can pass an existing PDO instance through this parameter. The PDO - * instance will be wrapped in a Doctrine\DBAL\Connection. - * * wrapperClass: * You may specify a custom wrapper class through the 'wrapperClass' * parameter but this class MUST inherit from Doctrine\DBAL\Connection. @@ -119,7 +109,6 @@ private function __construct() * * @throws Exception * - * @phpstan-param mixed[] $params * @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection) * @template T of Connection */ @@ -129,28 +118,16 @@ public static function getConnection( ?EventManager $eventManager = null ): Connection { // create default config and event manager, if not set - if (! $config) { + if ($config === null) { $config = new Configuration(); } - if (! $eventManager) { + if ($eventManager === null) { $eventManager = new EventManager(); } $params = self::parseDatabaseUrl($params); - // @todo: deprecated, notice thrown by connection constructor - if (isset($params['master'])) { - $params['master'] = self::parseDatabaseUrl($params['master']); - } - - // @todo: deprecated, notice thrown by connection constructor - if (isset($params['slaves'])) { - foreach ($params['slaves'] as $key => $slaveParams) { - $params['slaves'][$key] = self::parseDatabaseUrl($slaveParams); - } - } - // URL support for PrimaryReplicaConnection if (isset($params['primary'])) { $params['primary'] = self::parseDatabaseUrl($params['primary']); @@ -162,32 +139,28 @@ public static function getConnection( } } - // URL support for PoolingShardConnection - if (isset($params['global'])) { - $params['global'] = self::parseDatabaseUrl($params['global']); - } - - if (isset($params['shards'])) { - foreach ($params['shards'] as $key => $shardParams) { - $params['shards'][$key] = self::parseDatabaseUrl($shardParams); + if (isset($params['driverClass'])) { + if (! in_array(Driver::class, class_implements($params['driverClass']), true)) { + throw Exception::invalidDriverClass($params['driverClass']); } - } - // check for existing pdo object - if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) { - throw Exception::invalidPdoInstance(); - } + /** @var class-string $driverClass */ + $driverClass = $params['driverClass']; + } elseif (isset($params['driver'])) { + if (! isset(self::DRIVER_MAP[$params['driver']])) { + throw Exception::unknownDriver($params['driver'], array_keys(self::DRIVER_MAP)); + } - if (isset($params['pdo'])) { - $params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME); + $driverClass = self::DRIVER_MAP[$params['driver']]; } else { - self::_checkParams($params); + throw Exception::driverRequired(); } - $className = $params['driverClass'] ?? self::$_driverMap[$params['driver']]; + $driver = new $driverClass(); - $driver = new $className(); + foreach ($config->getMiddlewares() as $middleware) { + $driver = $middleware->wrap($driver); + } $wrapperClass = Connection::class; if (isset($params['wrapperClass'])) { @@ -209,38 +182,7 @@ public static function getConnection( */ public static function getAvailableDrivers(): array { - return array_keys(self::$_driverMap); - } - - /** - * Checks the list of parameters. - * - * @param mixed[] $params The list of parameters. - * - * @throws Exception - */ - private static function _checkParams(array $params): void - { - // check existence of mandatory parameters - - // driver - if (! isset($params['driver']) && ! isset($params['driverClass'])) { - throw Exception::driverRequired(); - } - - // check validity of parameters - - // driver - if (isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) { - throw Exception::unknownDriver($params['driver'], array_keys(self::$_driverMap)); - } - - if ( - isset($params['driverClass']) - && ! in_array(Driver::class, class_implements($params['driverClass'], true)) - ) { - throw Exception::invalidDriverClass($params['driverClass']); - } + return array_keys(self::DRIVER_MAP); } /** @@ -289,10 +231,6 @@ private static function parseDatabaseUrl(array $params): array $url[$param] = rawurldecode($value); } - // If we have a connection URL, we have to unset the default PDO instance connection parameter (if any) - // as we cannot merge connection details from the URL into the PDO instance (URL takes precedence). - unset($params['pdo']); - $params = self::parseDatabaseUrlScheme($url['scheme'] ?? null, $params); if (isset($url['host'])) { @@ -426,7 +364,7 @@ private static function parseSqliteDatabaseUrlPath(array $url, array $params): a * * @throws Exception If parsing failed or resolution is not possible. */ - private static function parseDatabaseUrlScheme($scheme, array $params): array + private static function parseDatabaseUrlScheme(?string $scheme, array $params): array { if ($scheme !== null) { // The requested driver from the URL scheme takes precedence diff --git a/doctrine/dbal/src/Event/ConnectionEventArgs.php b/doctrine/dbal/src/Event/ConnectionEventArgs.php new file mode 100644 index 000000000..eeddb91a5 --- /dev/null +++ b/doctrine/dbal/src/Event/ConnectionEventArgs.php @@ -0,0 +1,28 @@ +connection = $connection; + } + + /** + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php b/doctrine/dbal/src/Event/Listeners/OracleSessionInit.php similarity index 94% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php rename to doctrine/dbal/src/Event/Listeners/OracleSessionInit.php index a907716f8..d6d1fd9d1 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php +++ b/doctrine/dbal/src/Event/Listeners/OracleSessionInit.php @@ -5,6 +5,7 @@ use Doctrine\Common\EventSubscriber; use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Events; +use Doctrine\DBAL\Exception; use function array_change_key_case; use function array_merge; @@ -44,10 +45,12 @@ public function __construct(array $oracleSessionVars = []) /** * @return void + * + * @throws Exception */ public function postConnect(ConnectionEventArgs $args) { - if (! count($this->_defaultSessionVars)) { + if (count($this->_defaultSessionVars) === 0) { return; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php b/doctrine/dbal/src/Event/Listeners/SQLSessionInit.php similarity index 85% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php rename to doctrine/dbal/src/Event/Listeners/SQLSessionInit.php index ea63cab43..f7a4e9129 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php +++ b/doctrine/dbal/src/Event/Listeners/SQLSessionInit.php @@ -5,6 +5,7 @@ use Doctrine\Common\EventSubscriber; use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Events; +use Doctrine\DBAL\Exception; /** * Session init listener for executing a single SQL statement right after a connection is opened. @@ -24,11 +25,12 @@ public function __construct($sql) /** * @return void + * + * @throws Exception */ public function postConnect(ConnectionEventArgs $args) { - $conn = $args->getConnection(); - $conn->exec($this->sql); + $args->getConnection()->executeStatement($this->sql); } /** diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php rename to doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php rename to doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php rename to doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php rename to doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php rename to doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php b/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php similarity index 84% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php rename to doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php index 7c962a928..58efa7b50 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php @@ -3,7 +3,6 @@ namespace Doctrine\DBAL\Event; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Column; /** @@ -95,14 +94,4 @@ public function getConnection() { return $this->connection; } - - /** - * @deprecated Use SchemaColumnDefinitionEventArgs::getConnection() and Connection::getDatabasePlatform() instead. - * - * @return AbstractPlatform - */ - public function getDatabasePlatform() - { - return $this->connection->getDatabasePlatform(); - } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php rename to doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php b/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php rename to doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php b/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php rename to doctrine/dbal/src/Event/SchemaDropTableEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php b/doctrine/dbal/src/Event/SchemaEventArgs.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php rename to doctrine/dbal/src/Event/SchemaEventArgs.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php b/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php similarity index 88% rename from doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php rename to doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php index 055a19a7c..82c17a26a 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php @@ -3,7 +3,6 @@ namespace Doctrine\DBAL\Event; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Index; /** @@ -81,12 +80,4 @@ public function getConnection() { return $this->connection; } - - /** - * @return AbstractPlatform - */ - public function getDatabasePlatform() - { - return $this->connection->getDatabasePlatform(); - } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Events.php b/doctrine/dbal/src/Events.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Events.php rename to doctrine/dbal/src/Events.php diff --git a/doctrine/dbal/src/Exception.php b/doctrine/dbal/src/Exception.php new file mode 100644 index 000000000..56c4cc21c --- /dev/null +++ b/doctrine/dbal/src/Exception.php @@ -0,0 +1,152 @@ +getMessage(); + } else { + $message = 'An exception occurred in the driver: ' . $driverException->getMessage(); + } + + parent::__construct($message, $driverException->getCode(), $driverException); + + $this->query = $query; + } + + /** + * {@inheritDoc} + */ + public function getSQLState() + { + $previous = $this->getPrevious(); + assert($previous instanceof TheDriverException); + + return $previous->getSQLState(); + } + + public function getQuery(): ?Query + { + return $this->query; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php b/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php rename to doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php b/doctrine/dbal/src/Exception/InvalidArgumentException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php rename to doctrine/dbal/src/Exception/InvalidArgumentException.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php b/doctrine/dbal/src/Exception/InvalidFieldNameException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php rename to doctrine/dbal/src/Exception/InvalidFieldNameException.php diff --git a/doctrine/dbal/src/Exception/InvalidLockMode.php b/doctrine/dbal/src/Exception/InvalidLockMode.php new file mode 100644 index 000000000..9a4d6c77b --- /dev/null +++ b/doctrine/dbal/src/Exception/InvalidLockMode.php @@ -0,0 +1,24 @@ +|array */ + private $originalParameters; + + /** @var array|array */ + private $originalTypes; + + /** @var int */ + private $originalParameterIndex = 0; + + /** @var list */ + private $convertedSQL = []; + + /** @var list */ + private $convertedParameteres = []; + + /** @var array */ + private $convertedTypes = []; + + /** + * @param array|array $parameters + * @param array|array $types + */ + public function __construct(array $parameters, array $types) + { + $this->originalParameters = $parameters; + $this->originalTypes = $types; + } + + public function acceptPositionalParameter(string $sql): void + { + $index = $this->originalParameterIndex; + + if (! array_key_exists($index, $this->originalParameters)) { + throw MissingPositionalParameter::new($index); + } + + $this->acceptParameter($index, $this->originalParameters[$index]); + + $this->originalParameterIndex++; + } + + public function acceptNamedParameter(string $sql): void + { + $name = substr($sql, 1); + + if (! array_key_exists($name, $this->originalParameters)) { + throw MissingNamedParameter::new($name); + } + + $this->acceptParameter($name, $this->originalParameters[$name]); + } + + public function acceptOther(string $sql): void + { + $this->convertedSQL[] = $sql; + } + + public function getSQL(): string + { + return implode('', $this->convertedSQL); + } + + /** + * @return list + */ + public function getParameters(): array + { + return $this->convertedParameteres; + } + + /** + * @param int|string $key + * @param mixed $value + */ + private function acceptParameter($key, $value): void + { + if (! isset($this->originalTypes[$key])) { + $this->convertedSQL[] = '?'; + $this->convertedParameteres[] = $value; + + return; + } + + $type = $this->originalTypes[$key]; + + if ($type !== Connection::PARAM_INT_ARRAY && $type !== Connection::PARAM_STR_ARRAY) { + $this->appendTypedParameter([$value], $type); + + return; + } + + if (count($value) === 0) { + $this->convertedSQL[] = 'NULL'; + + return; + } + + $this->appendTypedParameter($value, $type - Connection::ARRAY_PARAM_OFFSET); + } + + /** + * @return array + */ + public function getTypes(): array + { + return $this->convertedTypes; + } + + /** + * @param list $values + * @param Type|int|string|null $type + */ + private function appendTypedParameter(array $values, $type): void + { + $this->convertedSQL[] = implode(', ', array_fill(0, count($values), '?')); + + $index = count($this->convertedParameteres); + + foreach ($values as $value) { + $this->convertedParameteres[] = $value; + $this->convertedTypes[$index] = $type; + + $index++; + } + } +} diff --git a/doctrine/dbal/src/FetchMode.php b/doctrine/dbal/src/FetchMode.php new file mode 100644 index 000000000..79fa6a3f3 --- /dev/null +++ b/doctrine/dbal/src/FetchMode.php @@ -0,0 +1,16 @@ +getDriver() instanceof Driver\PDOSqlite\Driver) { + if ($conn->getDriver() instanceof Driver\PDO\SQLite\Driver) { throw new Exception('Cannot use TableGenerator with SQLite.'); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php b/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php rename to doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/LockMode.php b/doctrine/dbal/src/LockMode.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/LockMode.php rename to doctrine/dbal/src/LockMode.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php b/doctrine/dbal/src/Logging/DebugStack.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php rename to doctrine/dbal/src/Logging/DebugStack.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php b/doctrine/dbal/src/Logging/LoggerChain.php similarity index 63% rename from doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php rename to doctrine/dbal/src/Logging/LoggerChain.php index 024afae28..27b8516e4 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php +++ b/doctrine/dbal/src/Logging/LoggerChain.php @@ -7,29 +7,17 @@ */ class LoggerChain implements SQLLogger { - /** @var SQLLogger[] */ + /** @var iterable */ private $loggers = []; /** - * @param SQLLogger[] $loggers + * @param iterable $loggers */ - public function __construct(array $loggers = []) + public function __construct(iterable $loggers = []) { $this->loggers = $loggers; } - /** - * Adds a logger in the chain. - * - * @deprecated Inject list of loggers via constructor instead - * - * @return void - */ - public function addLogger(SQLLogger $logger) - { - $this->loggers[] = $logger; - } - /** * {@inheritdoc} */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php b/doctrine/dbal/src/Logging/SQLLogger.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php rename to doctrine/dbal/src/Logging/SQLLogger.php index 8328a71ba..a0bdf1bf6 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php +++ b/doctrine/dbal/src/Logging/SQLLogger.php @@ -13,7 +13,7 @@ interface SQLLogger * Logs a SQL statement somewhere. * * @param string $sql SQL statement - * @param array|array|null $params Statement parameters + * @param list|array|null $params Statement parameters * @param array|array|null $types Parameter types * * @return void diff --git a/doctrine/dbal/lib/Doctrine/DBAL/ParameterType.php b/doctrine/dbal/src/ParameterType.php similarity index 71% rename from doctrine/dbal/lib/Doctrine/DBAL/ParameterType.php rename to doctrine/dbal/src/ParameterType.php index 2c4c3ad18..77917e870 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/ParameterType.php +++ b/doctrine/dbal/src/ParameterType.php @@ -2,8 +2,6 @@ namespace Doctrine\DBAL; -use PDO; - /** * Contains statement parameter types. */ @@ -11,38 +9,32 @@ final class ParameterType { /** * Represents the SQL NULL data type. - * - * @see \PDO::PARAM_NULL */ - public const NULL = PDO::PARAM_NULL; + public const NULL = 0; /** * Represents the SQL INTEGER data type. - * - * @see \PDO::PARAM_INT */ - public const INTEGER = PDO::PARAM_INT; + public const INTEGER = 1; /** * Represents the SQL CHAR, VARCHAR, or other string data type. * * @see \PDO::PARAM_STR */ - public const STRING = PDO::PARAM_STR; + public const STRING = 2; /** * Represents the SQL large object data type. - * - * @see \PDO::PARAM_LOB */ - public const LARGE_OBJECT = PDO::PARAM_LOB; + public const LARGE_OBJECT = 3; /** * Represents a boolean data type. * * @see \PDO::PARAM_BOOL */ - public const BOOLEAN = PDO::PARAM_BOOL; + public const BOOLEAN = 5; /** * Represents a binary string data type. diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/doctrine/dbal/src/Platforms/AbstractPlatform.php similarity index 93% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php rename to doctrine/dbal/src/Platforms/AbstractPlatform.php index 911daa8cb..042fae29e 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/doctrine/dbal/src/Platforms/AbstractPlatform.php @@ -13,6 +13,8 @@ use Doctrine\DBAL\Event\SchemaDropTableEventArgs; use Doctrine\DBAL\Events; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Exception\InvalidLockMode; +use Doctrine\DBAL\LockMode; use Doctrine\DBAL\Platforms\Keywords\KeywordList; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\ColumnDiff; @@ -23,6 +25,8 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\TableDiff; +use Doctrine\DBAL\Schema\UniqueConstraint; +use Doctrine\DBAL\SQL\Parser; use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types; use Doctrine\DBAL\Types\Type; @@ -71,66 +75,6 @@ abstract class AbstractPlatform public const CREATE_FOREIGNKEYS = 2; - /** - * @deprecated Use DateIntervalUnit::INTERVAL_UNIT_SECOND. - */ - public const DATE_INTERVAL_UNIT_SECOND = DateIntervalUnit::SECOND; - - /** - * @deprecated Use DateIntervalUnit::MINUTE. - */ - public const DATE_INTERVAL_UNIT_MINUTE = DateIntervalUnit::MINUTE; - - /** - * @deprecated Use DateIntervalUnit::HOUR. - */ - public const DATE_INTERVAL_UNIT_HOUR = DateIntervalUnit::HOUR; - - /** - * @deprecated Use DateIntervalUnit::DAY. - */ - public const DATE_INTERVAL_UNIT_DAY = DateIntervalUnit::DAY; - - /** - * @deprecated Use DateIntervalUnit::WEEK. - */ - public const DATE_INTERVAL_UNIT_WEEK = DateIntervalUnit::WEEK; - - /** - * @deprecated Use DateIntervalUnit::MONTH. - */ - public const DATE_INTERVAL_UNIT_MONTH = DateIntervalUnit::MONTH; - - /** - * @deprecated Use DateIntervalUnit::QUARTER. - */ - public const DATE_INTERVAL_UNIT_QUARTER = DateIntervalUnit::QUARTER; - - /** - * @deprecated Use DateIntervalUnit::QUARTER. - */ - public const DATE_INTERVAL_UNIT_YEAR = DateIntervalUnit::YEAR; - - /** - * @deprecated Use TrimMode::UNSPECIFIED. - */ - public const TRIM_UNSPECIFIED = TrimMode::UNSPECIFIED; - - /** - * @deprecated Use TrimMode::LEADING. - */ - public const TRIM_LEADING = TrimMode::LEADING; - - /** - * @deprecated Use TrimMode::TRAILING. - */ - public const TRIM_TRAILING = TrimMode::TRAILING; - - /** - * @deprecated Use TrimMode::BOTH. - */ - public const TRIM_BOTH = TrimMode::BOTH; - /** @var string[]|null */ protected $doctrineTypeMapping; @@ -142,7 +86,7 @@ abstract class AbstractPlatform */ protected $doctrineTypeComments; - /** @var EventManager */ + /** @var EventManager|null */ protected $_eventManager; /** @@ -169,7 +113,7 @@ public function setEventManager(EventManager $eventManager) /** * Gets the EventManager used by the Platform. * - * @return EventManager + * @return EventManager|null */ public function getEventManager() { @@ -303,7 +247,7 @@ public function getBinaryTypeDeclarationSQL(array $column) if ($maxLength > 0) { @trigger_error(sprintf( 'Binary column length %d is greater than supported by the platform (%d).' - . ' Reduce the column length or use a BLOB column instead.', + . ' Reduce the column length or use a BLOB column instead.', $column['length'], $maxLength ), E_USER_DEPRECATED); @@ -349,8 +293,8 @@ public function getJsonTypeDeclarationSQL(array $column) } /** - * @param int $length - * @param bool $fixed + * @param int|false $length + * @param bool $fixed * * @return string * @@ -364,8 +308,8 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) /** * Returns the SQL snippet used to declare a BINARY/VARBINARY column type. * - * @param int $length The length of the column. - * @param bool $fixed Whether the column length is fixed. + * @param int|false $length The length of the column. + * @param bool $fixed Whether the column length is fixed. * * @return string * @@ -510,7 +454,7 @@ public function isCommentedDoctrineType(Type $doctrineType) assert(is_array($this->doctrineTypeComments)); - return in_array($doctrineType->getName(), $this->doctrineTypeComments); + return in_array($doctrineType->getName(), $this->doctrineTypeComments, true); } /** @@ -657,20 +601,6 @@ public function getRegexpExpression() throw Exception::notSupported(__METHOD__); } - /** - * Returns the global unique identifier expression. - * - * @deprecated Use application-generated UUIDs instead - * - * @return string - * - * @throws Exception If not supported on this platform. - */ - public function getGuidExpression() - { - throw Exception::notSupported(__METHOD__); - } - /** * Returns the SQL snippet to get the average value of a column. * @@ -830,7 +760,7 @@ public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = f $expression .= $char . ' '; } - if ($mode || $char !== false) { + if ($mode !== TrimMode::UNSPECIFIED || $char !== false) { $expression .= 'FROM '; } @@ -1358,6 +1288,11 @@ public function getBitOrComparisonExpression($value1, $value2) return '(' . $value1 . ' | ' . $value2 . ')'; } + /** + * Returns the SQL expression which represents the currently selected database. + */ + abstract public function getCurrentDatabaseExpression(): string; + /** * Returns the FOR UPDATE expression. * @@ -1372,15 +1307,21 @@ public function getForUpdateSQL() * Honors that some SQL vendors such as MsSql use table hints for locking instead of the * ANSI SQL FOR UPDATE specification. * - * @param string $fromClause The FROM clause to append the hint for the given lock mode to. - * @param int|null $lockMode One of the Doctrine\DBAL\LockMode::* constants. If null is given, nothing will - * be appended to the FROM clause. - * - * @return string + * @param string $fromClause The FROM clause to append the hint for the given lock mode to + * @param int $lockMode One of the Doctrine\DBAL\LockMode::* constants */ - public function appendLockHint($fromClause, $lockMode) + public function appendLockHint(string $fromClause, int $lockMode): string { - return $fromClause; + switch ($lockMode) { + case LockMode::NONE: + case LockMode::OPTIMISTIC: + case LockMode::PESSIMISTIC_READ: + case LockMode::PESSIMISTIC_WRITE: + return $fromClause; + + default: + throw InvalidLockMode::fromLockMode($lockMode); + } } /** @@ -1575,12 +1516,26 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE if (($createFlags & self::CREATE_INDEXES) > 0) { foreach ($table->getIndexes() as $index) { - if ($index->isPrimary()) { - $options['primary'] = $index->getQuotedColumns($this); - $options['primary_index'] = $index; - } else { + if (! $index->isPrimary()) { $options['indexes'][$index->getQuotedName($this)] = $index; + + continue; } + + $options['primary'] = $index->getQuotedColumns($this); + $options['primary_index'] = $index; + } + + foreach ($table->getUniqueConstraints() as $uniqueConstraint) { + $options['uniqueConstraints'][$uniqueConstraint->getQuotedName($this)] = $uniqueConstraint; + } + } + + if (($createFlags & self::CREATE_FOREIGNKEYS) > 0) { + $options['foreignKeys'] = []; + + foreach ($table->getForeignKeys() as $fkConstraint) { + $options['foreignKeys'][] = $fkConstraint; } } @@ -1593,6 +1548,7 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn) ) { $eventArgs = new SchemaCreateTableColumnEventArgs($column, $table, $this); + $this->_eventManager->dispatchEvent(Events::onSchemaCreateTableColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -1614,22 +1570,16 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE $columnData['length'] = 255; } - if (in_array($column->getName(), $options['primary'])) { + if (in_array($column->getName(), $options['primary'], true)) { $columnData['primary'] = true; } $columns[$name] = $columnData; } - if (($createFlags & self::CREATE_FOREIGNKEYS) > 0) { - $options['foreignKeys'] = []; - foreach ($table->getForeignKeys() as $fkConstraint) { - $options['foreignKeys'][] = $fkConstraint; - } - } - if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaCreateTable)) { $eventArgs = new SchemaCreateTableEventArgs($table, $columns, $options, $this); + $this->_eventManager->dispatchEvent(Events::onSchemaCreateTable, $eventArgs); if ($eventArgs->isDefaultPrevented()) { @@ -1638,6 +1588,7 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE } $sql = $this->_getCreateTableSQL($tableName, $columns, $options); + if ($this->supportsCommentOnStatement()) { if ($table->hasOption('comment')) { $sql[] = $this->getCommentOnTableSQL($tableName, $table->getOption('comment')); @@ -1736,8 +1687,8 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] } $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; - $check = $this->getCheckDeclarationSQL($columns); + if (! empty($check)) { $query .= ', ' . $check; } @@ -2189,21 +2140,6 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) ]; } - /** - * Common code for alter table statement generation that updates the changed Index and Foreign Key definitions. - * - * @deprecated - * - * @return string[] - */ - protected function _getAlterTableIndexForeignKeySQL(TableDiff $diff) - { - return array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - } - /** * Gets declaration of a number of columns in bulk. * @@ -2276,6 +2212,8 @@ public function getColumnDeclarationListSQL(array $columns) * a string that defines the complete column * * @return string DBMS specific SQL code portion that should be used to declare the column. + * + * @throws Exception */ public function getColumnDeclarationSQL($name, array $column) { @@ -2284,19 +2222,18 @@ public function getColumnDeclarationSQL($name, array $column) } else { $default = $this->getDefaultValueDeclarationSQL($column); - $charset = isset($column['charset']) && $column['charset'] ? + $charset = ! empty($column['charset']) ? ' ' . $this->getColumnCharsetDeclarationSQL($column['charset']) : ''; - $collation = isset($column['collation']) && $column['collation'] ? + $collation = ! empty($column['collation']) ? ' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : ''; - $notnull = isset($column['notnull']) && $column['notnull'] ? ' NOT NULL' : ''; + $notnull = ! empty($column['notnull']) ? ' NOT NULL' : ''; - $unique = isset($column['unique']) && $column['unique'] ? + $unique = ! empty($column['unique']) ? ' ' . $this->getUniqueFieldDeclarationSQL() : ''; - $check = isset($column['check']) && $column['check'] ? - ' ' . $column['check'] : ''; + $check = ! empty($column['check']) ? ' ' . $column['check'] : ''; $typeDecl = $column['type']->getSQLDeclaration($column, $this); $declaration = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation; @@ -2403,25 +2340,27 @@ public function getCheckDeclarationSQL(array $definition) * Obtains DBMS specific SQL code portion needed to set a unique * constraint declaration to be used in statements like CREATE TABLE. * - * @param string $name The name of the unique constraint. - * @param Index $index The index definition. + * @param string $name The name of the unique constraint. + * @param UniqueConstraint $constraint The unique constraint definition. * * @return string DBMS specific SQL code portion needed to set a constraint. * * @throws InvalidArgumentException */ - public function getUniqueConstraintDeclarationSQL($name, Index $index) + public function getUniqueConstraintDeclarationSQL($name, UniqueConstraint $constraint) { - $columns = $index->getColumns(); + $columns = $constraint->getQuotedColumns($this); $name = new Identifier($name); if (count($columns) === 0) { throw new InvalidArgumentException("Incomplete definition. 'columns' required."); } - return 'CONSTRAINT ' . $name->getQuotedName($this) . ' UNIQUE (' - . $this->getIndexFieldDeclarationListSQL($index) - . ')' . $this->getPartialIndexSQL($index); + $constraintFlags = array_merge(['UNIQUE'], array_map('strtoupper', $constraint->getFlags())); + $constraintName = $name->getQuotedName($this); + $columnListNames = $this->getColumnsFieldDeclarationListSQL($columns); + + return sprintf('CONSTRAINT %s %s (%s)', $constraintName, implode(' ', $constraintFlags), $columnListNames); } /** @@ -2444,9 +2383,8 @@ public function getIndexDeclarationSQL($name, Index $index) throw new InvalidArgumentException("Incomplete definition. 'columns' required."); } - return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name->getQuotedName($this) . ' (' - . $this->getIndexFieldDeclarationListSQL($index) - . ')' . $this->getPartialIndexSQL($index); + return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name->getQuotedName($this) + . ' (' . $this->getIndexFieldDeclarationListSQL($index) . ')' . $this->getPartialIndexSQL($index); } /** @@ -2466,22 +2404,23 @@ public function getCustomTypeDeclarationSQL(array $column) /** * Obtains DBMS specific SQL code portion needed to set an index * declaration to be used in statements like CREATE TABLE. - * - * @param mixed[]|Index $columnsOrIndex array declaration is deprecated, prefer passing Index to this method */ - public function getIndexFieldDeclarationListSQL($columnsOrIndex): string + public function getIndexFieldDeclarationListSQL(Index $index): string { - if ($columnsOrIndex instanceof Index) { - return implode(', ', $columnsOrIndex->getQuotedColumns($this)); - } - - if (! is_array($columnsOrIndex)) { - throw new InvalidArgumentException('Fields argument should be an Index or array.'); - } + return implode(', ', $index->getQuotedColumns($this)); + } + /** + * Obtains DBMS specific SQL code portion needed to set an index + * declaration to be used in statements like CREATE TABLE. + * + * @param mixed[] $columns + */ + public function getColumnsFieldDeclarationListSQL(array $columns): string + { $ret = []; - foreach ($columnsOrIndex as $column => $definition) { + foreach ($columns as $column => $definition) { if (is_array($definition)) { $ret[] = $column; } else { @@ -2549,7 +2488,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) { $query = ''; - if ($this->supportsForeignKeyOnUpdate() && $foreignKey->hasOption('onUpdate')) { + if ($foreignKey->hasOption('onUpdate')) { $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onUpdate')); } @@ -2596,7 +2535,7 @@ public function getForeignKeyReferentialActionSQL($action) public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey) { $sql = ''; - if (strlen($foreignKey->getName())) { + if (strlen($foreignKey->getName()) > 0) { $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' '; } @@ -2660,19 +2599,6 @@ public function getColumnCollationDeclarationSQL($collation) return $this->supportsColumnCollation() ? 'COLLATE ' . $collation : ''; } - /** - * Whether the platform prefers sequences for ID generation. - * Subclasses should override this method to return TRUE if they prefer sequences. - * - * @deprecated - * - * @return bool - */ - public function prefersSequences() - { - return false; - } - /** * Whether the platform prefers identity columns (eg. autoincrement) for ID generation. * Subclasses should override this method to return TRUE if they prefer identity columns. @@ -3130,7 +3056,7 @@ public function usesSequenceEmulatedIdentityColumns() /** * Returns the name of the sequence for a particular identity column in a particular table. * - * @see usesSequenceEmulatedIdentityColumns + * @see usesSequenceEmulatedIdentityColumns * * @param string $tableName The name of the table to return the sequence name for. * @param string $columnName The name of the identity column in the table to return the sequence name for. @@ -3232,18 +3158,6 @@ public function supportsForeignKeyConstraints() return true; } - /** - * Whether this platform supports onUpdate in foreign key constraints. - * - * @deprecated - * - * @return bool - */ - public function supportsForeignKeyOnUpdate() - { - return $this->supportsForeignKeyConstraints(); - } - /** * Whether the platform supports database schemas. * @@ -3341,18 +3255,6 @@ public function hasNativeJsonType() return false; } - /** - * @deprecated - * - * @return string - * - * @todo Remove in 3.0 - */ - public function getIdentityColumnNullInsertSQL() - { - return ''; - } - /** * Whether this platform supports views. * @@ -3422,20 +3324,14 @@ public function getTimeFormatString() * * @param string $query * @param int|null $limit - * @param int|null $offset + * @param int $offset * * @return string * * @throws Exception */ - final public function modifyLimitQuery($query, $limit, $offset = null) + final public function modifyLimitQuery($query, $limit, $offset = 0) { - if ($limit !== null) { - $limit = (int) $limit; - } - - $offset = (int) $offset; - if ($offset < 0) { throw new Exception(sprintf( 'Offset must be a positive integer or zero, %d given', @@ -3458,7 +3354,7 @@ final public function modifyLimitQuery($query, $limit, $offset = null) * * @param string $query * @param int|null $limit - * @param int|null $offset + * @param int $offset * * @return string */ @@ -3485,35 +3381,6 @@ public function supportsLimitOffset() return true; } - /** - * Gets the character casing of a column in an SQL result set of this platform. - * - * @deprecated - * - * @param string $column The column name for which to get the correct character casing. - * - * @return string The column name in the character casing used in SQL result sets. - */ - public function getSQLResultCasing($column) - { - return $column; - } - - /** - * Makes any fixes to a name of a schema element (table, sequence, ...) that are required - * by restrictions of the platform, like a maximum length. - * - * @deprecated - * - * @param string $schemaElementName - * - * @return string - */ - public function fixSchemaElementName($schemaElementName) - { - return $schemaElementName; - } - /** * Maximum length of any given database identifier, like tables or column names. * @@ -3613,7 +3480,7 @@ public function rollbackSavePoint($savepoint) final public function getReservedKeywordsList() { // Check for an existing instantiation of the keywords class. - if ($this->_keywords) { + if ($this->_keywords !== null) { return $this->_keywords; } @@ -3685,6 +3552,14 @@ final public function escapeStringForLike(string $inputString, string $escapeCha ); } + /** + * @internal + */ + public function createSQLParser(): Parser + { + return new Parser(false); + } + protected function getLikeWildcardCharacters(): string { return '%_'; diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/doctrine/dbal/src/Platforms/DB2Platform.php similarity index 95% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php rename to doctrine/dbal/src/Platforms/DB2Platform.php index 3d75866e1..16d4839fa 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php +++ b/doctrine/dbal/src/Platforms/DB2Platform.php @@ -19,7 +19,6 @@ use function implode; use function sprintf; use function strpos; -use function strtoupper; class DB2Platform extends AbstractPlatform { @@ -72,21 +71,21 @@ public function getBlobTypeDeclarationSQL(array $column) public function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'smallint' => 'smallint', - 'bigint' => 'bigint', - 'integer' => 'integer', - 'time' => 'time', - 'date' => 'date', - 'varchar' => 'string', - 'character' => 'string', - 'varbinary' => 'binary', - 'binary' => 'binary', - 'clob' => 'text', - 'blob' => 'blob', - 'decimal' => 'decimal', - 'double' => 'float', - 'real' => 'float', - 'timestamp' => 'datetime', + 'bigint' => 'bigint', + 'binary' => 'binary', + 'blob' => 'blob', + 'character' => 'string', + 'clob' => 'text', + 'date' => 'date', + 'decimal' => 'decimal', + 'double' => 'float', + 'integer' => 'integer', + 'real' => 'float', + 'smallint' => 'smallint', + 'time' => 'time', + 'timestamp' => 'datetime', + 'varbinary' => 'binary', + 'varchar' => 'string', ]; } @@ -109,8 +108,8 @@ public function isCommentedDoctrineType(Type $doctrineType) */ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(254)') - : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(254)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); } /** @@ -668,7 +667,7 @@ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) $alterClause = 'ALTER COLUMN ' . $columnDiff->column->getQuotedName($this); - if ($column['columnDefinition']) { + if ($column['columnDefinition'] !== null) { return [$alterClause . ' ' . $column['columnDefinition']]; } @@ -692,7 +691,7 @@ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) if (isset($column['default'])) { $defaultClause = $this->getDefaultValueDeclarationSQL($column); - if ($defaultClause) { + if ($defaultClause !== '') { $clauses[] = $alterClause . ' SET' . $defaultClause; } } else { @@ -760,7 +759,7 @@ public function getDefaultValueDeclarationSQL($column) return ''; } - if (isset($column['version']) && $column['version']) { + if (! empty($column['version'])) { if ((string) $column['type'] !== 'DateTime') { $column['default'] = '1'; } @@ -796,7 +795,7 @@ public function getTemporaryTableName($tableName) /** * {@inheritDoc} */ - protected function doModifyLimitQuery($query, $limit, $offset = null) + protected function doModifyLimitQuery($query, $limit, $offset) { $where = []; @@ -844,32 +843,25 @@ public function getSubstringExpression($string, $start, $length = null) return 'SUBSTR(' . $string . ', ' . $start . ', ' . $length . ')'; } - /** - * {@inheritDoc} - */ - public function supportsIdentityColumns() + public function getCurrentDatabaseExpression(): string { - return true; + return 'CURRENT_USER'; } /** * {@inheritDoc} */ - public function prefersIdentityColumns() + public function supportsIdentityColumns() { return true; } /** * {@inheritDoc} - * - * DB2 returns all column names in SQL result sets in uppercase. - * - * @deprecated */ - public function getSQLResultCasing($column) + public function prefersIdentityColumns() { - return strtoupper($column); + return true; } /** diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php b/doctrine/dbal/src/Platforms/DateIntervalUnit.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php rename to doctrine/dbal/src/Platforms/DateIntervalUnit.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php b/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php index 8533f579d..db577d302 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php +++ b/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php @@ -27,24 +27,6 @@ protected function getKeywords() 'ALIAS', 'ALL', 'ALLOCATE', - 'DOCUMENT', - 'DOUBLE', - 'DROP', - 'DSSIZE', - 'DYNAMIC', - 'EACH', - 'LOCK', - 'LOCKMAX', - 'LOCKSIZE', - 'LONG', - 'LOOP', - 'MAINTAINED', - 'ROUND_CEILING', - 'ROUND_DOWN', - 'ROUND_FLOOR', - 'ROUND_HALF_DOWN', - 'ROUND_HALF_EVEN', - 'ROUND_HALF_UP', 'ALLOW', 'ALTER', 'AND', @@ -112,6 +94,38 @@ protected function getKeywords() 'DATABASE', 'DATAPARTITIONNAME', 'DATAPARTITIONNUM', + 'DATE', + 'DAY', + 'DAYS', + 'DB2GENERAL', + 'DB2GENRL', + 'DB2SQL', + 'DBINFO', + 'DBPARTITIONNAME', + 'DBPARTITIONNUM', + 'DEALLOCATE', + 'DECLARE', + 'DEFAULT', + 'DEFAULTS', + 'DEFINITION', + 'DELETE', + 'DENSE_RANK', + 'DENSERANK', + 'DESCRIBE', + 'DESCRIPTOR', + 'DETERMINISTIC', + 'DIAGNOSTICS', + 'DISABLE', + 'DISALLOW', + 'DISCONNECT', + 'DISTINCT', + 'DO', + 'DOCUMENT', + 'DOUBLE', + 'DROP', + 'DSSIZE', + 'DYNAMIC', + 'EACH', 'EDITPROC', 'ELSE', 'ELSEIF', @@ -179,6 +193,38 @@ protected function getKeywords() 'INSENSITIVE', 'INSERT', 'INTEGRITY', + 'INTERSECT', + 'INTO', + 'IS', + 'ISOBID', + 'ISOLATION', + 'ITERATE', + 'JAR', + 'JAVA', + 'JOIN', + 'KEEP', + 'KEY', + 'LABEL', + 'LANGUAGE', + 'LATERAL', + 'LC_CTYPE', + 'LEAVE', + 'LEFT', + 'LIKE', + 'LINKTYPE', + 'LOCAL', + 'LOCALDATE', + 'LOCALE', + 'LOCALTIME', + 'LOCALTIMESTAMP RIGHT', + 'LOCATOR', + 'LOCATORS', + 'LOCK', + 'LOCKMAX', + 'LOCKSIZE', + 'LONG', + 'LOOP', + 'MAINTAINED', 'MATERIALIZED', 'MAXVALUE', 'MICROSECOND', @@ -246,6 +292,37 @@ protected function getKeywords() 'PROCEDURE', 'PROGRAM', 'PSID', + 'PUBLIC', + 'QUERY', + 'QUERYNO', + 'RANGE', + 'RANK', + 'READ', + 'READS', + 'RECOVERY', + 'REFERENCES', + 'REFERENCING', + 'REFRESH', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'RESET', + 'RESIGNAL', + 'RESTART', + 'RESTRICT', + 'RESULT', + 'RESULT_SET_LOCATOR WLM', + 'RETURN', + 'RETURNS', + 'REVOKE', + 'ROLE', + 'ROLLBACK', + 'ROUND_CEILING', + 'ROUND_DOWN', + 'ROUND_FLOOR', + 'ROUND_HALF_DOWN', + 'ROUND_HALF_EVEN', + 'ROUND_HALF_UP', 'ROUND_UP', 'ROUTINE', 'ROW', @@ -313,107 +390,30 @@ protected function getKeywords() 'UNIQUE', 'UNTIL', 'UPDATE', - 'DATE', - 'DAY', - 'DAYS', - 'DB2GENERAL', - 'DB2GENRL', - 'DB2SQL', - 'DBINFO', - 'DBPARTITIONNAME', - 'DBPARTITIONNUM', - 'DEALLOCATE', - 'DECLARE', - 'DEFAULT', - 'DEFAULTS', - 'DEFINITION', - 'DELETE', - 'DENSE_RANK', - 'DENSERANK', - 'DESCRIBE', - 'DESCRIPTOR', - 'DETERMINISTIC', - 'DIAGNOSTICS', - 'DISABLE', - 'DISALLOW', - 'DISCONNECT', - 'DISTINCT', - 'DO', - 'INTERSECT', - 'PUBLIC', 'USAGE', - 'INTO', - 'QUERY', 'USER', - 'IS', - 'QUERYNO', 'USING', - 'ISOBID', - 'RANGE', 'VALIDPROC', - 'ISOLATION', - 'RANK', 'VALUE', - 'ITERATE', - 'READ', 'VALUES', - 'JAR', - 'READS', 'VARIABLE', - 'JAVA', - 'RECOVERY', 'VARIANT', - 'JOIN', - 'REFERENCES', 'VCAT', - 'KEEP', - 'REFERENCING', 'VERSION', - 'KEY', - 'REFRESH', 'VIEW', - 'LABEL', - 'RELEASE', 'VOLATILE', - 'LANGUAGE', - 'RENAME', 'VOLUMES', - 'LATERAL', - 'REPEAT', 'WHEN', - 'LC_CTYPE', - 'RESET', 'WHENEVER', - 'LEAVE', - 'RESIGNAL', 'WHERE', - 'LEFT', - 'RESTART', 'WHILE', - 'LIKE', - 'RESTRICT', 'WITH', - 'LINKTYPE', - 'RESULT', 'WITHOUT', - 'LOCAL', - 'RESULT_SET_LOCATOR WLM', - 'LOCALDATE', - 'RETURN', 'WRITE', - 'LOCALE', - 'RETURNS', 'XMLELEMENT', - 'LOCALTIME', - 'REVOKE', 'XMLEXISTS', - 'LOCALTIMESTAMP RIGHT', 'XMLNAMESPACES', - 'LOCATOR', - 'ROLE', 'YEAR', - 'LOCATORS', - 'ROLLBACK', 'YEARS', ]; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php b/doctrine/dbal/src/Platforms/Keywords/KeywordList.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php rename to doctrine/dbal/src/Platforms/Keywords/KeywordList.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php b/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php b/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php b/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php b/doctrine/dbal/src/Platforms/Keywords/MySQLKeywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php rename to doctrine/dbal/src/Platforms/Keywords/MySQLKeywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php b/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php similarity index 98% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php rename to doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php index 92ca81a07..a73a93d60 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php +++ b/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php @@ -22,118 +22,118 @@ protected function getKeywords() { return [ 'ACCESS', - 'ELSE', - 'MODIFY', - 'START', 'ADD', - 'EXCLUSIVE', - 'NOAUDIT', - 'SELECT', 'ALL', - 'EXISTS', - 'NOCOMPRESS', - 'SESSION', 'ALTER', - 'FILE', - 'NOT', - 'SET', 'AND', - 'FLOAT', - 'NOTFOUND ', - 'SHARE', 'ANY', - 'FOR', - 'NOWAIT', - 'SIZE', 'ARRAYLEN', - 'FROM', - 'NULL', - 'SMALLINT', 'AS', - 'GRANT', - 'NUMBER', - 'SQLBUF', 'ASC', - 'GROUP', - 'OF', - 'SUCCESSFUL', 'AUDIT', - 'HAVING', - 'OFFLINE ', - 'SYNONYM', 'BETWEEN', - 'IDENTIFIED', - 'ON', - 'SYSDATE', 'BY', - 'IMMEDIATE', - 'ONLINE', - 'TABLE', 'CHAR', - 'IN', - 'OPTION', - 'THEN', 'CHECK', - 'INCREMENT', - 'OR', - 'TO', 'CLUSTER', - 'INDEX', - 'ORDER', - 'TRIGGER', 'COLUMN', - 'INITIAL', - 'PCTFREE', - 'UID', 'COMMENT', - 'INSERT', - 'PRIOR', - 'UNION', 'COMPRESS', - 'INTEGER', - 'PRIVILEGES', - 'UNIQUE', 'CONNECT', - 'INTERSECT', - 'PUBLIC', - 'UPDATE', 'CREATE', - 'INTO', - 'RAW', - 'USER', 'CURRENT', - 'IS', - 'RENAME', - 'VALIDATE', 'DATE', - 'LEVEL', - 'RESOURCE', - 'VALUES', 'DECIMAL', - 'LIKE', - 'REVOKE', - 'VARCHAR', 'DEFAULT', - 'LOCK', - 'ROW', - 'VARCHAR2', 'DELETE', - 'LONG', - 'ROWID', - 'VIEW', 'DESC', - 'MAXEXTENTS', - 'ROWLABEL', - 'WHENEVER', 'DISTINCT', - 'MINUS', - 'ROWNUM', - 'WHERE', 'DROP', + 'ELSE', + 'EXCLUSIVE', + 'EXISTS', + 'FILE', + 'FLOAT', + 'FOR', + 'FROM', + 'GRANT', + 'GROUP', + 'HAVING', + 'IDENTIFIED', + 'IMMEDIATE', + 'IN', + 'INCREMENT', + 'INDEX', + 'INITIAL', + 'INSERT', + 'INTEGER', + 'INTERSECT', + 'INTO', + 'IS', + 'LEVEL', + 'LIKE', + 'LOCK', + 'LONG', + 'MAXEXTENTS', + 'MINUS', 'MODE', + 'MODIFY', + 'NOAUDIT', + 'NOCOMPRESS', + 'NOT', + 'NOTFOUND', + 'NOWAIT', + 'NULL', + 'NUMBER', + 'OF', + 'OFFLINE', + 'ON', + 'ONLINE', + 'OPTION', + 'OR', + 'ORDER', + 'PCTFREE', + 'PRIOR', + 'PRIVILEGES', + 'PUBLIC', + 'RANGE', + 'RAW', + 'RENAME', + 'RESOURCE', + 'REVOKE', + 'ROW', + 'ROWID', + 'ROWLABEL', + 'ROWNUM', 'ROWS', + 'SELECT', + 'SESSION', + 'SET', + 'SHARE', + 'SIZE', + 'SMALLINT', + 'SQLBUF', + 'START', + 'SUCCESSFUL', + 'SYNONYM', + 'SYSDATE', + 'TABLE', + 'THEN', + 'TO', + 'TRIGGER', + 'UID', + 'UNION', + 'UNIQUE', + 'UPDATE', + 'USER', + 'VALIDATE', + 'VALUES', + 'VARCHAR', + 'VARCHAR2', + 'VIEW', + 'WHENEVER', + 'WHERE', 'WITH', - 'RANGE', ]; } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL100Keywords.php b/doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL100Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php b/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php similarity index 91% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php rename to doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php index 75a93f5f1..eeff23cab 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php +++ b/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php @@ -3,22 +3,20 @@ namespace Doctrine\DBAL\Platforms\Keywords; /** - * PostgreSQL 9.1 reserved keywords list. + * PostgreSQL 9.4 reserved keywords list. */ -class PostgreSQL91Keywords extends PostgreSQLKeywords +class PostgreSQL94Keywords extends KeywordList { /** * {@inheritdoc} */ public function getName() { - return 'PostgreSQL91'; + return 'PostgreSQL'; } /** * {@inheritdoc} - * - * @link http://www.postgresql.org/docs/9.1/static/sql-keywords-appendix.html */ protected function getKeywords() { @@ -39,6 +37,7 @@ protected function getKeywords() 'CAST', 'CHECK', 'COLLATE', + 'COLLATION', 'COLUMN', 'CONCURRENTLY', 'CONSTRAINT', @@ -78,6 +77,7 @@ protected function getKeywords() 'IS', 'ISNULL', 'JOIN', + 'LATERAL', 'LEADING', 'LEFT', 'LIKE', @@ -94,7 +94,6 @@ protected function getKeywords() 'OR', 'ORDER', 'OUTER', - 'OVER', 'OVERLAPS', 'PLACING', 'PRIMARY', diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php b/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php rename to doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php index c9053125d..ff03432e1 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php +++ b/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Visitor\Visitor; +use function count; use function implode; use function str_replace; @@ -68,7 +69,7 @@ private function isReservedWord($word) */ private function addViolation($asset, $violatedPlatforms) { - if (! $violatedPlatforms) { + if (count($violatedPlatforms) === 0) { return; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php b/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php similarity index 93% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php rename to doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php index 1e477309c..24e190bf5 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php +++ b/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php @@ -3,11 +3,9 @@ namespace Doctrine\DBAL\Platforms\Keywords; /** - * Microsoft SQL Server 2000 reserved keyword dictionary. - * - * @link www.doctrine-project.com + * Microsoft SQL Server 2012 reserved keyword dictionary. */ -class SQLServerKeywords extends KeywordList +class SQLServer2012Keywords extends KeywordList { /** * {@inheritdoc} @@ -121,6 +119,7 @@ protected function getKeywords() 'LIKE', 'LINENO', 'LOAD', + 'MERGE', 'NATIONAL', 'NOCHECK ', 'NONCLUSTERED', @@ -170,6 +169,9 @@ protected function getKeywords() 'SCHEMA', 'SECURITYAUDIT', 'SELECT', + 'SEMANTICKEYPHRASETABLE', + 'SEMANTICSIMILARITYDETAILSTABLE', + 'SEMANTICSIMILARITYTABLE', 'SESSION_USER', 'SET', 'SETUSER', @@ -187,6 +189,7 @@ protected function getKeywords() 'TRANSACTION', 'TRIGGER', 'TRUNCATE', + 'TRY_CONVERT', 'TSEQUAL', 'UNION', 'UNIQUE', @@ -203,6 +206,7 @@ protected function getKeywords() 'WHERE', 'WHILE', 'WITH', + 'WITHIN GROUP', 'WRITETEXT', ]; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php b/doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php rename to doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php similarity index 93% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php rename to doctrine/dbal/src/Platforms/MariaDb1027Platform.php index 32a7c065a..054f65395 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php +++ b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php @@ -9,7 +9,7 @@ * * Note: Should not be used with versions prior to 10.2.7. */ -final class MariaDb1027Platform extends MySqlPlatform +final class MariaDb1027Platform extends MySQLPlatform { /** * {@inheritdoc} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php b/doctrine/dbal/src/Platforms/MySQL57Platform.php similarity index 89% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php rename to doctrine/dbal/src/Platforms/MySQL57Platform.php index 5ef44b2e3..a3ec50441 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php +++ b/doctrine/dbal/src/Platforms/MySQL57Platform.php @@ -4,12 +4,13 @@ use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\TableDiff; +use Doctrine\DBAL\SQL\Parser; use Doctrine\DBAL\Types\Types; /** * Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform. */ -class MySQL57Platform extends MySqlPlatform +class MySQL57Platform extends MySQLPlatform { /** * {@inheritdoc} @@ -27,6 +28,11 @@ public function getJsonTypeDeclarationSQL(array $column) return 'JSON'; } + public function createSQLParser(): Parser + { + return new Parser(true); + } + /** * {@inheritdoc} */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php b/doctrine/dbal/src/Platforms/MySQL80Platform.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php rename to doctrine/dbal/src/Platforms/MySQL80Platform.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/doctrine/dbal/src/Platforms/MySQLPlatform.php similarity index 91% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php rename to doctrine/dbal/src/Platforms/MySQLPlatform.php index 8d338c840..d9607c3ef 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/doctrine/dbal/src/Platforms/MySQLPlatform.php @@ -2,6 +2,7 @@ namespace Doctrine\DBAL\Platforms; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Index; @@ -28,13 +29,13 @@ use function trim; /** - * The MySqlPlatform provides the behavior, features and SQL dialect of the + * The MySQLPlatform provides the behavior, features and SQL dialect of the * MySQL database platform. This platform represents a MySQL 5.0 or greater platform that * uses the InnoDB storage engine. * * @todo Rename: MySQLPlatform */ -class MySqlPlatform extends AbstractPlatform +class MySQLPlatform extends AbstractPlatform { public const LENGTH_LIMIT_TINYTEXT = 255; public const LENGTH_LIMIT_TEXT = 65535; @@ -79,16 +80,6 @@ public function getRegexpExpression() return 'RLIKE'; } - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'UUID()'; - } - /** * {@inheritDoc} */ @@ -127,6 +118,11 @@ public function getDateDiffExpression($date1, $date2) return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; } + public function getCurrentDatabaseExpression(): string + { + return 'DATABASE()'; + } + /** * {@inheritDoc} */ @@ -151,7 +147,7 @@ public function getListTableConstraintsSQL($table) */ public function getListTableIndexesSQL($table, $database = null) { - if ($database) { + if ($database !== null) { $database = $this->quoteStringLiteral($database); $table = $this->quoteStringLiteral($table); @@ -224,8 +220,8 @@ public function getDropViewSQL($name) */ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') - : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); } /** @@ -233,7 +229,9 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) */ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')'; + return $fixed + ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' + : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; } /** @@ -302,26 +300,10 @@ public function getBooleanTypeDeclarationSQL(array $column) return 'TINYINT(1)'; } - /** - * Obtain DBMS specific SQL code portion needed to set the COLLATION - * of a column declaration to be used in statements like CREATE TABLE. - * - * @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead. - * - * @param string $collation name of the collation - * - * @return string DBMS specific SQL code portion needed to set the COLLATION - * of a column declaration. - */ - public function getCollationFieldDeclaration($collation) - { - return $this->getColumnCollationDeclarationSQL($collation); - } - /** * {@inheritDoc} * - * MySql prefers "autoincrement" identity columns since sequences can only + * MySQL prefers "autoincrement" identity columns since sequences can only * be emulated with a table. */ public function prefersIdentityColumns() @@ -332,7 +314,7 @@ public function prefersIdentityColumns() /** * {@inheritDoc} * - * MySql supports this through AUTO_INCREMENT columns. + * MySQL supports this through AUTO_INCREMENT columns. */ public function supportsIdentityColumns() { @@ -370,7 +352,7 @@ public function getListTableColumnsSQL($table, $database = null) { $table = $this->quoteStringLiteral($table); - if ($database) { + if ($database !== null) { $database = $this->quoteStringLiteral($database); } else { $database = 'DATABASE()'; @@ -392,7 +374,7 @@ public function getListTableMetadataSQL(string $table, ?string $database = null) WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = %s AND TABLE_NAME = %s SQL , - $database ? $this->quoteStringLiteral($database) : 'DATABASE()', + $database !== null ? $this->quoteStringLiteral($database) : 'DATABASE()', $this->quoteStringLiteral($table) ); } @@ -421,15 +403,15 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] $queryFields = $this->getColumnDeclarationListSQL($columns); if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $index => $definition) { - $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition); + foreach ($options['uniqueConstraints'] as $constraintName => $definition) { + $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); } } // add all indexes if (isset($options['indexes']) && ! empty($options['indexes'])) { - foreach ($options['indexes'] as $index => $definition) { - $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition); + foreach ($options['indexes'] as $indexName => $definition) { + $queryFields .= ', ' . $this->getIndexDeclarationSQL($indexName, $definition); } } @@ -715,6 +697,8 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) /** * @return string[] + * + * @throws Exception */ private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index) { @@ -754,6 +738,8 @@ private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $inde * @param TableDiff $diff The table diff to gather the SQL for. * * @return string[] + * + * @throws Exception */ private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) { @@ -766,11 +752,9 @@ private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) continue; } - foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName) { - $column = $diff->fromTable->getColumn($columnName); - + foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName => $column) { // Check if an autoincrement column was dropped from the primary key. - if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns())) { + if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns(), true)) { continue; } @@ -1022,7 +1006,7 @@ public function getDropIndexSQL($index, $table = null) } if ($index instanceof Index && $index->isPrimary()) { - // mysql primary keys are always named "PRIMARY", + // MySQL primary keys are always named "PRIMARY", // so we cannot use them in statements because of them being keyword. return $this->getDropPrimaryKeySQL($table); } @@ -1070,36 +1054,36 @@ public function getReadLockSQL() protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'tinyint' => 'boolean', - 'smallint' => 'smallint', - 'mediumint' => 'integer', - 'int' => 'integer', - 'integer' => 'integer', - 'bigint' => 'bigint', - 'tinytext' => 'text', - 'mediumtext' => 'text', - 'longtext' => 'text', - 'text' => 'text', - 'varchar' => 'string', - 'string' => 'string', - 'char' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'timestamp' => 'datetime', - 'time' => 'time', - 'float' => 'float', - 'double' => 'float', - 'real' => 'float', - 'decimal' => 'decimal', - 'numeric' => 'decimal', - 'year' => 'date', - 'longblob' => 'blob', - 'blob' => 'blob', - 'mediumblob' => 'blob', - 'tinyblob' => 'blob', - 'binary' => 'binary', - 'varbinary' => 'binary', - 'set' => 'simple_array', + 'bigint' => 'bigint', + 'binary' => 'binary', + 'blob' => 'blob', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'decimal' => 'decimal', + 'double' => 'float', + 'float' => 'float', + 'int' => 'integer', + 'integer' => 'integer', + 'longblob' => 'blob', + 'longtext' => 'text', + 'mediumblob' => 'blob', + 'mediumint' => 'integer', + 'mediumtext' => 'text', + 'numeric' => 'decimal', + 'real' => 'float', + 'set' => 'simple_array', + 'smallint' => 'smallint', + 'string' => 'string', + 'text' => 'text', + 'time' => 'time', + 'timestamp' => 'datetime', + 'tinyblob' => 'blob', + 'tinyint' => 'boolean', + 'tinytext' => 'text', + 'varbinary' => 'binary', + 'varchar' => 'string', + 'year' => 'date', ]; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/doctrine/dbal/src/Platforms/OraclePlatform.php similarity index 91% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php rename to doctrine/dbal/src/Platforms/OraclePlatform.php index 9d2e44cbb..cbbfb07d1 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/doctrine/dbal/src/Platforms/OraclePlatform.php @@ -44,7 +44,7 @@ class OraclePlatform extends AbstractPlatform */ public static function assertValidIdentifier($identifier) { - if (! preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier)) { + if (preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier) === 0) { throw new Exception('Invalid Oracle identifier'); } } @@ -89,16 +89,6 @@ public function getLocateExpression($str, $substr, $startPos = false) return 'INSTR(' . $str . ', ' . $substr . ', ' . $startPos . ')'; } - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'SYS_GUID()'; - } - /** * {@inheritdoc} */ @@ -161,6 +151,11 @@ public function getBitAndComparisonExpression($value1, $value2) return 'BITAND(' . $value1 . ', ' . $value2 . ')'; } + public function getCurrentDatabaseExpression(): string + { + return "SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA')"; + } + /** * {@inheritDoc} */ @@ -333,8 +328,8 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column) */ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(2000)') - : ($length ? 'VARCHAR2(' . $length . ')' : 'VARCHAR2(4000)'); + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(2000)') + : ($length > 0 ? 'VARCHAR2(' . $length . ')' : 'VARCHAR2(4000)'); } /** @@ -342,7 +337,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) */ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) { - return 'RAW(' . ($length ?: $this->getBinaryMaxLength()) . ')'; + return 'RAW(' . ($length > 0 ? $length : $this->getBinaryMaxLength()) . ')'; } /** @@ -748,13 +743,17 @@ public function getDropForeignKeySQL($foreignKey, $table) */ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) { - $referentialAction = null; + $referentialAction = ''; if ($foreignKey->hasOption('onDelete')) { $referentialAction = $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete')); } - return $referentialAction ? ' ON DELETE ' . $referentialAction : ''; + if ($referentialAction !== '') { + return ' ON DELETE ' . $referentialAction; + } + + return ''; } /** @@ -808,7 +807,7 @@ public function getAlterTableSQL(TableDiff $diff) $fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); $comment = $this->getColumnComment($column); - if (! $comment) { + if ($comment === null || $comment === '') { continue; } @@ -819,7 +818,7 @@ public function getAlterTableSQL(TableDiff $diff) ); } - if (count($fields)) { + if (count($fields) > 0) { $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ADD (' . implode(', ', $fields) . ')'; } @@ -869,7 +868,7 @@ public function getAlterTableSQL(TableDiff $diff) ); } - if (count($fields)) { + if (count($fields) > 0) { $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' MODIFY (' . implode(', ', $fields) . ')'; } @@ -894,7 +893,7 @@ public function getAlterTableSQL(TableDiff $diff) $fields[] = $column->getQuotedName($this); } - if (count($fields)) { + if (count($fields) > 0) { $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' DROP (' . implode(', ', $fields) . ')'; } @@ -940,10 +939,10 @@ public function getColumnDeclarationSQL($name, array $column) $notnull = $column['notnull'] ? ' NOT NULL' : ' NULL'; } - $unique = isset($column['unique']) && $column['unique'] ? + $unique = ! empty($column['unique']) ? ' ' . $this->getUniqueFieldDeclarationSQL() : ''; - $check = isset($column['check']) && $column['check'] ? + $check = ! empty($column['check']) ? ' ' . $column['check'] : ''; $typeDecl = $column['type']->getSQLDeclaration($column, $this); @@ -966,16 +965,6 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)]; } - /** - * {@inheritDoc} - * - * @deprecated - */ - public function prefersSequences() - { - return true; - } - /** * {@inheritdoc} */ @@ -1022,14 +1011,14 @@ public function getName() /** * {@inheritDoc} */ - protected function doModifyLimitQuery($query, $limit, $offset = null) + protected function doModifyLimitQuery($query, $limit, $offset) { if ($limit === null && $offset <= 0) { return $query; } - if (preg_match('/^\s*SELECT/i', $query)) { - if (! preg_match('/\sFROM\s/i', $query)) { + if (preg_match('/^\s*SELECT/i', $query) === 1) { + if (preg_match('/\sFROM\s/i', $query) === 0) { $query .= ' FROM dual'; } @@ -1053,18 +1042,6 @@ protected function doModifyLimitQuery($query, $limit, $offset = null) return $query; } - /** - * {@inheritDoc} - * - * Oracle returns all column names in SQL result sets in uppercase. - * - * @deprecated - */ - public function getSQLResultCasing($column) - { - return strtoupper($column); - } - /** * {@inheritDoc} */ @@ -1097,21 +1074,6 @@ public function getTimeFormatString() return '1900-01-01 H:i:s'; } - /** - * {@inheritDoc} - * - * @deprecated - */ - public function fixSchemaElementName($schemaElementName) - { - if (strlen($schemaElementName) > 30) { - // Trim it - return substr($schemaElementName, 0, 30); - } - - return $schemaElementName; - } - /** * {@inheritDoc} */ @@ -1128,16 +1090,6 @@ public function supportsSequences() return true; } - /** - * {@inheritDoc} - * - * @deprecated - */ - public function supportsForeignKeyOnUpdate() - { - return false; - } - /** * {@inheritDoc} */ @@ -1172,29 +1124,29 @@ public function getDummySelectSQL() protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'integer' => 'integer', - 'number' => 'integer', - 'pls_integer' => 'boolean', - 'binary_integer' => 'boolean', - 'varchar' => 'string', - 'varchar2' => 'string', - 'nvarchar2' => 'string', - 'char' => 'string', - 'nchar' => 'string', - 'date' => 'date', - 'timestamp' => 'datetime', - 'timestamptz' => 'datetimetz', - 'float' => 'float', - 'binary_float' => 'float', - 'binary_double' => 'float', - 'long' => 'string', - 'clob' => 'text', - 'nclob' => 'text', - 'raw' => 'binary', - 'long raw' => 'blob', - 'rowid' => 'string', - 'urowid' => 'string', - 'blob' => 'blob', + 'binary_double' => 'float', + 'binary_float' => 'float', + 'binary_integer' => 'boolean', + 'blob' => 'blob', + 'char' => 'string', + 'clob' => 'text', + 'date' => 'date', + 'float' => 'float', + 'integer' => 'integer', + 'long' => 'string', + 'long raw' => 'blob', + 'nchar' => 'string', + 'nclob' => 'text', + 'number' => 'integer', + 'nvarchar2' => 'string', + 'pls_integer' => 'boolean', + 'raw' => 'binary', + 'rowid' => 'string', + 'timestamp' => 'datetime', + 'timestamptz' => 'datetimetz', + 'urowid' => 'string', + 'varchar' => 'string', + 'varchar2' => 'string', ]; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php b/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php rename to doctrine/dbal/src/Platforms/PostgreSQL100Platform.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php similarity index 89% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php rename to doctrine/dbal/src/Platforms/PostgreSQL94Platform.php index 6014c5962..a00a43e2d 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php @@ -34,13 +34,9 @@ use function trim; /** - * PostgreSqlPlatform. - * - * @deprecated Use PostgreSQL 9.4 or newer - * - * @todo Rename: PostgreSQLPlatform + * Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform. */ -class PostgreSqlPlatform extends AbstractPlatform +class PostgreSQL94Platform extends AbstractPlatform { /** @var bool */ private $useBooleanTrueFalseStrings = true; @@ -144,6 +140,11 @@ public function getDateDiffExpression($date1, $date2) return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))'; } + public function getCurrentDatabaseExpression(): string + { + return 'CURRENT_DATABASE()'; + } + /** * {@inheritDoc} */ @@ -208,16 +209,6 @@ public function supportsCommentOnStatement() return true; } - /** - * {@inheritDoc} - * - * @deprecated - */ - public function prefersSequences() - { - return true; - } - /** * {@inheritDoc} */ @@ -404,6 +395,7 @@ public function getListTableColumnsSQL($table, $database = null) quote_ident(a.attname) AS field, t.typname AS type, format_type(a.atttypid, a.atttypmod) AS complete_type, + (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation, (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type, (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type, @@ -439,39 +431,6 @@ public function getCreateDatabaseSQL($name) return 'CREATE DATABASE ' . $name; } - /** - * Returns the SQL statement for disallowing new connections on the given database. - * - * This is useful to force DROP DATABASE operations which could fail because of active connections. - * - * @deprecated - * - * @param string $database The name of the database to disallow new connections for. - * - * @return string - */ - public function getDisallowDatabaseConnectionsSQL($database) - { - return "UPDATE pg_database SET datallowconn = 'false' WHERE datname = " . $this->quoteStringLiteral($database); - } - - /** - * Returns the SQL statement for closing currently active connections on the given database. - * - * This is useful to force DROP DATABASE operations which could fail because of active connections. - * - * @deprecated - * - * @param string $database The name of the database to close currently active connections for. - * - * @return string - */ - public function getCloseActiveDatabaseConnectionsSQL($database) - { - return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = ' - . $this->quoteStringLiteral($database); - } - /** * {@inheritDoc} */ @@ -683,7 +642,7 @@ private function isUnchangedBinaryColumn(ColumnDiff $columnDiff) $fromColumn = $columnDiff->fromColumn instanceof Column ? $columnDiff->fromColumn : null; - if ($fromColumn) { + if ($fromColumn !== null) { $fromColumnType = $fromColumn->getType(); if (! $fromColumnType instanceof BinaryType && ! $fromColumnType instanceof BlobType) { @@ -926,7 +885,7 @@ public function convertBooleansToDatabaseValue($item) return $this->doConvertBooleans( $item, - static function ($boolean) { + static function ($boolean): ?int { return $boolean === null ? null : (int) $boolean; } ); @@ -998,6 +957,10 @@ public function getBigIntTypeDeclarationSQL(array $column) */ public function getSmallIntTypeDeclarationSQL(array $column) { + if (! empty($column['autoincrement'])) { + return 'SMALLSERIAL'; + } + return 'SMALLINT'; } @@ -1041,16 +1004,6 @@ public function getTimeTypeDeclarationSQL(array $column) return 'TIME(0) WITHOUT TIME ZONE'; } - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'UUID_GENERATE_V4()'; - } - /** * {@inheritDoc} */ @@ -1064,8 +1017,8 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column) */ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') - : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); } /** @@ -1092,18 +1045,6 @@ public function getName() return 'postgresql'; } - /** - * {@inheritDoc} - * - * PostgreSQL returns all column names in SQL result sets in lowercase. - * - * @deprecated - */ - public function getSQLResultCasing($column) - { - return strtolower($column); - } - /** * {@inheritDoc} */ @@ -1149,45 +1090,47 @@ public function getReadLockSQL() protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'smallint' => 'smallint', - 'int2' => 'smallint', - 'serial' => 'integer', - 'serial4' => 'integer', - 'int' => 'integer', - 'int4' => 'integer', - 'integer' => 'integer', - 'bigserial' => 'bigint', - 'serial8' => 'bigint', - 'bigint' => 'bigint', - 'int8' => 'bigint', - 'bool' => 'boolean', - 'boolean' => 'boolean', - 'text' => 'text', - 'tsvector' => 'text', - 'varchar' => 'string', - 'interval' => 'string', - '_varchar' => 'string', - 'char' => 'string', - 'bpchar' => 'string', - 'inet' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'timestamp' => 'datetime', - 'timestamptz' => 'datetimetz', - 'time' => 'time', - 'timetz' => 'time', - 'float' => 'float', - 'float4' => 'float', - 'float8' => 'float', - 'double' => 'float', + 'bigint' => 'bigint', + 'bigserial' => 'bigint', + 'bool' => 'boolean', + 'boolean' => 'boolean', + 'bpchar' => 'string', + 'bytea' => 'blob', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'decimal' => 'decimal', + 'double' => 'float', 'double precision' => 'float', - 'real' => 'float', - 'decimal' => 'decimal', - 'money' => 'decimal', - 'numeric' => 'decimal', - 'year' => 'date', - 'uuid' => 'guid', - 'bytea' => 'blob', + 'float' => 'float', + 'float4' => 'float', + 'float8' => 'float', + 'inet' => 'string', + 'int' => 'integer', + 'int2' => 'smallint', + 'int4' => 'integer', + 'int8' => 'bigint', + 'integer' => 'integer', + 'interval' => 'string', + 'json' => 'json', + 'jsonb' => 'json', + 'money' => 'decimal', + 'numeric' => 'decimal', + 'serial' => 'integer', + 'serial4' => 'integer', + 'serial8' => 'bigint', + 'real' => 'float', + 'smallint' => 'smallint', + 'text' => 'text', + 'time' => 'time', + 'timestamp' => 'datetime', + 'timestamptz' => 'datetimetz', + 'timetz' => 'time', + 'tsvector' => 'text', + 'uuid' => 'guid', + 'varchar' => 'string', + 'year' => 'date', + '_varchar' => 'string', ]; } @@ -1215,12 +1158,20 @@ public function getBinaryDefaultLength() return 0; } + /** + * {@inheritdoc} + */ + public function hasNativeJsonType() + { + return true; + } + /** * {@inheritDoc} */ protected function getReservedKeywordsClass() { - return Keywords\PostgreSQLKeywords::class; + return Keywords\PostgreSQL94Keywords::class; } /** @@ -1243,6 +1194,34 @@ public function getDefaultValueDeclarationSQL($column) return parent::getDefaultValueDeclarationSQL($column); } + /** + * {@inheritdoc} + */ + public function supportsColumnCollation() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getColumnCollationDeclarationSQL($collation) + { + return 'COLLATE ' . $this->quoteSingleIdentifier($collation); + } + + /** + * {@inheritdoc} + */ + public function getJsonTypeDeclarationSQL(array $column) + { + if (! empty($column['jsonb'])) { + return 'JSONB'; + } + + return 'JSON'; + } + /** * @param mixed[] $column */ @@ -1258,7 +1237,7 @@ private function isSerialColumn(array $column): bool */ private function typeChangeBreaksDefaultValue(ColumnDiff $columnDiff): bool { - if (! $columnDiff->fromColumn) { + if ($columnDiff->fromColumn === null) { return $columnDiff->hasChanged('type'); } @@ -1277,7 +1256,7 @@ private function isNumericType(Type $type): bool private function getOldColumnComment(ColumnDiff $columnDiff): ?string { - return $columnDiff->fromColumn ? $this->getColumnComment($columnDiff->fromColumn) : null; + return $columnDiff->fromColumn !== null ? $this->getColumnComment($columnDiff->fromColumn) : null; } public function getListTableMetadataSQL(string $table, ?string $schema = null): string diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php similarity index 86% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php rename to doctrine/dbal/src/Platforms/SQLServer2012Platform.php index b41f33bef..5e7c428dc 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php @@ -2,12 +2,14 @@ namespace Doctrine\DBAL\Platforms; +use Doctrine\DBAL\Exception\InvalidLockMode; use Doctrine\DBAL\LockMode; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\ColumnDiff; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Index; +use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\TableDiff; use InvalidArgumentException; @@ -26,23 +28,19 @@ use function is_numeric; use function is_string; use function preg_match; +use function preg_match_all; use function sprintf; use function str_replace; -use function stripos; -use function stristr; -use function strlen; use function strpos; use function strtoupper; -use function substr; use function substr_count; +use const PREG_OFFSET_CAPTURE; + /** - * The SQLServerPlatform provides the behavior, features and SQL dialect of the - * Microsoft SQL Server database platform. - * - * @deprecated Use SQL Server 2012 or newer + * Provides the behavior, features and SQL dialect of the Microsoft SQL Server 2012 database platform. */ -class SQLServerPlatform extends AbstractPlatform +class SQLServer2012Platform extends AbstractPlatform { /** * {@inheritdoc} @@ -148,6 +146,60 @@ public function supportsColumnCollation() return true; } + public function supportsSequences(): bool + { + return true; + } + + public function getAlterSequenceSQL(Sequence $sequence): string + { + return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . + ' INCREMENT BY ' . $sequence->getAllocationSize(); + } + + public function getCreateSequenceSQL(Sequence $sequence): string + { + return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . + ' START WITH ' . $sequence->getInitialValue() . + ' INCREMENT BY ' . $sequence->getAllocationSize() . + ' MINVALUE ' . $sequence->getInitialValue(); + } + + /** + * {@inheritdoc} + */ + public function getDropSequenceSQL($sequence): string + { + if ($sequence instanceof Sequence) { + $sequence = $sequence->getQuotedName($this); + } + + return 'DROP SEQUENCE ' . $sequence; + } + + /** + * {@inheritdoc} + */ + public function getListSequencesSQL($database) + { + return 'SELECT seq.name, + CAST( + seq.increment AS VARCHAR(MAX) + ) AS increment, -- CAST avoids driver error for sql_variant type + CAST( + seq.start_value AS VARCHAR(MAX) + ) AS start_value -- CAST avoids driver error for sql_variant type + FROM sys.sequences AS seq'; + } + + /** + * {@inheritdoc} + */ + public function getSequenceNextValSQL($sequence) + { + return 'SELECT NEXT VALUE FOR ' . $sequence; + } + /** * {@inheritDoc} */ @@ -260,7 +312,7 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] // @todo does other code breaks because of this? // force primary keys to be not null foreach ($columns as &$column) { - if (isset($column['primary']) && $column['primary']) { + if (! empty($column['primary'])) { $column['notnull'] = true; } @@ -280,8 +332,8 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] $columnListSql = $this->getColumnDeclarationListSQL($columns); if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $name => $definition) { - $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); + foreach ($options['uniqueConstraints'] as $constraintName => $definition) { + $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); } } @@ -405,18 +457,6 @@ public function getDefaultConstraintDeclarationSQL($table, array $column) ' FOR ' . $columnName->getQuotedName($this); } - /** - * {@inheritDoc} - */ - public function getUniqueConstraintDeclarationSQL($name, Index $index) - { - $constraint = parent::getUniqueConstraintDeclarationSQL($name, $index); - - $constraint = $this->_appendUniqueConstraintDefinition($constraint, $index); - - return $constraint; - } - /** * {@inheritDoc} */ @@ -557,7 +597,8 @@ public function getAlterTableSQL(TableDiff $diff) $columnDef = $column->toArray(); - $queryParts[] = 'ALTER COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); + $queryParts[] = 'ALTER COLUMN ' . + $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); if ( ! isset($columnDef['default']) @@ -906,7 +947,8 @@ public function getListTablesSQL() { // "sysdiagrams" table must be ignored as it's internal SQL Server table for Database Diagrams // Category 2 must be ignored as it is "MS SQL Server 'pseudo-system' object[s]" for replication - return "SELECT name FROM sysobjects WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"; + return 'SELECT name, SCHEMA_NAME (uid) AS schema_name FROM sysobjects' + . " WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"; } /** @@ -1037,16 +1079,6 @@ public function getDropViewSQL($name) return 'DROP VIEW ' . $name; } - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return 'NEWID()'; - } - /** * {@inheritDoc} */ @@ -1072,7 +1104,7 @@ public function getModExpression($expression1, $expression2) */ public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) { - if (! $char) { + if ($char === false) { switch ($mode) { case TrimMode::LEADING: $trimFn = 'LTRIM'; @@ -1151,6 +1183,11 @@ public function getLengthExpression($column) return 'LEN(' . $column . ')'; } + public function getCurrentDatabaseExpression(): string + { + return 'DB_NAME()'; + } + /** * {@inheritDoc} */ @@ -1191,6 +1228,14 @@ public function getGuidTypeDeclarationSQL(array $column) return 'UNIQUEIDENTIFIER'; } + /** + * {@inheritDoc} + */ + public function getDateTimeTzTypeDeclarationSQL(array $column) + { + return 'DATETIMEOFFSET(6)'; + } + /** * {@inheritDoc} */ @@ -1211,8 +1256,8 @@ public function getAsciiStringTypeDeclarationSQL(array $column): string protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { return $fixed - ? ($length ? 'NCHAR(' . $length . ')' : 'CHAR(255)') - : ($length ? 'NVARCHAR(' . $length . ')' : 'NVARCHAR(255)'); + ? ($length > 0 ? 'NCHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'NVARCHAR(' . $length . ')' : 'NVARCHAR(255)'); } /** @@ -1220,7 +1265,9 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) */ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')'; + return $fixed + ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' + : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; } /** @@ -1252,7 +1299,9 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column) */ public function getDateTimeTypeDeclarationSQL(array $column) { - return 'DATETIME'; + // 3 - microseconds precision length + // http://msdn.microsoft.com/en-us/library/ms187819.aspx + return 'DATETIME2(6)'; } /** @@ -1260,7 +1309,7 @@ public function getDateTimeTypeDeclarationSQL(array $column) */ public function getDateTypeDeclarationSQL(array $column) { - return 'DATETIME'; + return 'DATE'; } /** @@ -1268,7 +1317,7 @@ public function getDateTypeDeclarationSQL(array $column) */ public function getTimeTypeDeclarationSQL(array $column) { - return 'DATETIME'; + return 'TIME(0)'; } /** @@ -1282,134 +1331,50 @@ public function getBooleanTypeDeclarationSQL(array $column) /** * {@inheritDoc} */ - protected function doModifyLimitQuery($query, $limit, $offset = null) + protected function doModifyLimitQuery($query, $limit, $offset) { - $where = []; - - if ($offset > 0) { - $where[] = sprintf('doctrine_rownum >= %d', $offset + 1); - } - - if ($limit !== null) { - $where[] = sprintf('doctrine_rownum <= %d', $offset + $limit); - $top = sprintf('TOP %d', $offset + $limit); - } else { - $top = 'TOP 9223372036854775807'; - } - - if (empty($where)) { + if ($limit === null && $offset <= 0) { return $query; } - // We'll find a SELECT or SELECT distinct and prepend TOP n to it - // Even if the TOP n is very large, the use of a CTE will - // allow the SQL Server query planner to optimize it so it doesn't - // actually scan the entire range covered by the TOP clause. - if (! preg_match('/^(\s*SELECT\s+(?:DISTINCT\s+)?)(.*)$/is', $query, $matches)) { - return $query; + // Queries using OFFSET... FETCH MUST have an ORDER BY clause + // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement + // but can be in a newline + $matches = []; + $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE); + $orderByPos = false; + if ($matchesCount > 0) { + $orderByPos = $matches[0][$matchesCount - 1][1]; } - $query = $matches[1] . $top . ' ' . $matches[2]; - - if (stristr($query, 'ORDER BY')) { - // Inner order by is not valid in SQL Server for our purposes - // unless it's in a TOP N subquery. - $query = $this->scrubInnerOrderBy($query); - } - - // Build a new limited query around the original, using a CTE - return sprintf( - 'WITH dctrn_cte AS (%s) ' - . 'SELECT * FROM (' - . 'SELECT *, ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS doctrine_rownum FROM dctrn_cte' - . ') AS doctrine_tbl ' - . 'WHERE %s ORDER BY doctrine_rownum ASC', - $query, - implode(' AND ', $where) - ); - } - - /** - * Remove ORDER BY clauses in subqueries - they're not supported by SQL Server. - * Caveat: will leave ORDER BY in TOP N subqueries. - * - * @param string $query - * - * @return string - */ - private function scrubInnerOrderBy($query) - { - $count = substr_count(strtoupper($query), 'ORDER BY'); - $offset = 0; - - while ($count-- > 0) { - $orderByPos = stripos($query, ' ORDER BY', $offset); - if ($orderByPos === false) { - break; + if ( + $orderByPos === false + || substr_count($query, '(', $orderByPos) !== substr_count($query, ')', $orderByPos) + ) { + if (preg_match('/^SELECT\s+DISTINCT/im', $query) > 0) { + // SQL Server won't let us order by a non-selected column in a DISTINCT query, + // so we have to do this madness. This says, order by the first column in the + // result. SQL Server's docs say that a nonordered query's result order is non- + // deterministic anyway, so this won't do anything that a bunch of update and + // deletes to the table wouldn't do anyway. + $query .= ' ORDER BY 1'; + } else { + // In another DBMS, we could do ORDER BY 0, but SQL Server gets angry if you + // use constant expressions in the order by list. + $query .= ' ORDER BY (SELECT 0)'; } - - $qLen = strlen($query); - $parenCount = 0; - $currentPosition = $orderByPos; - - while ($parenCount >= 0 && $currentPosition < $qLen) { - if ($query[$currentPosition] === '(') { - $parenCount++; - } elseif ($query[$currentPosition] === ')') { - $parenCount--; - } - - $currentPosition++; - } - - if ($this->isOrderByInTopNSubquery($query, $orderByPos)) { - // If the order by clause is in a TOP N subquery, do not remove - // it and continue iteration from the current position. - $offset = $currentPosition; - continue; - } - - if ($currentPosition >= $qLen - 1) { - continue; - } - - $query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1); - $offset = $orderByPos; } - return $query; - } - - /** - * Check an ORDER BY clause to see if it is in a TOP N query or subquery. - * - * @param string $query The query - * @param int $currentPosition Start position of ORDER BY clause - * - * @return bool true if ORDER BY is in a TOP N query, false otherwise - */ - private function isOrderByInTopNSubquery($query, $currentPosition) - { - // Grab query text on the same nesting level as the ORDER BY clause we're examining. - $subQueryBuffer = ''; - $parenCount = 0; - - // If $parenCount goes negative, we've exited the subquery we're examining. - // If $currentPosition goes negative, we've reached the beginning of the query. - while ($parenCount >= 0 && $currentPosition >= 0) { - if ($query[$currentPosition] === '(') { - $parenCount--; - } elseif ($query[$currentPosition] === ')') { - $parenCount++; - } - - // Only yank query text on the same nesting level as the ORDER BY clause. - $subQueryBuffer = ($parenCount === 0 ? $query[$currentPosition] : ' ') . $subQueryBuffer; + // This looks somewhat like MYSQL, but limit/offset are in inverse positions + // Supposedly SQL:2008 core standard. + // Per TSQL spec, FETCH NEXT n ROWS ONLY is not valid without OFFSET n ROWS. + $query .= sprintf(' OFFSET %d ROWS', $offset); - $currentPosition--; + if ($limit !== null) { + $query .= sprintf(' FETCH NEXT %d ROWS ONLY', $limit); } - return (bool) preg_match('/SELECT\s+(DISTINCT\s+)?TOP\s/i', $subQueryBuffer); + return $query; } /** @@ -1417,7 +1382,7 @@ private function isOrderByInTopNSubquery($query, $currentPosition) */ public function supportsLimitOffset() { - return false; + return true; } /** @@ -1431,10 +1396,10 @@ public function convertBooleans($item) continue; } - $item[$key] = $value ? 1 : 0; + $item[$key] = (int) (bool) $value; } } elseif (is_bool($item) || is_numeric($item)) { - $item = $item ? 1 : 0; + $item = (int) (bool) $item; } return $item; @@ -1461,7 +1426,7 @@ public function getTemporaryTableName($tableName) */ public function getDateTimeFormatString() { - return 'Y-m-d H:i:s.000'; + return 'Y-m-d H:i:s.u'; } /** @@ -1469,7 +1434,7 @@ public function getDateTimeFormatString() */ public function getDateFormatString() { - return 'Y-m-d H:i:s.000'; + return 'Y-m-d'; } /** @@ -1477,7 +1442,7 @@ public function getDateFormatString() */ public function getTimeFormatString() { - return 'Y-m-d H:i:s.000'; + return 'H:i:s'; } /** @@ -1485,7 +1450,7 @@ public function getTimeFormatString() */ public function getDateTimeTzFormatString() { - return $this->getDateTimeFormatString(); + return 'Y-m-d H:i:s.u P'; } /** @@ -1502,31 +1467,35 @@ public function getName() protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'bigint' => 'bigint', - 'numeric' => 'decimal', - 'bit' => 'boolean', - 'smallint' => 'smallint', - 'decimal' => 'decimal', - 'smallmoney' => 'integer', - 'int' => 'integer', - 'tinyint' => 'smallint', - 'money' => 'integer', - 'float' => 'float', - 'real' => 'float', - 'double' => 'float', + 'bigint' => 'bigint', + 'binary' => 'binary', + 'bit' => 'boolean', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'datetime2' => 'datetime', + 'datetimeoffset' => 'datetimetz', + 'decimal' => 'decimal', + 'double' => 'float', 'double precision' => 'float', - 'smalldatetime' => 'datetime', - 'datetime' => 'datetime', - 'char' => 'string', - 'varchar' => 'string', - 'text' => 'text', - 'nchar' => 'string', - 'nvarchar' => 'string', - 'ntext' => 'text', - 'binary' => 'binary', - 'varbinary' => 'binary', - 'image' => 'blob', + 'float' => 'float', + 'image' => 'blob', + 'int' => 'integer', + 'money' => 'integer', + 'nchar' => 'string', + 'ntext' => 'text', + 'numeric' => 'decimal', + 'nvarchar' => 'string', + 'real' => 'float', + 'smalldatetime' => 'datetime', + 'smallint' => 'smallint', + 'smallmoney' => 'integer', + 'text' => 'text', + 'time' => 'time', + 'tinyint' => 'smallint', 'uniqueidentifier' => 'guid', + 'varbinary' => 'binary', + 'varchar' => 'string', ]; } @@ -1567,23 +1536,21 @@ public function getForeignKeyReferentialActionSQL($action) return parent::getForeignKeyReferentialActionSQL($action); } - /** - * {@inheritDoc} - */ - public function appendLockHint($fromClause, $lockMode) + public function appendLockHint(string $fromClause, int $lockMode): string { - switch (true) { - case $lockMode === LockMode::NONE: - return $fromClause . ' WITH (NOLOCK)'; + switch ($lockMode) { + case LockMode::NONE: + case LockMode::OPTIMISTIC: + return $fromClause; - case $lockMode === LockMode::PESSIMISTIC_READ: + case LockMode::PESSIMISTIC_READ: return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)'; - case $lockMode === LockMode::PESSIMISTIC_WRITE: + case LockMode::PESSIMISTIC_WRITE: return $fromClause . ' WITH (UPDLOCK, ROWLOCK)'; default: - return $fromClause; + throw InvalidLockMode::fromLockMode($lockMode); } } @@ -1600,7 +1567,7 @@ public function getForUpdateSQL() */ protected function getReservedKeywordsClass() { - return Keywords\SQLServerKeywords::class; + return Keywords\SQLServer2012Keywords::class; } /** @@ -1639,15 +1606,15 @@ public function getColumnDeclarationSQL($name, array $column) if (isset($column['columnDefinition'])) { $columnDef = $this->getCustomTypeDeclarationSQL($column); } else { - $collation = isset($column['collation']) && $column['collation'] ? + $collation = ! empty($column['collation']) ? ' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : ''; - $notnull = isset($column['notnull']) && $column['notnull'] ? ' NOT NULL' : ''; + $notnull = ! empty($column['notnull']) ? ' NOT NULL' : ''; - $unique = isset($column['unique']) && $column['unique'] ? + $unique = ! empty($column['unique']) ? ' ' . $this->getUniqueFieldDeclarationSQL() : ''; - $check = isset($column['check']) && $column['check'] ? + $check = ! empty($column['check']) ? ' ' . $column['check'] : ''; $typeDecl = $column['type']->getSQLDeclaration($column, $this); @@ -1657,6 +1624,11 @@ public function getColumnDeclarationSQL($name, array $column) return $name . ' ' . $columnDef; } + protected function getLikeWildcardCharacters(): string + { + return parent::getLikeWildcardCharacters() . '[]^'; + } + /** * Returns a unique default constraint name for a table and column. * diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/doctrine/dbal/src/Platforms/SqlitePlatform.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php rename to doctrine/dbal/src/Platforms/SqlitePlatform.php index e42a6bd89..6d85de4e6 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/doctrine/dbal/src/Platforms/SqlitePlatform.php @@ -3,7 +3,6 @@ namespace Doctrine\DBAL\Platforms; use Doctrine\DBAL\Exception; -use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Constraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Identifier; @@ -42,19 +41,6 @@ public function getRegexpExpression() return 'REGEXP'; } - /** - * {@inheritDoc} - * - * @deprecated Use application-generated UUIDs instead - */ - public function getGuidExpression() - { - return "HEX(RANDOMBLOB(4)) || '-' || HEX(RANDOMBLOB(2)) || '-4' || " - . "SUBSTR(HEX(RANDOMBLOB(2)), 2) || '-' || " - . "SUBSTR('89AB', 1 + (ABS(RANDOM()) % 4), 1) || " - . "SUBSTR(HEX(RANDOMBLOB(2)), 2) || '-' || HEX(RANDOMBLOB(6))"; - } - /** * @param string $type * @@ -163,6 +149,19 @@ public function getDateDiffExpression($date1, $date2) return sprintf("JULIANDAY(%s, 'start of day') - JULIANDAY(%s, 'start of day')", $date1, $date2); } + /** + * {@inheritDoc} + * + * The SQLite platform doesn't support the concept of a database, therefore, it always returns an empty string + * as an indicator of an implicitly selected database. + * + * @see \Doctrine\DBAL\Connection::getDatabase() + */ + public function getCurrentDatabaseExpression(): string + { + return "''"; + } + /** * {@inheritDoc} */ @@ -232,7 +231,7 @@ public function getBigIntTypeDeclarationSQL(array $column) * * @return string */ - public function getTinyIntTypeDeclarationSql(array $column) + public function getTinyIntTypeDeclarationSQL(array $column) { // SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns if (! empty($column['autoincrement'])) { @@ -260,7 +259,7 @@ public function getSmallIntTypeDeclarationSQL(array $column) * * @return string */ - public function getMediumIntTypeDeclarationSql(array $column) + public function getMediumIntTypeDeclarationSQL(array $column) { // SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns if (! empty($column['autoincrement'])) { @@ -330,8 +329,8 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] $queryFields = $this->getColumnDeclarationListSQL($columns); if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $name => $definition) { - $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); + foreach ($options['uniqueConstraints'] as $constraintName => $definition) { + $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); } } @@ -399,8 +398,8 @@ private function getNonAutoincrementPrimaryKeyDefinition(array $columns, array $ */ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { - return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') - : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'TEXT'); } /** @@ -648,38 +647,38 @@ private function getInlineTableCommentSQL(string $comment): string protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ - 'boolean' => 'boolean', - 'tinyint' => 'boolean', - 'smallint' => 'smallint', - 'mediumint' => 'integer', - 'int' => 'integer', - 'integer' => 'integer', - 'serial' => 'integer', 'bigint' => 'bigint', 'bigserial' => 'bigint', - 'clob' => 'text', - 'tinytext' => 'text', - 'mediumtext' => 'text', - 'longtext' => 'text', - 'text' => 'text', - 'varchar' => 'string', - 'longvarchar' => 'string', - 'varchar2' => 'string', - 'nvarchar' => 'string', - 'image' => 'string', - 'ntext' => 'string', + 'blob' => 'blob', + 'boolean' => 'boolean', 'char' => 'string', + 'clob' => 'text', 'date' => 'date', 'datetime' => 'datetime', - 'timestamp' => 'datetime', - 'time' => 'time', - 'float' => 'float', + 'decimal' => 'decimal', 'double' => 'float', 'double precision' => 'float', - 'real' => 'float', - 'decimal' => 'decimal', + 'float' => 'float', + 'image' => 'string', + 'int' => 'integer', + 'integer' => 'integer', + 'longtext' => 'text', + 'longvarchar' => 'string', + 'mediumint' => 'integer', + 'mediumtext' => 'text', + 'ntext' => 'string', 'numeric' => 'decimal', - 'blob' => 'blob', + 'nvarchar' => 'string', + 'real' => 'float', + 'serial' => 'integer', + 'smallint' => 'smallint', + 'text' => 'text', + 'time' => 'time', + 'timestamp' => 'datetime', + 'tinyint' => 'boolean', + 'tinytext' => 'text', + 'varchar' => 'string', + 'varchar2' => 'string', ]; } @@ -955,8 +954,8 @@ public function getAlterTableSQL(TableDiff $diff) $table->getQuotedName($this), $columns, $this->getPrimaryIndexInAlteredTable($diff, $fromTable), + [], $this->getForeignKeysInAlteredTable($diff, $fromTable), - 0, $table->getOptions() ); $newTable->addOption('alter', true); @@ -999,14 +998,15 @@ public function getAlterTableSQL(TableDiff $diff) /** * @return string[]|false + * + * @throws Exception */ private function getSimpleAlterTableSQL(TableDiff $diff) { // Suppress changes on integer type autoincrement columns. foreach ($diff->changedColumns as $oldColumnName => $columnDiff) { if ( - ! $columnDiff->fromColumn instanceof Column || - ! $columnDiff->column instanceof Column || + $columnDiff->fromColumn === null || ! $columnDiff->column->getAutoincrement() || ! $columnDiff->column->getType() instanceof Types\IntegerType ) { @@ -1180,7 +1180,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable) foreach ($diff->removedIndexes as $index) { $indexName = strtolower($index->getName()); - if (! strlen($indexName) || ! isset($indexes[$indexName])) { + if (strlen($indexName) === 0 || ! isset($indexes[$indexName])) { continue; } @@ -1189,7 +1189,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable) foreach (array_merge($diff->changedIndexes, $diff->addedIndexes, $diff->renamedIndexes) as $index) { $indexName = strtolower($index->getName()); - if (strlen($indexName)) { + if (strlen($indexName) > 0) { $indexes[$indexName] = $index; } else { $indexes[] = $index; @@ -1244,7 +1244,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) } $constraintName = strtolower($constraint->getName()); - if (! strlen($constraintName) || ! isset($foreignKeys[$constraintName])) { + if (strlen($constraintName) === 0 || ! isset($foreignKeys[$constraintName])) { continue; } @@ -1253,7 +1253,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) foreach (array_merge($diff->changedForeignKeys, $diff->addedForeignKeys) as $constraint) { $constraintName = strtolower($constraint->getName()); - if (strlen($constraintName)) { + if (strlen($constraintName) > 0) { $foreignKeys[$constraintName] = $constraint; } else { $foreignKeys[] = $constraint; diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/TrimMode.php b/doctrine/dbal/src/Platforms/TrimMode.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Platforms/TrimMode.php rename to doctrine/dbal/src/Platforms/TrimMode.php diff --git a/doctrine/dbal/src/Portability/Connection.php b/doctrine/dbal/src/Portability/Connection.php new file mode 100644 index 000000000..a56397924 --- /dev/null +++ b/doctrine/dbal/src/Portability/Connection.php @@ -0,0 +1,93 @@ +connection = $connection; + $this->converter = $converter; + } + + public function prepare(string $sql): DriverStatement + { + return new Statement( + $this->connection->prepare($sql), + $this->converter + ); + } + + public function query(string $sql): DriverResult + { + return new Result( + $this->connection->query($sql), + $this->converter + ); + } + + /** + * {@inheritDoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + return $this->connection->quote($value, $type); + } + + public function exec(string $sql): int + { + return $this->connection->exec($sql); + } + + /** + * {@inheritDoc} + */ + public function lastInsertId($name = null) + { + return $this->connection->lastInsertId($name); + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + return $this->connection->beginTransaction(); + } + + /** + * {@inheritDoc} + */ + public function commit() + { + return $this->connection->commit(); + } + + /** + * {@inheritDoc} + */ + public function rollBack() + { + return $this->connection->rollBack(); + } +} diff --git a/doctrine/dbal/src/Portability/Converter.php b/doctrine/dbal/src/Portability/Converter.php new file mode 100644 index 000000000..eba144a13 --- /dev/null +++ b/doctrine/dbal/src/Portability/Converter.php @@ -0,0 +1,247 @@ +createConvertValue($convertEmptyStringToNull, $rightTrimString); + $convertNumeric = $this->createConvertRow($convertValue, null); + $convertAssociative = $this->createConvertRow($convertValue, $case); + + $this->convertNumeric = $this->createConvert($convertNumeric, $id); + $this->convertAssociative = $this->createConvert($convertAssociative, $id); + $this->convertOne = $this->createConvert($convertValue, $id); + + $this->convertAllNumeric = $this->createConvertAll($convertNumeric, $id); + $this->convertAllAssociative = $this->createConvertAll($convertAssociative, $id); + $this->convertFirstColumn = $this->createConvertAll($convertValue, $id); + } + + /** + * @param array|false $row + * + * @return list|false + */ + public function convertNumeric($row) + { + return ($this->convertNumeric)($row); + } + + /** + * @param array|false $row + * + * @return array|false + */ + public function convertAssociative($row) + { + return ($this->convertAssociative)($row); + } + + /** + * @param mixed|false $value + * + * @return mixed|false + */ + public function convertOne($value) + { + return ($this->convertOne)($value); + } + + /** + * @param list> $data + * + * @return list> + */ + public function convertAllNumeric(array $data): array + { + return ($this->convertAllNumeric)($data); + } + + /** + * @param list> $data + * + * @return list> + */ + public function convertAllAssociative(array $data): array + { + return ($this->convertAllAssociative)($data); + } + + /** + * @param list $data + * + * @return list + */ + public function convertFirstColumn(array $data): array + { + return ($this->convertFirstColumn)($data); + } + + /** + * Creates a function that will convert each individual value retrieved from the database + * + * @param bool $convertEmptyStringToNull Whether each empty string should be converted to NULL + * @param bool $rightTrimString Whether each string should right-trimmed + * + * @return callable|null The resulting function or NULL if no conversion is needed + */ + private function createConvertValue(bool $convertEmptyStringToNull, bool $rightTrimString): ?callable + { + $functions = []; + + if ($convertEmptyStringToNull) { + $functions[] = static function ($value) { + if ($value === '') { + return null; + } + + return $value; + }; + } + + if ($rightTrimString) { + $functions[] = static function ($value) { + if (! is_string($value)) { + return $value; + } + + return rtrim($value); + }; + } + + return $this->compose(...$functions); + } + + /** + * Creates a function that will convert each array-row retrieved from the database + * + * @param callable|null $function The function that will convert each value + * @param int|null $case Column name case + * + * @return callable|null The resulting function or NULL if no conversion is needed + */ + private function createConvertRow(?callable $function, ?int $case): ?callable + { + $functions = []; + + if ($function !== null) { + $functions[] = $this->createMapper($function); + } + + if ($case !== null) { + $functions[] = static function (array $row) use ($case): array { + return array_change_key_case($row, $case); + }; + } + + return $this->compose(...$functions); + } + + /** + * Creates a function that will be applied to the return value of Statement::fetch*() + * or an identity function if no conversion is needed + * + * @param callable|null $function The function that will convert each tow + * @param callable $id Identity function + */ + private function createConvert(?callable $function, callable $id): callable + { + if ($function === null) { + return $id; + } + + return static function ($value) use ($function) { + if ($value === false) { + return false; + } + + return $function($value); + }; + } + + /** + * Creates a function that will be applied to the return value of Statement::fetchAll*() + * or an identity function if no transformation is required + * + * @param callable|null $function The function that will transform each value + * @param callable $id Identity function + */ + private function createConvertAll(?callable $function, callable $id): callable + { + if ($function === null) { + return $id; + } + + return $this->createMapper($function); + } + + /** + * Creates a function that maps each value of the array using the given function + * + * @param callable $function The function that maps each value of the array + */ + private function createMapper(callable $function): callable + { + return static function (array $array) use ($function): array { + return array_map($function, $array); + }; + } + + /** + * Creates a composition of the given set of functions + * + * @param callable ...$functions The functions to compose + * + * @return callable|null The composition or NULL if an empty set is provided + */ + private function compose(callable ...$functions): ?callable + { + return array_reduce($functions, static function (?callable $carry, callable $item): callable { + if ($carry === null) { + return $item; + } + + return static function ($value) use ($carry, $item) { + return $item($carry($value)); + }; + }); + } +} diff --git a/doctrine/dbal/src/Portability/Driver.php b/doctrine/dbal/src/Portability/Driver.php new file mode 100644 index 000000000..5ae410cd0 --- /dev/null +++ b/doctrine/dbal/src/Portability/Driver.php @@ -0,0 +1,90 @@ +driver = $driver; + $this->mode = $mode; + $this->case = $case; + } + + /** + * {@inheritDoc} + */ + public function connect(array $params) + { + $connection = $this->driver->connect($params); + + $portability = (new OptimizeFlags())( + $this->getDatabasePlatform(), + $this->mode + ); + + $case = 0; + + if ($this->case !== 0 && ($portability & Connection::PORTABILITY_FIX_CASE) !== 0) { + if ($connection instanceof PDO\Connection) { + // make use of c-level support for case handling + $portability &= ~Connection::PORTABILITY_FIX_CASE; + $connection->getWrappedConnection()->setAttribute(\PDO::ATTR_CASE, $this->case); + } else { + $case = $this->case === ColumnCase::LOWER ? CASE_LOWER : CASE_UPPER; + } + } + + $convertEmptyStringToNull = ($portability & Connection::PORTABILITY_EMPTY_TO_NULL) !== 0; + $rightTrimString = ($portability & Connection::PORTABILITY_RTRIM) !== 0; + + if (! $convertEmptyStringToNull && ! $rightTrimString && $case === 0) { + return $connection; + } + + return new Connection( + $connection, + new Converter($convertEmptyStringToNull, $rightTrimString, $case) + ); + } + + /** + * {@inheritDoc} + */ + public function getDatabasePlatform() + { + return $this->driver->getDatabasePlatform(); + } + + /** + * {@inheritDoc} + */ + public function getSchemaManager(DBALConnection $conn, AbstractPlatform $platform) + { + return $this->driver->getSchemaManager($conn, $platform); + } + + public function getExceptionConverter(): ExceptionConverter + { + return $this->driver->getExceptionConverter(); + } +} diff --git a/doctrine/dbal/src/Portability/Middleware.php b/doctrine/dbal/src/Portability/Middleware.php new file mode 100644 index 000000000..b00147062 --- /dev/null +++ b/doctrine/dbal/src/Portability/Middleware.php @@ -0,0 +1,32 @@ +mode = $mode; + $this->case = $case; + } + + public function wrap(DriverInterface $driver): DriverInterface + { + if ($this->mode !== 0) { + return new Driver($driver, $this->mode, $this->case); + } + + return $driver; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Portability/OptimizeFlags.php b/doctrine/dbal/src/Portability/OptimizeFlags.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Portability/OptimizeFlags.php rename to doctrine/dbal/src/Portability/OptimizeFlags.php index 7d8e55df4..742eb93fb 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Portability/OptimizeFlags.php +++ b/doctrine/dbal/src/Portability/OptimizeFlags.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform; -use Doctrine\DBAL\Platforms\SQLAnywhere16Platform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Platforms\SQLServer2012Platform; @@ -24,7 +23,6 @@ final class OptimizeFlags DB2Platform::class => 0, OraclePlatform::class => Connection::PORTABILITY_EMPTY_TO_NULL, PostgreSQL94Platform::class => 0, - SQLAnywhere16Platform::class => 0, SqlitePlatform::class => 0, SQLServer2012Platform::class => 0, ]; diff --git a/doctrine/dbal/src/Portability/Result.php b/doctrine/dbal/src/Portability/Result.php new file mode 100644 index 000000000..1fa91ab48 --- /dev/null +++ b/doctrine/dbal/src/Portability/Result.php @@ -0,0 +1,100 @@ +result = $result; + $this->converter = $converter; + } + + /** + * {@inheritDoc} + */ + public function fetchNumeric() + { + return $this->converter->convertNumeric( + $this->result->fetchNumeric() + ); + } + + /** + * {@inheritDoc} + */ + public function fetchAssociative() + { + return $this->converter->convertAssociative( + $this->result->fetchAssociative() + ); + } + + /** + * {@inheritDoc} + */ + public function fetchOne() + { + return $this->converter->convertOne( + $this->result->fetchOne() + ); + } + + /** + * {@inheritDoc} + */ + public function fetchAllNumeric(): array + { + return $this->converter->convertAllNumeric( + $this->result->fetchAllNumeric() + ); + } + + /** + * {@inheritDoc} + */ + public function fetchAllAssociative(): array + { + return $this->converter->convertAllAssociative( + $this->result->fetchAllAssociative() + ); + } + + /** + * {@inheritDoc} + */ + public function fetchFirstColumn(): array + { + return $this->converter->convertFirstColumn( + $this->result->fetchFirstColumn() + ); + } + + public function rowCount(): int + { + return $this->result->rowCount(); + } + + public function columnCount(): int + { + return $this->result->columnCount(); + } + + public function free(): void + { + $this->result->free(); + } +} diff --git a/doctrine/dbal/src/Portability/Statement.php b/doctrine/dbal/src/Portability/Statement.php new file mode 100644 index 000000000..f3f94e413 --- /dev/null +++ b/doctrine/dbal/src/Portability/Statement.php @@ -0,0 +1,55 @@ +Statement and applies portability measures. + */ + public function __construct(DriverStatement $stmt, Converter $converter) + { + $this->stmt = $stmt; + $this->converter = $converter; + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + return $this->stmt->bindParam($param, $variable, $type, $length); + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + return $this->stmt->bindValue($param, $value, $type); + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + return new Result( + $this->stmt->execute($params), + $this->converter + ); + } +} diff --git a/doctrine/dbal/src/Query.php b/doctrine/dbal/src/Query.php new file mode 100644 index 000000000..ea6024cd8 --- /dev/null +++ b/doctrine/dbal/src/Query.php @@ -0,0 +1,70 @@ + + */ + private $params; + + /** + * The types of the parameters bound to the query. + * + * @var array + */ + private $types; + + /** + * @param array $params + * @param array $types + * + * @psalm-suppress ImpurePropertyAssignment + */ + public function __construct(string $sql, array $params, array $types) + { + $this->sql = $sql; + $this->params = $params; + $this->types = $types; + } + + public function getSQL(): string + { + return $this->sql; + } + + /** + * @return array + */ + public function getParams(): array + { + return $this->params; + } + + /** + * @return array + */ + public function getTypes(): array + { + return $this->types; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php b/doctrine/dbal/src/Query/Expression/CompositeExpression.php similarity index 95% rename from doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php rename to doctrine/dbal/src/Query/Expression/CompositeExpression.php index 596e9fb3a..4e551e954 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php +++ b/doctrine/dbal/src/Query/Expression/CompositeExpression.php @@ -97,7 +97,7 @@ public function addMultiple(array $parts = []) */ public function add($part) { - if (empty($part)) { + if ($part === null) { return $this; } @@ -120,11 +120,7 @@ public function with($part, ...$parts): self { $that = clone $this; - $that->parts[] = $part; - - foreach ($parts as $part) { - $that->parts[] = $part; - } + $that->parts = array_merge($that->parts, [$part], $parts); return $that; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php b/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php rename to doctrine/dbal/src/Query/Expression/ExpressionBuilder.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php b/doctrine/dbal/src/Query/QueryBuilder.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php rename to doctrine/dbal/src/Query/QueryBuilder.php index 5ba7fea12..86e509ca8 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/doctrine/dbal/src/Query/QueryBuilder.php @@ -3,14 +3,14 @@ namespace Doctrine\DBAL\Query; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Exception; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\Expression\CompositeExpression; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; +use Doctrine\DBAL\Result; +use Doctrine\DBAL\Statement; use Doctrine\DBAL\Types\Type; -use function array_filter; use function array_key_exists; use function array_keys; use function array_unshift; @@ -90,7 +90,7 @@ class QueryBuilder /** * The query parameters. * - * @var array|array + * @var list|array */ private $params = []; @@ -200,7 +200,7 @@ public function getState() /** * Executes this query using the bound parameters and their types. * - * @return ResultStatement|int + * @return Result|int * * @throws Exception */ @@ -298,7 +298,7 @@ public function setParameter($key, $value, $type = null) * )); * * - * @param array|array $params Parameters to set + * @param list|array $params Parameters to set * @param array|array $types Parameter types * * @return $this This QueryBuilder instance. @@ -314,7 +314,7 @@ public function setParameters(array $params, array $types = []) /** * Gets all defined query parameters for the query being constructed indexed by parameter index or name. * - * @return array|array The currently defined query parameters + * @return list|array The currently defined query parameters */ public function getParameters() { @@ -479,7 +479,7 @@ public function select($select = null/*, string ...$selects*/) { $this->type = self::SELECT; - if (empty($select)) { + if ($select === null) { return $this; } @@ -529,7 +529,7 @@ public function addSelect($select = null/*, string ...$selects*/) { $this->type = self::SELECT; - if (empty($select)) { + if ($select === null) { return $this; } @@ -558,7 +558,7 @@ public function delete($delete = null, $alias = null) { $this->type = self::DELETE; - if (! $delete) { + if ($delete === null) { return $this; } @@ -588,7 +588,7 @@ public function update($update = null, $alias = null) { $this->type = self::UPDATE; - if (! $update) { + if ($update === null) { return $this; } @@ -621,7 +621,7 @@ public function insert($insert = null) { $this->type = self::INSERT; - if (! $insert) { + if ($insert === null) { return $this; } @@ -836,13 +836,10 @@ public function where($predicates) public function andWhere($where) { $args = func_get_args(); - $args = array_filter($args); // https://github.com/doctrine/dbal/issues/4282 $where = $this->getQueryPart('where'); if ($where instanceof CompositeExpression && $where->getType() === CompositeExpression::TYPE_AND) { - if (count($args) > 0) { - $where = $where->with(...$args); - } + $where = $where->with(...$args); } else { array_unshift($args, $where); $where = CompositeExpression::and(...$args); @@ -872,13 +869,10 @@ public function andWhere($where) public function orWhere($where) { $args = func_get_args(); - $args = array_filter($args); // https://github.com/doctrine/dbal/issues/4282 $where = $this->getQueryPart('where'); if ($where instanceof CompositeExpression && $where->getType() === CompositeExpression::TYPE_OR) { - if (count($args) > 0) { - $where = $where->with(...$args); - } + $where = $where->with(...$args); } else { array_unshift($args, $where); $where = CompositeExpression::or(...$args); @@ -907,7 +901,7 @@ public function orWhere($where) */ public function groupBy($groupBy/*, string ...$groupBys*/) { - if (empty($groupBy)) { + if (is_array($groupBy) && count($groupBy) === 0) { return $this; } @@ -936,7 +930,7 @@ public function groupBy($groupBy/*, string ...$groupBys*/) */ public function addGroupBy($groupBy/*, string ...$groupBys*/) { - if (empty($groupBy)) { + if (is_array($groupBy) && count($groupBy) === 0) { return $this; } @@ -1023,7 +1017,6 @@ public function having($having) public function andHaving($having) { $args = func_get_args(); - $args = array_filter($args); // https://github.com/doctrine/dbal/issues/4282 $having = $this->getQueryPart('having'); if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_AND) { @@ -1047,7 +1040,6 @@ public function andHaving($having) public function orHaving($having) { $args = func_get_args(); - $args = array_filter($args); // https://github.com/doctrine/dbal/issues/4282 $having = $this->getQueryPart('having'); if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_OR) { @@ -1071,7 +1063,7 @@ public function orHaving($having) */ public function orderBy($sort, $order = null) { - return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false); + return $this->add('orderBy', $sort . ' ' . ($order ?? 'ASC'), false); } /** @@ -1084,7 +1076,7 @@ public function orderBy($sort, $order = null) */ public function addOrderBy($sort, $order = null) { - return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true); + return $this->add('orderBy', $sort . ' ' . ($order ?? 'ASC'), true); } /** @@ -1174,6 +1166,8 @@ private function getSQLForSelect() /** * @return string[] + * + * @throws QueryException */ private function getFromClauses() { @@ -1277,7 +1271,7 @@ public function __toString() /** * Creates a new named parameter and bind the value $value to it. * - * This method provides a shortcut for PDOStatement::bindValue + * This method provides a shortcut for {@link Statement::bindValue()} * when using prepared statements. * * The parameter $value specifies the value that you want to bind. If @@ -1285,8 +1279,6 @@ public function __toString() * placeholder for you. An automatic placeholder will be of the name * ':dcValue1', ':dcValue2' etc. * - * For more information see {@link http://php.net/pdostatement-bindparam} - * * Example: * * $value = 2; @@ -1338,8 +1330,8 @@ public function createNamedParameter($value, $type = ParameterType::STRING, $pla */ public function createPositionalParameter($value, $type = ParameterType::STRING) { - $this->boundCounter++; $this->setParameter($this->boundCounter, $value, $type); + $this->boundCounter++; return '?'; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php b/doctrine/dbal/src/Query/QueryException.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php rename to doctrine/dbal/src/Query/QueryException.php diff --git a/doctrine/dbal/src/Result.php b/doctrine/dbal/src/Result.php new file mode 100644 index 000000000..59c1065a0 --- /dev/null +++ b/doctrine/dbal/src/Result.php @@ -0,0 +1,339 @@ +result = $result; + $this->connection = $connection; + } + + /** + * Returns the next row of the result as a numeric array or FALSE if there are no more rows. + * + * @return list|false + * + * @throws Exception + */ + public function fetchNumeric() + { + try { + return $this->result->fetchNumeric(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * Returns the next row of the result as an associative array or FALSE if there are no more rows. + * + * @return array|false + * + * @throws Exception + */ + public function fetchAssociative() + { + try { + return $this->result->fetchAssociative(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * Returns the first value of the next row of the result or FALSE if there are no more rows. + * + * @return mixed|false + * + * @throws Exception + */ + public function fetchOne() + { + try { + return $this->result->fetchOne(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * Returns an array containing all of the result rows represented as numeric arrays. + * + * @return list> + * + * @throws Exception + */ + public function fetchAllNumeric(): array + { + try { + return $this->result->fetchAllNumeric(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * Returns an array containing all of the result rows represented as associative arrays. + * + * @return list> + * + * @throws Exception + */ + public function fetchAllAssociative(): array + { + try { + return $this->result->fetchAllAssociative(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * Returns an array containing the values of the first column of the result. + * + * @return array + * + * @throws Exception + */ + public function fetchAllKeyValue(): array + { + $this->ensureHasKeyValue(); + + $data = []; + + foreach ($this->fetchAllNumeric() as [$key, $value]) { + $data[$key] = $value; + } + + return $data; + } + + /** + * Returns an associative array with the keys mapped to the first column and the values being + * an associative array representing the rest of the columns and their values. + * + * @return array> + * + * @throws Exception + */ + public function fetchAllAssociativeIndexed(): array + { + $data = []; + + foreach ($this->fetchAllAssociative() as $row) { + $data[array_shift($row)] = $row; + } + + return $data; + } + + /** + * @return list + * + * @throws Exception + */ + public function fetchFirstColumn(): array + { + try { + return $this->result->fetchFirstColumn(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * @return Traversable> + * + * @throws Exception + */ + public function iterateNumeric(): Traversable + { + try { + while (($row = $this->result->fetchNumeric()) !== false) { + yield $row; + } + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * @return Traversable> + * + * @throws Exception + */ + public function iterateAssociative(): Traversable + { + try { + while (($row = $this->result->fetchAssociative()) !== false) { + yield $row; + } + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * {@inheritDoc} + * + * @throws Exception + */ + public function iterateKeyValue(): Traversable + { + $this->ensureHasKeyValue(); + + foreach ($this->iterateNumeric() as [$key, $value]) { + yield $key => $value; + } + } + + /** + * Returns an iterator over the result set with the keys mapped to the first column and the values being + * an associative array representing the rest of the columns and their values. + * + * @return Traversable> + * + * @throws Exception + */ + public function iterateAssociativeIndexed(): Traversable + { + foreach ($this->iterateAssociative() as $row) { + yield array_shift($row) => $row; + } + } + + /** + * @return Traversable + * + * @throws Exception + */ + public function iterateColumn(): Traversable + { + try { + while (($value = $this->result->fetchOne()) !== false) { + yield $value; + } + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * @throws Exception + */ + public function rowCount(): int + { + try { + return $this->result->rowCount(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + /** + * @throws Exception + */ + public function columnCount(): int + { + try { + return $this->result->columnCount(); + } catch (DriverException $e) { + throw $this->connection->convertException($e); + } + } + + public function free(): void + { + $this->result->free(); + } + + /** + * @throws Exception + */ + private function ensureHasKeyValue(): void + { + $columnCount = $this->columnCount(); + + if ($columnCount < 2) { + throw NoKeyValue::fromColumnCount($columnCount); + } + } + + /** + * BC layer for a wide-spread use-case of old DBAL APIs + * + * @deprecated This API is deprecated and will be removed after 2022 + * + * @return mixed + */ + public function fetch(int $mode = FetchMode::ASSOCIATIVE) + { + if (func_num_args() > 1) { + throw new LogicException('Only invocations with one argument are still supported by this legecy API.'); + } + + if ($mode === FetchMode::ASSOCIATIVE) { + return $this->fetchAssociative(); + } + + if ($mode === FetchMode::NUMERIC) { + return $this->fetchNumeric(); + } + + if ($mode === FetchMode::COLUMN) { + return $this->fetchOne(); + } + + throw new LogicException('Only fetch modes declared on Doctrine\DBAL\FetchMode are supported by legacy API.'); + } + + /** + * BC layer for a wide-spread use-case of old DBAL APIs + * + * @deprecated This API is deprecated and will be removed after 2022 + * + * @return list + */ + public function fetchAll(int $mode = FetchMode::ASSOCIATIVE): array + { + if (func_num_args() > 1) { + throw new LogicException('Only invocations with one argument are still supported by this legecy API.'); + } + + if ($mode === FetchMode::ASSOCIATIVE) { + return $this->fetchAllAssociative(); + } + + if ($mode === FetchMode::NUMERIC) { + return $this->fetchAllNumeric(); + } + + if ($mode === FetchMode::COLUMN) { + return $this->fetchFirstColumn(); + } + + throw new LogicException('Only fetch modes declared on Doctrine\DBAL\FetchMode are supported by legacy API.'); + } +} diff --git a/doctrine/dbal/src/SQL/Parser.php b/doctrine/dbal/src/SQL/Parser.php new file mode 100644 index 000000000..32d306ca0 --- /dev/null +++ b/doctrine/dbal/src/SQL/Parser.php @@ -0,0 +1,117 @@ +getMySQLStringLiteralPattern("'"), + $this->getMySQLStringLiteralPattern('"'), + ]; + } else { + $patterns = [ + $this->getAnsiSQLStringLiteralPattern("'"), + $this->getAnsiSQLStringLiteralPattern('"'), + ]; + } + + $patterns = array_merge($patterns, [ + self::BACKTICK_IDENTIFIER, + self::BRACKET_IDENTIFIER, + self::MULTICHAR, + self::ONE_LINE_COMMENT, + self::MULTI_LINE_COMMENT, + self::OTHER, + ]); + + $this->sqlPattern = sprintf('(%s)+', implode('|', $patterns)); + } + + /** + * Parses the given SQL statement + */ + public function parse(string $sql, Visitor $visitor): void + { + /** @var array $patterns */ + $patterns = [ + self::NAMED_PARAMETER => static function (string $sql) use ($visitor): void { + $visitor->acceptNamedParameter($sql); + }, + self::POSITIONAL_PARAMETER => static function (string $sql) use ($visitor): void { + $visitor->acceptPositionalParameter($sql); + }, + $this->sqlPattern => static function (string $sql) use ($visitor): void { + $visitor->acceptOther($sql); + }, + self::SPECIAL => static function (string $sql) use ($visitor): void { + $visitor->acceptOther($sql); + }, + ]; + + $offset = 0; + + while (($handler = current($patterns)) !== false) { + if (preg_match('~\G' . key($patterns) . '~s', $sql, $matches, 0, $offset) === 1) { + $handler($matches[0]); + reset($patterns); + + $offset += strlen($matches[0]); + } else { + next($patterns); + } + } + + assert($offset === strlen($sql)); + } + + private function getMySQLStringLiteralPattern(string $delimiter): string + { + return $delimiter . '((\\\\' . self::ANY . ')|(?![' . $delimiter . '\\\\])' . self::ANY . ')*' . $delimiter; + } + + private function getAnsiSQLStringLiteralPattern(string $delimiter): string + { + return $delimiter . '[^' . $delimiter . ']*' . $delimiter; + } +} diff --git a/doctrine/dbal/src/SQL/Parser/Visitor.php b/doctrine/dbal/src/SQL/Parser/Visitor.php new file mode 100644 index 000000000..574ba1bf1 --- /dev/null +++ b/doctrine/dbal/src/SQL/Parser/Visitor.php @@ -0,0 +1,26 @@ +getName(); - if (! $this->_namespace) { + if ($this->_namespace === null) { $name = $defaultNamespaceName . '.' . $name; } @@ -165,7 +165,7 @@ protected function trimQuotes($identifier) */ public function getName() { - if ($this->_namespace) { + if ($this->_namespace !== null) { return $this->_namespace . '.' . $this->_name; } @@ -204,7 +204,7 @@ public function getQuotedName(AbstractPlatform $platform) */ protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) { - $hash = implode('', array_map(static function ($column) { + $hash = implode('', array_map(static function ($column): string { return dechex(crc32($column)); }, $columnNames)); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/doctrine/dbal/src/Schema/AbstractSchemaManager.php similarity index 91% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php rename to doctrine/dbal/src/Schema/AbstractSchemaManager.php index 35f2c6127..6b7d162e8 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/doctrine/dbal/src/Schema/AbstractSchemaManager.php @@ -3,7 +3,6 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\ConnectionException; use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs; use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs; use Doctrine\DBAL\Events; @@ -19,7 +18,6 @@ use function call_user_func_array; use function count; use function func_get_args; -use function is_array; use function is_callable; use function preg_match; use function str_replace; @@ -45,13 +43,10 @@ abstract class AbstractSchemaManager */ protected $_platform; - /** - * Constructor. Accepts the Connection instance to manage the schema for. - */ - public function __construct(Connection $conn, ?AbstractPlatform $platform = null) + public function __construct(Connection $connection, AbstractPlatform $platform) { - $this->_conn = $conn; - $this->_platform = $platform ?: $this->_conn->getDatabasePlatform(); + $this->_conn = $connection; + $this->_platform = $platform; } /** @@ -97,6 +92,8 @@ public function tryMethod() * Lists the available databases for this connection. * * @return string[] + * + * @throws Exception */ public function listDatabases() { @@ -111,6 +108,8 @@ public function listDatabases() * Returns a list of all namespaces in the current database. * * @return string[] + * + * @throws Exception */ public function listNamespaceNames() { @@ -127,6 +126,8 @@ public function listNamespaceNames() * @param string|null $database * * @return Sequence[] + * + * @throws Exception */ public function listSequences($database = null) { @@ -155,10 +156,12 @@ public function listSequences($database = null) * @param string|null $database * * @return Column[] + * + * @throws Exception */ public function listTableColumns($table, $database = null) { - if (! $database) { + if ($database === null) { $database = $this->_conn->getDatabase(); } @@ -177,6 +180,8 @@ public function listTableColumns($table, $database = null) * @param string $table The name of the table. * * @return Index[] + * + * @throws Exception */ public function listTableIndexes($table) { @@ -195,6 +200,8 @@ public function listTableIndexes($table) * @param string|string[] $names * * @return bool + * + * @throws Exception */ public function tablesExist($names) { @@ -207,6 +214,8 @@ public function tablesExist($names) * Returns a list of all tables in the current database. * * @return string[] + * + * @throws Exception */ public function listTableNames() { @@ -229,27 +238,19 @@ public function listTableNames() protected function filterAssetNames($assetNames) { $filter = $this->_conn->getConfiguration()->getSchemaAssetsFilter(); - if (! $filter) { + if ($filter === null) { return $assetNames; } return array_values(array_filter($assetNames, $filter)); } - /** - * @deprecated Use Configuration::getSchemaAssetsFilter() instead - * - * @return string|null - */ - protected function getFilterSchemaAssetsExpression() - { - return $this->_conn->getConfiguration()->getFilterSchemaAssetsExpression(); - } - /** * Lists the tables for this connection. * * @return Table[] + * + * @throws Exception */ public function listTables() { @@ -267,24 +268,29 @@ public function listTables() * @param string $name * * @return Table + * + * @throws Exception */ public function listTableDetails($name) { $columns = $this->listTableColumns($name); $foreignKeys = []; + if ($this->_platform->supportsForeignKeyConstraints()) { $foreignKeys = $this->listTableForeignKeys($name); } $indexes = $this->listTableIndexes($name); - return new Table($name, $columns, $indexes, $foreignKeys); + return new Table($name, $columns, $indexes, [], $foreignKeys); } /** * Lists the views this connection has. * * @return View[] + * + * @throws Exception */ public function listViews() { @@ -302,6 +308,8 @@ public function listViews() * @param string|null $database * * @return ForeignKeyConstraint[] + * + * @throws Exception */ public function listTableForeignKeys($table, $database = null) { @@ -325,6 +333,8 @@ public function listTableForeignKeys($table, $database = null) * @param string $database The name of the database to drop. * * @return void + * + * @throws Exception */ public function dropDatabase($database) { @@ -337,6 +347,8 @@ public function dropDatabase($database) * @param string $name The name of the table to drop. * * @return void + * + * @throws Exception */ public function dropTable($name) { @@ -350,6 +362,8 @@ public function dropTable($name) * @param Table|string $table The name of the table. * * @return void + * + * @throws Exception */ public function dropIndex($index, $table) { @@ -366,6 +380,8 @@ public function dropIndex($index, $table) * @param Table|string $table The name of the table. * * @return void + * + * @throws Exception */ public function dropConstraint(Constraint $constraint, $table) { @@ -379,6 +395,8 @@ public function dropConstraint(Constraint $constraint, $table) * @param Table|string $table The name of the table with the foreign key. * * @return void + * + * @throws Exception */ public function dropForeignKey($foreignKey, $table) { @@ -391,6 +409,8 @@ public function dropForeignKey($foreignKey, $table) * @param string $name The name of the sequence to drop. * * @return void + * + * @throws Exception */ public function dropSequence($name) { @@ -403,6 +423,8 @@ public function dropSequence($name) * @param string $name The name of the view. * * @return void + * + * @throws Exception */ public function dropView($name) { @@ -417,6 +439,8 @@ public function dropView($name) * @param string $database The name of the database to create. * * @return void + * + * @throws Exception */ public function createDatabase($database) { @@ -427,6 +451,8 @@ public function createDatabase($database) * Creates a new table. * * @return void + * + * @throws Exception */ public function createTable(Table $table) { @@ -441,7 +467,7 @@ public function createTable(Table $table) * * @return void * - * @throws ConnectionException If something fails at database level. + * @throws Exception */ public function createSequence($sequence) { @@ -454,6 +480,8 @@ public function createSequence($sequence) * @param Table|string $table * * @return void + * + * @throws Exception */ public function createConstraint(Constraint $constraint, $table) { @@ -466,6 +494,8 @@ public function createConstraint(Constraint $constraint, $table) * @param Table|string $table The name of the table on which the index is to be created. * * @return void + * + * @throws Exception */ public function createIndex(Index $index, $table) { @@ -479,6 +509,8 @@ public function createIndex(Index $index, $table) * @param Table|string $table The name of the table on which the foreign key is to be created. * * @return void + * + * @throws Exception */ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) { @@ -489,6 +521,8 @@ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) * Creates a new view. * * @return void + * + * @throws Exception */ public function createView(View $view) { @@ -506,6 +540,8 @@ public function createView(View $view) * @param Table|string $table * * @return void + * + * @throws Exception */ public function dropAndCreateConstraint(Constraint $constraint, $table) { @@ -519,6 +555,8 @@ public function dropAndCreateConstraint(Constraint $constraint, $table) * @param Table|string $table The name of the table on which the index is to be created. * * @return void + * + * @throws Exception */ public function dropAndCreateIndex(Index $index, $table) { @@ -534,6 +572,8 @@ public function dropAndCreateIndex(Index $index, $table) * @param Table|string $table The name of the table on which the foreign key is to be created. * * @return void + * + * @throws Exception */ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table) { @@ -546,7 +586,7 @@ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table * * @return void * - * @throws ConnectionException If something fails at database level. + * @throws Exception */ public function dropAndCreateSequence(Sequence $sequence) { @@ -558,6 +598,8 @@ public function dropAndCreateSequence(Sequence $sequence) * Drops and creates a new table. * * @return void + * + * @throws Exception */ public function dropAndCreateTable(Table $table) { @@ -571,6 +613,8 @@ public function dropAndCreateTable(Table $table) * @param string $database The name of the database to create. * * @return void + * + * @throws Exception */ public function dropAndCreateDatabase($database) { @@ -582,6 +626,8 @@ public function dropAndCreateDatabase($database) * Drops and creates a new view. * * @return void + * + * @throws Exception */ public function dropAndCreateView(View $view) { @@ -595,13 +641,12 @@ public function dropAndCreateView(View $view) * Alters an existing tables schema. * * @return void + * + * @throws Exception */ public function alterTable(TableDiff $tableDiff) { $queries = $this->_platform->getAlterTableSQL($tableDiff); - if (! is_array($queries) || ! count($queries)) { - return; - } foreach ($queries as $ddlQuery) { $this->_execSql($ddlQuery); @@ -615,6 +660,8 @@ public function alterTable(TableDiff $tableDiff) * @param string $newName The new name of the table. * * @return void + * + * @throws Exception */ public function renameTable($name, $newName) { @@ -637,13 +684,7 @@ protected function _getPortableDatabasesList($databases) { $list = []; foreach ($databases as $value) { - $value = $this->_getPortableDatabaseDefinition($value); - - if (! $value) { - continue; - } - - $list[] = $value; + $list[] = $this->_getPortableDatabaseDefinition($value); } return $list; @@ -652,7 +693,8 @@ protected function _getPortableDatabasesList($databases) /** * Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition. * - * @param mixed[][] $namespaces The list of namespace names in the native DBMS data definition. + * @param array> $namespaces The list of namespace names + * in the native DBMS data definition. * * @return string[] */ @@ -680,7 +722,7 @@ protected function _getPortableDatabaseDefinition($database) /** * Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition. * - * @param mixed[] $namespace The native DBMS namespace definition. + * @param array $namespace The native DBMS namespace definition. * * @return mixed */ @@ -689,41 +731,6 @@ protected function getPortableNamespaceDefinition(array $namespace) return $namespace; } - /** - * @deprecated - * - * @param mixed[][] $functions - * - * @return mixed[][] - */ - protected function _getPortableFunctionsList($functions) - { - $list = []; - foreach ($functions as $value) { - $value = $this->_getPortableFunctionDefinition($value); - - if (! $value) { - continue; - } - - $list[] = $value; - } - - return $list; - } - - /** - * @deprecated - * - * @param mixed[] $function - * - * @return mixed - */ - protected function _getPortableFunctionDefinition($function) - { - return $function; - } - /** * @param mixed[][] $triggers * @@ -759,6 +766,8 @@ protected function _getPortableTriggerDefinition($trigger) * @param mixed[][] $sequences * * @return Sequence[] + * + * @throws Exception */ protected function _getPortableSequencesList($sequences) { @@ -793,6 +802,8 @@ protected function _getPortableSequenceDefinition($sequence) * @param mixed[][] $tableColumns * * @return Column[] + * + * @throws Exception */ protected function _getPortableTableColumnList($table, $database, $tableColumns) { @@ -815,7 +826,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) $column = $this->_getPortableTableColumnDefinition($tableColumn); } - if (! $column) { + if ($column === null) { continue; } @@ -832,6 +843,8 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) * @param mixed[] $tableColumn * * @return Column + * + * @throws Exception */ abstract protected function _getPortableTableColumnDefinition($tableColumn); @@ -842,6 +855,8 @@ abstract protected function _getPortableTableColumnDefinition($tableColumn); * @param string|null $tableName * * @return Index[] + * + * @throws Exception */ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { @@ -903,7 +918,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null ); } - if (! $index) { + if ($index === null) { continue; } @@ -922,13 +937,7 @@ protected function _getPortableTablesList($tables) { $list = []; foreach ($tables as $value) { - $value = $this->_getPortableTableDefinition($value); - - if (! $value) { - continue; - } - - $list[] = $value; + $list[] = $this->_getPortableTableDefinition($value); } return $list; @@ -953,13 +962,7 @@ protected function _getPortableUsersList($users) { $list = []; foreach ($users as $value) { - $value = $this->_getPortableUserDefinition($value); - - if (! $value) { - continue; - } - - $list[] = $value; + $list[] = $this->_getPortableUserDefinition($value); } return $list; @@ -986,7 +989,7 @@ protected function _getPortableViewsList($views) foreach ($views as $value) { $view = $this->_getPortableViewDefinition($value); - if (! $view) { + if ($view === false) { continue; } @@ -1037,6 +1040,8 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) * @param string[]|string $sql * * @return void + * + * @throws Exception */ protected function _execSql($sql) { @@ -1049,6 +1054,8 @@ protected function _execSql($sql) * Creates a schema instance for the current database. * * @return Schema + * + * @throws Exception */ public function createSchema() { @@ -1073,6 +1080,8 @@ public function createSchema() * Creates the configuration for this schema. * * @return SchemaConfig + * + * @throws Exception */ public function createSchemaConfig() { @@ -1109,10 +1118,18 @@ public function createSchemaConfig() * returns the name of the currently connected database. * * @return string[] + * + * @throws Exception */ public function getSchemaSearchPaths() { - return [$this->_conn->getDatabase()]; + $database = $this->_conn->getDatabase(); + + if ($database !== null) { + return [$database]; + } + + return []; } /** @@ -1126,7 +1143,7 @@ public function getSchemaSearchPaths() */ public function extractDoctrineTypeFromComment($comment, $currentType) { - if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match)) { + if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match) === 1) { return $match[1]; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php b/doctrine/dbal/src/Schema/Column.php similarity index 95% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php rename to doctrine/dbal/src/Schema/Column.php index f63bcc922..714bbc428 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php +++ b/doctrine/dbal/src/Schema/Column.php @@ -2,15 +2,12 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\DBAL\Schema\Exception\UnknownColumnOption; use Doctrine\DBAL\Types\Type; use function array_merge; use function is_numeric; use function method_exists; -use function sprintf; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Object representation of a database column. @@ -61,6 +58,8 @@ class Column extends AbstractAsset * * @param string $name * @param mixed[] $options + * + * @throws SchemaException */ public function __construct($name, Type $type, array $options = []) { @@ -73,20 +72,16 @@ public function __construct($name, Type $type, array $options = []) * @param mixed[] $options * * @return Column + * + * @throws SchemaException */ public function setOptions(array $options) { foreach ($options as $name => $value) { $method = 'set' . $name; + if (! method_exists($this, $method)) { - // next major: throw an exception - @trigger_error(sprintf( - 'The "%s" column option is not supported,' . - ' setting it is deprecated and will cause an error in Doctrine DBAL 3.0', - $name - ), E_USER_DEPRECATED); - - continue; + throw UnknownColumnOption::new($name); } $this->$method($value); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php b/doctrine/dbal/src/Schema/ColumnDiff.php similarity index 87% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php rename to doctrine/dbal/src/Schema/ColumnDiff.php index 2f6ae6520..c9c2a52bc 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php +++ b/doctrine/dbal/src/Schema/ColumnDiff.php @@ -44,7 +44,7 @@ public function __construct( */ public function hasChanged($propertyName) { - return in_array($propertyName, $this->changedProperties); + return in_array($propertyName, $this->changedProperties, true); } /** @@ -52,7 +52,7 @@ public function hasChanged($propertyName) */ public function getOldColumnName() { - $quote = $this->fromColumn && $this->fromColumn->isQuoted(); + $quote = $this->fromColumn !== null && $this->fromColumn->isQuoted(); return new Identifier($this->oldColumnName, $quote); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php b/doctrine/dbal/src/Schema/Comparator.php similarity index 94% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php rename to doctrine/dbal/src/Schema/Comparator.php index 7e24b3e8c..7ddf5238d 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php +++ b/doctrine/dbal/src/Schema/Comparator.php @@ -9,7 +9,6 @@ use function array_keys; use function array_map; use function array_merge; -use function array_shift; use function array_unique; use function assert; use function count; @@ -23,6 +22,8 @@ class Comparator { /** * @return SchemaDiff + * + * @throws SchemaException */ public static function compareSchemas(Schema $fromSchema, Schema $toSchema) { @@ -39,6 +40,8 @@ public static function compareSchemas(Schema $fromSchema, Schema $toSchema) * stored in $toSchema. * * @return SchemaDiff + * + * @throws SchemaException */ public function compare(Schema $fromSchema, Schema $toSchema) { @@ -193,6 +196,8 @@ public function diffSequence(Sequence $sequence1, Sequence $sequence2) * If there are no differences this method returns the boolean false. * * @return TableDiff|false + * + * @throws SchemaException */ public function diffTable(Table $fromTable, Table $toTable) { @@ -225,7 +230,7 @@ public function diffTable(Table $fromTable, Table $toTable) // See if column has changed properties in "to" table. $changedProperties = $this->diffColumn($column, $toTable->getColumn($columnName)); - if (empty($changedProperties)) { + if (count($changedProperties) === 0) { continue; } @@ -304,7 +309,7 @@ public function diffTable(Table $fromTable, Table $toTable) $changes++; } - return $changes ? $tableDifferences : false; + return $changes > 0 ? $tableDifferences : false; } /** @@ -451,14 +456,6 @@ public function diffColumn(Column $column1, Column $column2) $changedProperties[] = $property; } - // This is a very nasty hack to make comparator work with the legacy json_array type, - // which should be killed in v3 - if ($this->isALegacyJsonComparison($properties1['type'], $properties2['type'])) { - array_shift($changedProperties); - - $changedProperties[] = 'comment'; - } - // Null values need to be checked additionally as they tell whether to create or drop a default value. // null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation. if ( @@ -473,8 +470,8 @@ public function diffColumn(Column $column1, Column $column2) $properties1['type'] instanceof Types\BinaryType ) { // check if value of length is set at all, default value assumed otherwise. - $length1 = $properties1['length'] ?: 255; - $length2 = $properties2['length'] ?: 255; + $length1 = $properties1['length'] ?? 255; + $length2 = $properties2['length'] ?? 255; if ($length1 !== $length2) { $changedProperties[] = 'length'; } @@ -483,7 +480,7 @@ public function diffColumn(Column $column1, Column $column2) $changedProperties[] = 'fixed'; } } elseif ($properties1['type'] instanceof Types\DecimalType) { - if (($properties1['precision'] ?: 10) !== ($properties2['precision'] ?: 10)) { + if (($properties1['precision'] ?? 10) !== ($properties2['precision'] ?? 10)) { $changedProperties[] = 'precision'; } @@ -526,21 +523,6 @@ public function diffColumn(Column $column1, Column $column2) return array_unique($changedProperties); } - /** - * TODO: kill with fire on v3.0 - * - * @deprecated - */ - private function isALegacyJsonComparison(Types\Type $one, Types\Type $other): bool - { - if (! $one instanceof Types\JsonType || ! $other instanceof Types\JsonType) { - return false; - } - - return (! $one instanceof Types\JsonArrayType && $other instanceof Types\JsonArrayType) - || (! $other instanceof Types\JsonArrayType && $one instanceof Types\JsonArrayType); - } - /** * Finds the difference between the indexes $index1 and $index2. * diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php b/doctrine/dbal/src/Schema/Constraint.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php rename to doctrine/dbal/src/Schema/Constraint.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/doctrine/dbal/src/Schema/DB2SchemaManager.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php rename to doctrine/dbal/src/Schema/DB2SchemaManager.php index fcc196ae5..d956d5b7d 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/doctrine/dbal/src/Schema/DB2SchemaManager.php @@ -2,6 +2,7 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Types\Type; @@ -28,8 +29,7 @@ class DB2SchemaManager extends AbstractSchemaManager */ public function listTableNames() { - $sql = $this->_platform->getListTablesSQL(); - $sql .= ' AND CREATOR = UPPER(' . $this->_conn->quote($this->_conn->getUsername()) . ')'; + $sql = $this->_platform->getListTablesSQL() . ' AND CREATOR = CURRENT_USER'; $tables = $this->_conn->fetchAllAssociative($sql); @@ -38,6 +38,8 @@ public function listTableNames() /** * {@inheritdoc} + * + * @throws Exception */ protected function _getPortableTableColumnDefinition($tableColumn) { @@ -53,7 +55,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) if ($tableColumn['default'] !== null && $tableColumn['default'] !== 'NULL') { $default = $tableColumn['default']; - if (preg_match('/^\'(.*)\'$/s', $default, $matches)) { + if (preg_match('/^\'(.*)\'$/s', $default, $matches) === 1) { $default = str_replace("''", "'", $matches[1]); } } diff --git a/doctrine/dbal/src/Schema/Exception/InvalidTableName.php b/doctrine/dbal/src/Schema/Exception/InvalidTableName.php new file mode 100644 index 000000000..440e60785 --- /dev/null +++ b/doctrine/dbal/src/Schema/Exception/InvalidTableName.php @@ -0,0 +1,20 @@ +_options[$event])) { $onEvent = strtoupper($this->_options[$event]); - if (! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) { + if ($onEvent !== 'NO ACTION' && $onEvent !== 'RESTRICT') { return $onEvent; } } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php b/doctrine/dbal/src/Schema/Identifier.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php rename to doctrine/dbal/src/Schema/Identifier.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php b/doctrine/dbal/src/Schema/Index.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php rename to doctrine/dbal/src/Schema/Index.php index 4880da717..947ec896a 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php +++ b/doctrine/dbal/src/Schema/Index.php @@ -11,7 +11,6 @@ use function array_search; use function array_shift; use function count; -use function is_string; use function strtolower; class Index extends AbstractAsset implements Constraint @@ -79,18 +78,10 @@ public function __construct( } /** - * @param string $column - * - * @return void - * * @throws InvalidArgumentException */ - protected function _addColumn($column) + protected function _addColumn(string $column): void { - if (! is_string($column)) { - throw new InvalidArgumentException('Expecting a string as Index Column'); - } - $this->_columns[$column] = new Identifier($column); } @@ -172,7 +163,7 @@ public function hasColumnAtPosition($name, $pos = 0) $name = $this->trimQuotes(strtolower($name)); $indexColumns = array_map('strtolower', $this->getUnquotedColumns()); - return array_search($name, $indexColumns) === $pos; + return array_search($name, $indexColumns, true) === $pos; } /** diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/doctrine/dbal/src/Schema/MySQLSchemaManager.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php rename to doctrine/dbal/src/Schema/MySQLSchemaManager.php index e5532f802..b27cdcb07 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/doctrine/dbal/src/Schema/MySQLSchemaManager.php @@ -3,7 +3,7 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Platforms\MariaDb1027Platform; -use Doctrine\DBAL\Platforms\MySqlPlatform; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Types\Type; use function array_change_key_case; @@ -21,9 +21,9 @@ use const CASE_LOWER; /** - * Schema manager for the MySql RDBMS. + * Schema manager for the MySQL RDBMS. */ -class MySqlSchemaManager extends AbstractSchemaManager +class MySQLSchemaManager extends AbstractSchemaManager { /** * @see https://mariadb.com/kb/en/library/string-literals/#escape-sequences @@ -148,7 +148,13 @@ protected function _getPortableTableColumnDefinition($tableColumn) case 'real': case 'numeric': case 'decimal': - if (preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) { + if ( + preg_match( + '([A-Za-z]+\(([0-9]+),([0-9]+)\))', + $tableColumn['type'], + $match + ) === 1 + ) { $precision = $match[1]; $scale = $match[2]; $length = null; @@ -157,27 +163,27 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; case 'tinytext': - $length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT; + $length = MySQLPlatform::LENGTH_LIMIT_TINYTEXT; break; case 'text': - $length = MySqlPlatform::LENGTH_LIMIT_TEXT; + $length = MySQLPlatform::LENGTH_LIMIT_TEXT; break; case 'mediumtext': - $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT; + $length = MySQLPlatform::LENGTH_LIMIT_MEDIUMTEXT; break; case 'tinyblob': - $length = MySqlPlatform::LENGTH_LIMIT_TINYBLOB; + $length = MySQLPlatform::LENGTH_LIMIT_TINYBLOB; break; case 'blob': - $length = MySqlPlatform::LENGTH_LIMIT_BLOB; + $length = MySQLPlatform::LENGTH_LIMIT_BLOB; break; case 'mediumblob': - $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB; + $length = MySQLPlatform::LENGTH_LIMIT_MEDIUMBLOB; break; case 'tinyint': @@ -251,7 +257,7 @@ private function getMariaDb1027ColumnDefault(MariaDb1027Platform $platform, ?str return null; } - if (preg_match('/^\'(.*)\'$/', $columnDefault, $matches)) { + if (preg_match('/^\'(.*)\'$/', $columnDefault, $matches) === 1) { return strtr($matches[1], self::MARIADB_ESCAPE_SEQUENCES); } @@ -325,7 +331,7 @@ public function listTableDetails($name) $table = parent::listTableDetails($name); $platform = $this->_platform; - assert($platform instanceof MySqlPlatform); + assert($platform instanceof MySQLPlatform); $sql = $platform->getListTableMetadataSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/doctrine/dbal/src/Schema/OracleSchemaManager.php similarity index 78% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php rename to doctrine/dbal/src/Schema/OracleSchemaManager.php index e8732667a..757af8bb2 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/doctrine/dbal/src/Schema/OracleSchemaManager.php @@ -2,21 +2,17 @@ namespace Doctrine\DBAL\Schema; -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Driver\Exception; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Types\Type; -use Throwable; use function array_change_key_case; use function array_values; use function assert; use function preg_match; -use function sprintf; use function str_replace; use function strpos; use function strtolower; -use function strtoupper; use function trim; use const CASE_LOWER; @@ -26,35 +22,6 @@ */ class OracleSchemaManager extends AbstractSchemaManager { - /** - * {@inheritdoc} - */ - public function dropDatabase($database) - { - try { - parent::dropDatabase($database); - } catch (DBALException $exception) { - $exception = $exception->getPrevious(); - assert($exception instanceof Throwable); - - if (! $exception instanceof Exception) { - throw $exception; - } - - // If we have a error code 1940 (ORA-01940), the drop database operation failed - // because of active connections on the database. - // To force dropping the database, we first have to close all active connections - // on that database and issue the drop database operation again. - if ($exception->getErrorCode() !== 1940) { - throw $exception; - } - - $this->killUserSessions($database); - - parent::dropDatabase($database); - } - } - /** * {@inheritdoc} */ @@ -127,7 +94,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $dbType = strtolower($tableColumn['data_type']); if (strpos($dbType, 'timestamp(') === 0) { - if (strpos($dbType, 'with time zone')) { + if (strpos($dbType, 'with time zone') !== false) { $dbType = 'timestamptz'; } else { $dbType = 'timestamp'; @@ -149,7 +116,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) if ($tableColumn['data_default'] !== null) { // Default values returned from database are represented as literal expressions - if (preg_match('/^\'(.*)\'$/s', $tableColumn['data_default'], $matches)) { + if (preg_match('/^\'(.*)\'$/s', $tableColumn['data_default'], $matches) === 1) { $tableColumn['data_default'] = str_replace("''", "'", $matches[1]); } } @@ -267,18 +234,6 @@ protected function _getPortableSequenceDefinition($sequence) ); } - /** - * {@inheritdoc} - * - * @deprecated - */ - protected function _getPortableFunctionDefinition($function) - { - $function = array_change_key_case($function, CASE_LOWER); - - return $function['name']; - } - /** * {@inheritdoc} */ @@ -291,17 +246,9 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} - * - * @param string|null $database - * - * Calling this method without an argument or by passing NULL is deprecated. */ - public function createDatabase($database = null) + public function createDatabase($database) { - if ($database === null) { - $database = $this->_conn->getDatabase(); - } - $params = $this->_conn->getParams(); $username = $database; $password = $params['password']; @@ -317,6 +264,8 @@ public function createDatabase($database = null) * @param string $table * * @return bool + * + * @throws Exception */ public function dropAutoincrement($table) { @@ -352,51 +301,13 @@ public function dropTable($name) */ private function getQuotedIdentifierName($identifier) { - if (preg_match('/[a-z]/', $identifier)) { + if (preg_match('/[a-z]/', $identifier) === 1) { return $this->_platform->quoteIdentifier($identifier); } return $identifier; } - /** - * Kills sessions connected with the given user. - * - * This is useful to force DROP USER operations which could fail because of active user sessions. - * - * @param string $user The name of the user to kill sessions for. - * - * @return void - */ - private function killUserSessions($user) - { - $sql = <<_conn->fetchAllAssociative($sql, [strtoupper($user)]); - - foreach ($activeUserSessions as $activeUserSession) { - $activeUserSession = array_change_key_case($activeUserSession, CASE_LOWER); - - $this->_execSql( - sprintf( - "ALTER SYSTEM KILL SESSION '%s, %s' IMMEDIATE", - $activeUserSession['sid'], - $activeUserSession['serial#'] - ) - ); - } - } - /** * {@inheritdoc} */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php similarity index 85% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php rename to doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php index 4d7f3d7f9..9868359f9 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php @@ -2,9 +2,8 @@ namespace Doctrine\DBAL\Schema; -use Doctrine\DBAL\Exception\DriverException; -use Doctrine\DBAL\FetchMode; -use Doctrine\DBAL\Platforms\PostgreSqlPlatform; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; @@ -31,7 +30,7 @@ /** * PostgreSQL Schema Manager. */ -class PostgreSqlSchemaManager extends AbstractSchemaManager +class PostgreSQLSchemaManager extends AbstractSchemaManager { /** @var string[] */ private $existingSchemaPaths; @@ -40,28 +39,24 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager * Gets all the existing schema names. * * @return string[] + * + * @throws Exception */ public function getSchemaNames() { - $statement = $this->_conn->executeQuery( + return $this->_conn->fetchFirstColumn( "SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_.*' AND nspname != 'information_schema'" ); - - return $statement->fetchAll(FetchMode::COLUMN); } /** - * Returns an array of schema search paths. - * - * This is a PostgreSQL only function. - * - * @return string[] + * {@inheritDoc} */ public function getSchemaSearchPaths() { $params = $this->_conn->getParams(); - $searchPaths = $this->_conn->fetchColumn('SHOW search_path'); + $searchPaths = $this->_conn->fetchOne('SHOW search_path'); assert($searchPaths !== false); $schema = explode(',', $searchPaths); @@ -101,40 +96,11 @@ public function determineExistingSchemaSearchPaths() $names = $this->getSchemaNames(); $paths = $this->getSchemaSearchPaths(); - $this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names) { - return in_array($v, $names); + $this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names): bool { + return in_array($v, $names, true); }); } - /** - * {@inheritdoc} - */ - public function dropDatabase($database) - { - try { - parent::dropDatabase($database); - } catch (DriverException $exception) { - // If we have a SQLSTATE 55006, the drop database operation failed - // because of active connections on the database. - // To force dropping the database, we first have to close all active connections - // on that database and issue the drop database operation again. - if ($exception->getSQLState() !== '55006') { - throw $exception; - } - - assert($this->_platform instanceof PostgreSqlPlatform); - - $this->_execSql( - [ - $this->_platform->getDisallowDatabaseConnectionsSQL($database), - $this->_platform->getCloseActiveDatabaseConnectionsSQL($database), - ] - ); - - parent::dropDatabase($database); - } - } - /** * {@inheritdoc} */ @@ -146,11 +112,23 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) $foreignColumns = []; $foreignTable = null; - if (preg_match('(ON UPDATE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], $match)) { + if ( + preg_match( + '(ON UPDATE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', + $tableForeignKey['condef'], + $match + ) === 1 + ) { $onUpdate = $match[1]; } - if (preg_match('(ON DELETE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], $match)) { + if ( + preg_match( + '(ON DELETE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', + $tableForeignKey['condef'], + $match + ) === 1 + ) { $onDelete = $match[1]; } @@ -308,7 +286,7 @@ protected function _getPortableSequenceDefinition($sequence) if (! isset($sequence['increment_by'], $sequence['min_value'])) { /** @var string[] $data */ - $data = $this->_conn->fetchAssoc( + $data = $this->_conn->fetchAssociative( 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName) ); @@ -334,15 +312,15 @@ protected function _getPortableTableColumnDefinition($tableColumn) $matches = []; $autoincrement = false; - if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches)) { + if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches) === 1) { $tableColumn['sequence'] = $matches[1]; $tableColumn['default'] = null; $autoincrement = true; } - if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches)) { + if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches) === 1) { $tableColumn['default'] = $matches[1]; - } elseif (preg_match('/^NULL::/', $tableColumn['default'])) { + } elseif (preg_match('/^NULL::/', $tableColumn['default']) === 1) { $tableColumn['default'] = null; } @@ -367,7 +345,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $dbType = strtolower($tableColumn['type']); if ( - strlen($tableColumn['domain_type']) + strlen($tableColumn['domain_type']) > 0 && ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type']) ) { $dbType = strtolower($tableColumn['domain_type']); @@ -437,7 +415,13 @@ protected function _getPortableTableColumnDefinition($tableColumn) case 'numeric': $tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']); - if (preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['complete_type'], $match)) { + if ( + preg_match( + '([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', + $tableColumn['complete_type'], + $match + ) === 1 + ) { $precision = $match[1]; $scale = $match[2]; $length = null; @@ -455,7 +439,13 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; } - if ($tableColumn['default'] && preg_match("('([^']+)'::)", $tableColumn['default'], $match)) { + if ( + $tableColumn['default'] !== null && preg_match( + "('([^']+)'::)", + $tableColumn['default'], + $match + ) === 1 + ) { $tableColumn['default'] = $match[1]; } @@ -479,7 +469,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $column->setPlatformOption('collation', $tableColumn['collation']); } - if (in_array($column->getType()->getName(), [Types::JSON_ARRAY, Types::JSON], true)) { + if ($column->getType()->getName() === Types::JSON) { $column->setPlatformOption('jsonb', $jsonb); } @@ -522,10 +512,10 @@ public function listTableDetails($name): Table $table = parent::listTableDetails($name); $platform = $this->_platform; - assert($platform instanceof PostgreSqlPlatform); + assert($platform instanceof PostgreSQL94Platform); $sql = $platform->getListTableMetadataSQL($name); - $tableOptions = $this->_conn->fetchAssoc($sql); + $tableOptions = $this->_conn->fetchAssociative($sql); if ($tableOptions !== false) { $table->addOption('comment', $tableOptions['table_comment']); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php similarity index 81% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php rename to doctrine/dbal/src/Schema/SQLServerSchemaManager.php index 63dc9b04f..a33bd45c0 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php +++ b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php @@ -2,16 +2,13 @@ namespace Doctrine\DBAL\Schema; -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Driver\Exception; -use Doctrine\DBAL\Platforms\SQLServerPlatform; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\SQLServer2012Platform; use Doctrine\DBAL\Types\Type; use PDOException; -use Throwable; use function assert; use function count; -use function in_array; use function is_string; use function preg_match; use function sprintf; @@ -24,35 +21,6 @@ */ class SQLServerSchemaManager extends AbstractSchemaManager { - /** - * {@inheritdoc} - */ - public function dropDatabase($database) - { - try { - parent::dropDatabase($database); - } catch (DBALException $exception) { - $exception = $exception->getPrevious(); - assert($exception instanceof Throwable); - - if (! $exception instanceof Exception) { - throw $exception; - } - - // If we have a error code 3702, the drop database operation failed - // because of active connections on the database. - // To force dropping the database, we first have to close all active connections - // on that database and issue the drop database operation again. - if ($exception->getErrorCode() !== 3702) { - throw $exception; - } - - $this->closeActiveDatabaseConnections($database); - - parent::dropDatabase($database); - } - } - /** * {@inheritdoc} */ @@ -107,7 +75,6 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); $options = [ - 'length' => $length === 0 || ! in_array($type, ['text', 'string']) ? null : $length, 'unsigned' => false, 'fixed' => (bool) $fixed, 'default' => $default, @@ -118,6 +85,10 @@ protected function _getPortableTableColumnDefinition($tableColumn) 'comment' => $tableColumn['comment'] !== '' ? $tableColumn['comment'] : null, ]; + if ($length !== 0 && ($type === 'text' || $type === 'string')) { + $options['length'] = $length; + } + $column = new Column($tableColumn['name'], Type::getType($type), $options); if (isset($tableColumn['collation']) && $tableColumn['collation'] !== 'NULL') { @@ -137,7 +108,7 @@ private function parseDefaultExpression(string $value): ?string return null; } - if (preg_match('/^\'(.*)\'$/s', $value, $matches)) { + if (preg_match('/^\'(.*)\'$/s', $value, $matches) === 1) { $value = str_replace("''", "'", $matches[1]); } @@ -258,7 +229,7 @@ public function listTableIndexes($table) } throw $e; - } catch (DBALException $e) { + } catch (Exception $e) { if (strpos($e->getMessage(), 'SQLSTATE [01000, 15472]') === 0) { return []; } @@ -278,7 +249,7 @@ public function alterTable(TableDiff $tableDiff) foreach ($tableDiff->removedColumns as $col) { $columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName()); foreach ($this->_conn->fetchAllAssociative($columnConstraintSql) as $constraint) { - $this->_conn->exec( + $this->_conn->executeStatement( sprintf( 'ALTER TABLE %s DROP CONSTRAINT %s', $tableDiff->name, @@ -311,36 +282,17 @@ private function getColumnConstraintSQL($table, $column) ORDER BY Col.[Name]'; } - /** - * Closes currently active connections on the given database. - * - * This is useful to force DROP DATABASE operations which could fail because of active connections. - * - * @param string $database The name of the database to close currently active connections for. - * - * @return void - */ - private function closeActiveDatabaseConnections($database) - { - $database = new Identifier($database); - - $this->_execSql( - sprintf( - 'ALTER DATABASE %s SET SINGLE_USER WITH ROLLBACK IMMEDIATE', - $database->getQuotedName($this->_platform) - ) - ); - } - /** * @param string $name + * + * @throws Exception */ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); $platform = $this->_platform; - assert($platform instanceof SQLServerPlatform); + assert($platform instanceof SQLServer2012Platform); $sql = $platform->getListTableMetadataSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php b/doctrine/dbal/src/Schema/Schema.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php rename to doctrine/dbal/src/Schema/Schema.php index 24fc47b59..08eb26833 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php +++ b/doctrine/dbal/src/Schema/Schema.php @@ -58,6 +58,8 @@ class Schema extends AbstractAsset * @param Table[] $tables * @param Sequence[] $sequences * @param string[] $namespaces + * + * @throws SchemaException */ public function __construct( array $tables = [], @@ -70,7 +72,7 @@ public function __construct( } $this->_schemaConfig = $schemaConfig; - $this->_setName($schemaConfig->getName() ?: 'public'); + $this->_setName($schemaConfig->getName() ?? 'public'); foreach ($namespaces as $namespace) { $this->createNamespace($namespace); @@ -316,6 +318,8 @@ public function createNamespace($name) * @param string $name * * @return Table + * + * @throws SchemaException */ public function createTable($name) { @@ -336,6 +340,8 @@ public function createTable($name) * @param string $newName * * @return Schema + * + * @throws SchemaException */ public function renameTable($oldName, $newName) { @@ -354,6 +360,8 @@ public function renameTable($oldName, $newName) * @param string $name * * @return Schema + * + * @throws SchemaException */ public function dropTable($name) { @@ -372,6 +380,8 @@ public function dropTable($name) * @param int $initialValue * * @return Sequence + * + * @throws SchemaException */ public function createSequence($name, $allocationSize = 1, $initialValue = 1) { @@ -422,6 +432,8 @@ public function toDropSql(AbstractPlatform $platform) /** * @return string[] + * + * @throws SchemaException */ public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) { @@ -433,6 +445,8 @@ public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) /** * @return string[] + * + * @throws SchemaException */ public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform) { diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaConfig.php b/doctrine/dbal/src/Schema/SchemaConfig.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaConfig.php rename to doctrine/dbal/src/Schema/SchemaConfig.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaDiff.php b/doctrine/dbal/src/Schema/SchemaDiff.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaDiff.php rename to doctrine/dbal/src/Schema/SchemaDiff.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php b/doctrine/dbal/src/Schema/SchemaException.php similarity index 90% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php rename to doctrine/dbal/src/Schema/SchemaException.php index 64f4b250a..d4e22380e 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php +++ b/doctrine/dbal/src/Schema/SchemaException.php @@ -22,7 +22,8 @@ class SchemaException extends Exception public const SEQUENCE_ALREADY_EXISTS = 80; public const INDEX_INVALID_NAME = 90; public const FOREIGNKEY_DOESNT_EXIST = 100; - public const NAMESPACE_ALREADY_EXISTS = 110; + public const CONSTRAINT_DOESNT_EXIST = 110; + public const NAMESPACE_ALREADY_EXISTS = 120; /** * @param string $tableName @@ -146,6 +147,20 @@ public static function sequenceDoesNotExist($name) return new self("There exists no sequence with the name '" . $name . "'.", self::SEQUENCE_DOENST_EXIST); } + /** + * @param string $constraintName + * @param string $table + * + * @return SchemaException + */ + public static function uniqueConstraintDoesNotExist($constraintName, $table) + { + return new self( + sprintf('There exists no unique constraint with the name "%s" on table "%s".', $constraintName, $table), + self::CONSTRAINT_DOESNT_EXIST + ); + } + /** * @param string $fkName * @param string $table diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Sequence.php b/doctrine/dbal/src/Schema/Sequence.php similarity index 90% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Sequence.php rename to doctrine/dbal/src/Schema/Sequence.php index 1cba86c08..1a48def86 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Sequence.php +++ b/doctrine/dbal/src/Schema/Sequence.php @@ -66,7 +66,11 @@ public function getCache() */ public function setAllocationSize($allocationSize) { - $this->allocationSize = (int) $allocationSize ?: 1; + if ($allocationSize > 0) { + $this->allocationSize = (int) $allocationSize; + } else { + $this->allocationSize = 1; + } return $this; } @@ -78,7 +82,11 @@ public function setAllocationSize($allocationSize) */ public function setInitialValue($initialValue) { - $this->initialValue = (int) $initialValue ?: 1; + if ($initialValue > 0) { + $this->initialValue = (int) $initialValue; + } else { + $this->initialValue = 1; + } return $this; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/doctrine/dbal/src/Schema/SqliteSchemaManager.php similarity index 95% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php rename to doctrine/dbal/src/Schema/SqliteSchemaManager.php index de7b13750..857f90b05 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/doctrine/dbal/src/Schema/SqliteSchemaManager.php @@ -123,7 +123,7 @@ public function listTableForeignKeys($table, $database = null) $createSql = $this->getCreateTableSQL($table); if ( - $createSql !== null && preg_match_all( + preg_match_all( '# (?:CONSTRAINT\s+([^\s]+)\s+)? (?:FOREIGN\s+KEY[^\)]+\)\s*)? @@ -135,7 +135,7 @@ public function listTableForeignKeys($table, $database = null) )?#isx', $createSql, $match - ) + ) > 0 ) { $names = array_reverse($match[1]); $deferrable = array_reverse($match[2]); @@ -228,21 +228,6 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null return parent::_getPortableTableIndexesList($indexBuffer, $tableName); } - /** - * @deprecated - * - * @param array $tableIndex - * - * @return array - */ - protected function _getPortableTableIndexDefinition($tableIndex) - { - return [ - 'name' => $tableIndex['name'], - 'unique' => (bool) $tableIndex['unique'], - ]; - } - /** * {@inheritdoc} */ @@ -278,7 +263,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) } // inspect column collation and comments - $createSql = $this->getCreateTableSQL($table) ?? ''; + $createSql = $this->getCreateTableSQL($table); foreach ($list as $columnName => $column) { $type = $column->getType(); @@ -286,7 +271,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) if ($type instanceof StringType || $type instanceof TextType) { $column->setPlatformOption( 'collation', - $this->parseColumnCollationFromSQL($columnName, $createSql) ?: 'BINARY' + $this->parseColumnCollationFromSQL($columnName, $createSql) ?? 'BINARY' ); } @@ -340,7 +325,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) if ($default !== null) { // SQLite returns the default value as a literal expression, so we need to parse it - if (preg_match('/^\'(.*)\'$/s', $default, $matches)) { + if (preg_match('/^\'(.*)\'$/s', $default, $matches) === 1) { $default = str_replace("''", "'", $matches[1]); } } @@ -523,9 +508,12 @@ private function parseColumnCommentFromSQL(string $column, string $sql): ?string return $comment === '' ? null : $comment; } - private function getCreateTableSQL(string $table): ?string + /** + * @throws Exception + */ + private function getCreateTableSQL(string $table): string { - return $this->_conn->fetchColumn( + $sql = $this->_conn->fetchOne( <<<'SQL' SELECT sql FROM ( @@ -540,17 +528,25 @@ private function getCreateTableSQL(string $table): ?string SQL , [$table] - ) ?: null; + ); + + if ($sql !== false) { + return $sql; + } + + return ''; } /** + * {@inheritDoc} + * * @param string $name */ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); - $tableCreateSql = $this->getCreateTableSQL($name) ?? ''; + $tableCreateSql = $this->getCreateTableSQL($name); $comment = $this->parseTableCommentFromSQL($name, $tableCreateSql); diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php b/doctrine/dbal/src/Schema/Table.php similarity index 73% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php rename to doctrine/dbal/src/Schema/Table.php index d69dc45f1..181e5dec9 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Table.php +++ b/doctrine/dbal/src/Schema/Table.php @@ -3,12 +3,16 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Schema\Exception\InvalidTableName; use Doctrine\DBAL\Schema\Visitor\Visitor; use Doctrine\DBAL\Types\Type; use function array_filter; +use function array_keys; use function array_merge; use function in_array; +use function is_numeric; +use function is_string; use function preg_match; use function strlen; use function strtolower; @@ -23,14 +27,14 @@ class Table extends AbstractAsset /** @var Column[] */ protected $_columns = []; - /** @var Index[] */ - private $implicitIndexes = []; - /** @var Index[] */ protected $_indexes = []; - /** @var string|false */ - protected $_primaryKeyName = false; + /** @var string|null */ + protected $_primaryKeyName; + + /** @var UniqueConstraint[] */ + protected $uniqueConstraints = []; /** @var ForeignKeyConstraint[] */ protected $_fkConstraints = []; @@ -43,26 +47,29 @@ class Table extends AbstractAsset /** @var SchemaConfig|null */ protected $_schemaConfig; + /** @var Index[] */ + private $implicitIndexes = []; + /** - * @param string $name * @param Column[] $columns * @param Index[] $indexes + * @param UniqueConstraint[] $uniqueConstraints * @param ForeignKeyConstraint[] $fkConstraints - * @param int $idGeneratorType * @param mixed[] $options * + * @throws SchemaException * @throws Exception */ public function __construct( - $name, + string $name, array $columns = [], array $indexes = [], + array $uniqueConstraints = [], array $fkConstraints = [], - $idGeneratorType = 0, array $options = [] ) { - if (strlen($name) === 0) { - throw Exception::invalidTableName($name); + if ($name === '') { + throw InvalidTableName::new($name); } $this->_setName($name); @@ -75,6 +82,10 @@ public function __construct( $this->_addIndex($idx); } + foreach ($uniqueConstraints as $uniqueConstraint) { + $this->_addUniqueConstraint($uniqueConstraint); + } + foreach ($fkConstraints as $constraint) { $this->_addForeignKeyConstraint($constraint); } @@ -109,10 +120,16 @@ protected function _getMaxIdentifierLength() * @param string|false $indexName * * @return self + * + * @throws SchemaException */ public function setPrimaryKey(array $columnNames, $indexName = false) { - $this->_addIndex($this->_createIndex($columnNames, $indexName ?: 'primary', true, true)); + if ($indexName === false) { + $indexName = 'primary'; + } + + $this->_addIndex($this->_createIndex($columnNames, $indexName, true, true)); foreach ($columnNames as $columnName) { $column = $this->getColumn($columnName); @@ -123,14 +140,15 @@ public function setPrimaryKey(array $columnNames, $indexName = false) } /** - * @param string[] $columnNames - * @param string|null $indexName - * @param string[] $flags - * @param mixed[] $options + * @param string[] $columnNames + * @param string[] $flags + * @param mixed[] $options * * @return self + * + * @throws SchemaException */ - public function addIndex(array $columnNames, $indexName = null, array $flags = [], array $options = []) + public function addIndex(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []) { if ($indexName === null) { $indexName = $this->_generateIdentifierName( @@ -143,19 +161,45 @@ public function addIndex(array $columnNames, $indexName = null, array $flags = [ return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags, $options)); } + /** + * @param string[] $columnNames + * @param string[] $flags + * @param mixed[] $options + * + * @return self + */ + public function addUniqueConstraint( + array $columnNames, + ?string $indexName = null, + array $flags = [], + array $options = [] + ): Table { + if ($indexName === null) { + $indexName = $this->_generateIdentifierName( + array_merge([$this->getName()], $columnNames), + 'uniq', + $this->_getMaxIdentifierLength() + ); + } + + return $this->_addUniqueConstraint($this->_createUniqueConstraint($columnNames, $indexName, $flags, $options)); + } + /** * Drops the primary key from this table. * * @return void + * + * @throws SchemaException */ public function dropPrimaryKey() { - if ($this->_primaryKeyName === false) { + if ($this->_primaryKeyName === null) { return; } $this->dropIndex($this->_primaryKeyName); - $this->_primaryKeyName = false; + $this->_primaryKeyName = null; } /** @@ -170,6 +214,7 @@ public function dropPrimaryKey() public function dropIndex($name) { $name = $this->normalizeIdentifier($name); + if (! $this->hasIndex($name)) { throw SchemaException::indexDoesNotExist($name, $this->_name); } @@ -183,6 +228,8 @@ public function dropIndex($name) * @param mixed[] $options * * @return self + * + * @throws SchemaException */ public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) { @@ -281,7 +328,7 @@ private function _createIndex( array $flags = [], array $options = [] ) { - if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { + if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) { throw SchemaException::indexNameInvalid($indexName); } @@ -300,6 +347,8 @@ private function _createIndex( * @param mixed[] $options * * @return Column + * + * @throws SchemaException */ public function addColumn($name, $typeName, array $options = []) { @@ -310,25 +359,6 @@ public function addColumn($name, $typeName, array $options = []) return $column; } - /** - * Renames a Column. - * - * @deprecated - * - * @param string $oldName - * @param string $name - * - * @return void - * - * @throws Exception - */ - public function renameColumn($oldName, $name) - { - throw new Exception('Table#renameColumn() was removed, because it drops and recreates ' . - 'the column instead. There is no fix available, because a schema diff cannot reliably detect if a ' . - 'column was renamed or one column was created and another one dropped.'); - } - /** * Change Column Details. * @@ -336,6 +366,8 @@ public function renameColumn($oldName, $name) * @param mixed[] $options * * @return self + * + * @throws SchemaException */ public function changeColumn($name, array $options) { @@ -355,6 +387,7 @@ public function changeColumn($name, array $options) public function dropColumn($name) { $name = $this->normalizeIdentifier($name); + unset($this->_columns[$name]); return $this; @@ -369,77 +402,27 @@ public function dropColumn($name) * @param string[] $localColumnNames * @param string[] $foreignColumnNames * @param mixed[] $options - * @param string|null $constraintName + * @param string|null $name * * @return self + * + * @throws SchemaException */ public function addForeignKeyConstraint( $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], - $constraintName = null - ) { - $constraintName = $constraintName ?: $this->_generateIdentifierName( - array_merge((array) $this->getName(), $localColumnNames), - 'fk', - $this->_getMaxIdentifierLength() - ); - - return $this->addNamedForeignKeyConstraint( - $constraintName, - $foreignTable, - $localColumnNames, - $foreignColumnNames, - $options - ); - } - - /** - * Adds a foreign key constraint. - * - * Name is to be generated by the database itself. - * - * @deprecated Use {@link addForeignKeyConstraint} - * - * @param Table|string $foreignTable Table schema instance or table name - * @param string[] $localColumnNames - * @param string[] $foreignColumnNames - * @param mixed[] $options - * - * @return self - */ - public function addUnnamedForeignKeyConstraint( - $foreignTable, - array $localColumnNames, - array $foreignColumnNames, - array $options = [] + $name = null ) { - return $this->addForeignKeyConstraint($foreignTable, $localColumnNames, $foreignColumnNames, $options); - } + if ($name === null) { + $name = $this->_generateIdentifierName( + array_merge((array) $this->getName(), $localColumnNames), + 'fk', + $this->_getMaxIdentifierLength() + ); + } - /** - * Adds a foreign key constraint with a given name. - * - * @deprecated Use {@link addForeignKeyConstraint} - * - * @param string $name - * @param Table|string $foreignTable Table schema instance or table name - * @param string[] $localColumnNames - * @param string[] $foreignColumnNames - * @param mixed[] $options - * - * @return self - * - * @throws SchemaException - */ - public function addNamedForeignKeyConstraint( - $name, - $foreignTable, - array $localColumnNames, - array $foreignColumnNames, - array $options = [] - ) { if ($foreignTable instanceof Table) { foreach ($foreignColumnNames as $columnName) { if (! $foreignTable->hasColumn($columnName)) { @@ -461,9 +444,8 @@ public function addNamedForeignKeyConstraint( $name, $options ); - $this->_addForeignKeyConstraint($constraint); - return $this; + return $this->_addForeignKeyConstraint($constraint); } /** @@ -519,7 +501,7 @@ protected function _addIndex(Index $indexCandidate) if ( (isset($this->_indexes[$indexName]) && ! in_array($indexName, $replacedImplicitIndexes, true)) || - ($this->_primaryKeyName !== false && $indexCandidate->isPrimary()) + ($this->_primaryKeyName !== null && $indexCandidate->isPrimary()) ) { throw SchemaException::indexAlreadyExists($indexName, $this->_name); } @@ -538,17 +520,49 @@ protected function _addIndex(Index $indexCandidate) } /** - * @return void + * @return self + */ + protected function _addUniqueConstraint(UniqueConstraint $constraint): Table + { + $mergedNames = array_merge([$this->getName()], $constraint->getColumns()); + $name = strlen($constraint->getName()) > 0 + ? $constraint->getName() + : $this->_generateIdentifierName($mergedNames, 'fk', $this->_getMaxIdentifierLength()); + + $name = $this->normalizeIdentifier($name); + + $this->uniqueConstraints[$name] = $constraint; + + // If there is already an index that fulfills this requirements drop the request. In the case of __construct + // calling this method during hydration from schema-details all the explicitly added indexes lead to duplicates. + // This creates computation overhead in this case, however no duplicate indexes are ever added (column based). + $indexName = $this->_generateIdentifierName($mergedNames, 'idx', $this->_getMaxIdentifierLength()); + + $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, true, false); + + foreach ($this->_indexes as $existingIndex) { + if ($indexCandidate->isFullfilledBy($existingIndex)) { + return $this; + } + } + + $this->implicitIndexes[$this->normalizeIdentifier($indexName)] = $indexCandidate; + + return $this; + } + + /** + * @return self */ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) { $constraint->setLocalTable($this); - if (strlen($constraint->getName())) { + if (strlen($constraint->getName()) > 0) { $name = $constraint->getName(); } else { $name = $this->_generateIdentifierName( - array_merge((array) $this->getName(), $constraint->getLocalColumns()), + array_merge([$this->getName()], $constraint->getLocalColumns()), 'fk', $this->_getMaxIdentifierLength() ); @@ -575,12 +589,14 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) foreach ($this->_indexes as $existingIndex) { if ($indexCandidate->isFullfilledBy($existingIndex)) { - return; + return $this; } } $this->_addIndex($indexCandidate); $this->implicitIndexes[$this->normalizeIdentifier($indexName)] = $indexCandidate; + + return $this; } /** @@ -609,6 +625,7 @@ public function hasForeignKey($name) public function getForeignKey($name) { $name = $this->normalizeIdentifier($name); + if (! $this->hasForeignKey($name)) { throw SchemaException::foreignKeyDoesNotExist($name, $this->_name); } @@ -628,6 +645,7 @@ public function getForeignKey($name) public function removeForeignKey($name) { $name = $this->normalizeIdentifier($name); + if (! $this->hasForeignKey($name)) { throw SchemaException::foreignKeyDoesNotExist($name, $this->_name); } @@ -635,6 +653,48 @@ public function removeForeignKey($name) unset($this->_fkConstraints[$name]); } + /** + * Returns whether this table has a unique constraint with the given name. + */ + public function hasUniqueConstraint(string $name): bool + { + $name = $this->normalizeIdentifier($name); + + return isset($this->uniqueConstraints[$name]); + } + + /** + * Returns the unique constraint with the given name. + * + * @throws SchemaException If the unique constraint does not exist. + */ + public function getUniqueConstraint(string $name): UniqueConstraint + { + $name = $this->normalizeIdentifier($name); + + if (! $this->hasUniqueConstraint($name)) { + throw SchemaException::uniqueConstraintDoesNotExist($name, $this->_name); + } + + return $this->uniqueConstraints[$name]; + } + + /** + * Removes the unique constraint with the given name. + * + * @throws SchemaException If the unique constraint does not exist. + */ + public function removeUniqueConstraint(string $name): void + { + $name = $this->normalizeIdentifier($name); + + if (! $this->hasForeignKey($name)) { + throw SchemaException::uniqueConstraintDoesNotExist($name, $this->_name); + } + + unset($this->uniqueConstraints[$name]); + } + /** * Returns ordered list of columns (primary keys are first, then foreign keys, then the rest) * @@ -642,26 +702,27 @@ public function removeForeignKey($name) */ public function getColumns() { - $primaryKey = $this->getPrimaryKey(); - $primaryKeyColumns = []; - - if ($primaryKey !== null) { - $primaryKeyColumns = $this->filterColumns($primaryKey->getColumns()); - } + $primaryKeyColumns = $this->hasPrimaryKey() ? $this->getPrimaryKeyColumns() : []; + $foreignKeyColumns = $this->getForeignKeyColumns(); + $remainderColumns = $this->filterColumns( + array_merge(array_keys($primaryKeyColumns), array_keys($foreignKeyColumns)), + true + ); - return array_merge($primaryKeyColumns, $this->getForeignKeyColumns(), $this->_columns); + return array_merge($primaryKeyColumns, $foreignKeyColumns, $remainderColumns); } /** - * Returns foreign key columns + * Returns the foreign key columns * * @return Column[] */ - private function getForeignKeyColumns() + public function getForeignKeyColumns() { $foreignKeyColumns = []; + foreach ($this->getForeignKeys() as $foreignKey) { - $foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getColumns()); + $foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getLocalColumns()); } return $this->filterColumns($foreignKeyColumns); @@ -674,10 +735,10 @@ private function getForeignKeyColumns() * * @return Column[] */ - private function filterColumns(array $columnNames) + private function filterColumns(array $columnNames, bool $reverse = false): array { - return array_filter($this->_columns, static function ($columnName) use ($columnNames) { - return in_array($columnName, $columnNames, true); + return array_filter($this->_columns, static function ($columnName) use ($columnNames, $reverse): bool { + return in_array($columnName, $columnNames, true) !== $reverse; }, ARRAY_FILTER_USE_KEY); } @@ -707,6 +768,7 @@ public function hasColumn($name) public function getColumn($name) { $name = $this->normalizeIdentifier($name); + if (! $this->hasColumn($name)) { throw SchemaException::columnDoesNotExist($name, $this->_name); } @@ -721,7 +783,7 @@ public function getColumn($name) */ public function getPrimaryKey() { - if ($this->_primaryKeyName !== false) { + if ($this->_primaryKeyName !== null) { return $this->getIndex($this->_primaryKeyName); } @@ -731,7 +793,7 @@ public function getPrimaryKey() /** * Returns the primary key columns. * - * @return string[] + * @return Column[] * * @throws Exception */ @@ -743,7 +805,7 @@ public function getPrimaryKeyColumns() throw new Exception('Table ' . $this->getName() . ' has no primary key.'); } - return $primaryKey->getColumns(); + return $this->filterColumns($primaryKey->getColumns()); } /** @@ -753,7 +815,7 @@ public function getPrimaryKeyColumns() */ public function hasPrimaryKey() { - return $this->_primaryKeyName && $this->hasIndex($this->_primaryKeyName); + return $this->_primaryKeyName !== null && $this->hasIndex($this->_primaryKeyName); } /** @@ -797,6 +859,16 @@ public function getIndexes() return $this->_indexes; } + /** + * Returns the unique constraints. + * + * @return UniqueConstraint[] + */ + public function getUniqueConstraints(): array + { + return $this->uniqueConstraints; + } + /** * Returns the foreign key constraints. * @@ -837,6 +909,8 @@ public function getOptions() /** * @return void + * + * @throws SchemaException */ public function visit(Visitor $visitor) { @@ -876,16 +950,44 @@ public function __clone() } } + /** + * @param string[] $columnNames + * @param string[] $flags + * @param mixed[] $options + * + * @throws SchemaException + */ + private function _createUniqueConstraint( + array $columnNames, + string $indexName, + array $flags = [], + array $options = [] + ): UniqueConstraint { + if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) { + throw SchemaException::indexNameInvalid($indexName); + } + + foreach ($columnNames as $columnName => $indexColOptions) { + if (is_numeric($columnName) && is_string($indexColOptions)) { + $columnName = $indexColOptions; + } + + if (! $this->hasColumn($columnName)) { + throw SchemaException::columnDoesNotExist($columnName, $this->_name); + } + } + + return new UniqueConstraint($indexName, $columnNames, $flags, $options); + } + /** * Normalizes a given identifier. * * Trims quotes and lowercases the given identifier. * - * @param string|null $identifier The identifier to normalize. - * * @return string The normalized identifier. */ - private function normalizeIdentifier($identifier) + private function normalizeIdentifier(?string $identifier): string { if ($identifier === null) { return ''; diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/TableDiff.php b/doctrine/dbal/src/Schema/TableDiff.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/TableDiff.php rename to doctrine/dbal/src/Schema/TableDiff.php diff --git a/doctrine/dbal/src/Schema/UniqueConstraint.php b/doctrine/dbal/src/Schema/UniqueConstraint.php new file mode 100644 index 000000000..87a5f6e3b --- /dev/null +++ b/doctrine/dbal/src/Schema/UniqueConstraint.php @@ -0,0 +1,160 @@ + Identifier) + * + * @var Identifier[] + */ + protected $columns = []; + + /** + * Platform specific flags. + * array($flagName => true) + * + * @var true[] + */ + protected $flags = []; + + /** + * Platform specific options. + * + * @var mixed[] + */ + private $options = []; + + /** + * @param string[] $columns + * @param string[] $flags + * @param mixed[] $options + */ + public function __construct(string $name, array $columns, array $flags = [], array $options = []) + { + $this->_setName($name); + + $this->options = $options; + + foreach ($columns as $column) { + $this->addColumn($column); + } + + foreach ($flags as $flag) { + $this->addFlag($flag); + } + } + + /** + * {@inheritdoc} + */ + public function getColumns() + { + return array_keys($this->columns); + } + + /** + * {@inheritdoc} + */ + public function getQuotedColumns(AbstractPlatform $platform) + { + $columns = []; + + foreach ($this->columns as $column) { + $columns[] = $column->getQuotedName($platform); + } + + return $columns; + } + + /** + * @return string[] + */ + public function getUnquotedColumns(): array + { + return array_map([$this, 'trimQuotes'], $this->getColumns()); + } + + /** + * Returns platform specific flags for unique constraint. + * + * @return string[] + */ + public function getFlags(): array + { + return array_keys($this->flags); + } + + /** + * Adds flag for a unique constraint that translates to platform specific handling. + * + * @return $this + * + * @example $uniqueConstraint->addFlag('CLUSTERED') + */ + public function addFlag(string $flag): UniqueConstraint + { + $this->flags[strtolower($flag)] = true; + + return $this; + } + + /** + * Does this unique constraint have a specific flag? + */ + public function hasFlag(string $flag): bool + { + return isset($this->flags[strtolower($flag)]); + } + + /** + * Removes a flag. + */ + public function removeFlag(string $flag): void + { + unset($this->flags[strtolower($flag)]); + } + + /** + * Does this unique constraint have a specific option? + */ + public function hasOption(string $name): bool + { + return isset($this->options[strtolower($name)]); + } + + /** + * @return mixed + */ + public function getOption(string $name) + { + return $this->options[strtolower($name)]; + } + + /** + * @return mixed[] + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * Adds a new column to the unique constraint. + */ + protected function addColumn(string $column): void + { + $this->columns[$column] = new Identifier($column); + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/View.php b/doctrine/dbal/src/Schema/View.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/View.php rename to doctrine/dbal/src/Schema/View.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/AbstractVisitor.php b/doctrine/dbal/src/Schema/Visitor/AbstractVisitor.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/AbstractVisitor.php rename to doctrine/dbal/src/Schema/Visitor/AbstractVisitor.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php b/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php rename to doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php b/doctrine/dbal/src/Schema/Visitor/DropSchemaSqlCollector.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php rename to doctrine/dbal/src/Schema/Visitor/DropSchemaSqlCollector.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php b/doctrine/dbal/src/Schema/Visitor/Graphviz.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php rename to doctrine/dbal/src/Schema/Visitor/Graphviz.php index 841b7cbce..299ff0e7f 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php +++ b/doctrine/dbal/src/Schema/Visitor/Graphviz.php @@ -83,13 +83,15 @@ private function createTableLabel(Table $table) . '' . $columnLabel . '' . '' . '' - . '' . strtolower($column->getType()) . '' + . '' + . strtolower($column->getType()->getName()) + . '' . '' . ''; $primaryKey = $table->getPrimaryKey(); - if ($primaryKey !== null && in_array($column->getName(), $primaryKey->getColumns())) { + if ($primaryKey !== null && in_array($column->getName(), $primaryKey->getColumns(), true)) { $label .= "\xe2\x9c\xb7"; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php b/doctrine/dbal/src/Schema/Visitor/NamespaceVisitor.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php rename to doctrine/dbal/src/Schema/Visitor/NamespaceVisitor.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php b/doctrine/dbal/src/Schema/Visitor/RemoveNamespacedAssets.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php rename to doctrine/dbal/src/Schema/Visitor/RemoveNamespacedAssets.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php b/doctrine/dbal/src/Schema/Visitor/SchemaDiffVisitor.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php rename to doctrine/dbal/src/Schema/Visitor/SchemaDiffVisitor.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Visitor.php b/doctrine/dbal/src/Schema/Visitor/Visitor.php similarity index 88% rename from doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Visitor.php rename to doctrine/dbal/src/Schema/Visitor/Visitor.php index 05c842830..0b1c87d54 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Schema/Visitor/Visitor.php +++ b/doctrine/dbal/src/Schema/Visitor/Visitor.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; @@ -16,6 +17,8 @@ interface Visitor { /** * @return void + * + * @throws SchemaException */ public function acceptSchema(Schema $schema); @@ -31,6 +34,8 @@ public function acceptColumn(Table $table, Column $column); /** * @return void + * + * @throws SchemaException */ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint); diff --git a/doctrine/dbal/src/Statement.php b/doctrine/dbal/src/Statement.php new file mode 100644 index 000000000..d7a541a8d --- /dev/null +++ b/doctrine/dbal/src/Statement.php @@ -0,0 +1,196 @@ +Statement for the given SQL and Connection. + * + * @internal The statement can be only instantiated by {@link Connection}. + * + * @param string $sql The SQL of the statement. + * @param Connection $conn The connection on which the statement should be executed. + * + * @throws Exception + */ + public function __construct($sql, Connection $conn) + { + $driverConnection = $conn->getWrappedConnection(); + + try { + $stmt = $driverConnection->prepare($sql); + } catch (Exception $ex) { + throw $conn->convertExceptionDuringQuery($ex, $sql); + } + + $this->sql = $sql; + $this->stmt = $stmt; + $this->conn = $conn; + $this->platform = $conn->getDatabasePlatform(); + } + + /** + * Binds a parameter value to the statement. + * + * The value can optionally be bound with a DBAL mapping type. + * If bound with a DBAL mapping type, the binding type is derived from the mapping + * type and the value undergoes the conversion routines of the mapping type before + * being bound. + * + * @param string|int $param The name or position of the parameter. + * @param mixed $value The value of the parameter. + * @param mixed $type Either a PDO binding type or a DBAL mapping type name or instance. + * + * @return bool TRUE on success, FALSE on failure. + * + * @throws Exception + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + $this->params[$param] = $value; + $this->types[$param] = $type; + + $bindingType = ParameterType::STRING; + + if ($type !== null) { + if (is_string($type)) { + $type = Type::getType($type); + } + + $bindingType = $type; + + if ($type instanceof Type) { + $value = $type->convertToDatabaseValue($value, $this->platform); + $bindingType = $type->getBindingType(); + } + } + + try { + return $this->stmt->bindValue($param, $value, $bindingType); + } catch (Exception $e) { + throw $this->conn->convertException($e); + } + } + + /** + * Binds a parameter to a value by reference. + * + * Binding a parameter by reference does not support DBAL mapping types. + * + * @param string|int $param The name or position of the parameter. + * @param mixed $variable The reference to the variable to bind. + * @param int $type The binding type. + * @param int|null $length Must be specified when using an OUT bind + * so that PHP allocates enough memory to hold the returned value. + * + * @return bool TRUE on success, FALSE on failure. + * + * @throws Exception + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + $this->params[$param] = $variable; + $this->types[$param] = $type; + + try { + return $this->stmt->bindParam($param, $variable, $type, $length); + } catch (Exception $e) { + throw $this->conn->convertException($e); + } + } + + /** + * Executes the statement with the currently bound parameters. + * + * @param mixed[]|null $params + * + * @throws Exception + */ + public function execute($params = null): Result + { + if ($params !== null) { + $this->params = $params; + } + + $logger = $this->conn->getConfiguration()->getSQLLogger(); + if ($logger !== null) { + $logger->startQuery($this->sql, $this->params, $this->types); + } + + try { + return new Result( + $this->stmt->execute($params), + $this->conn + ); + } catch (Exception $ex) { + throw $this->conn->convertExceptionDuringQuery($ex, $this->sql, $this->params, $this->types); + } finally { + if ($logger !== null) { + $logger->stopQuery(); + } + } + } + + /** + * Gets the wrapped driver statement. + * + * @return DriverStatement + */ + public function getWrappedStatement() + { + return $this->stmt; + } +} diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php similarity index 65% rename from doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php rename to doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php index bd819af0e..a06e2d0f6 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php @@ -3,27 +3,20 @@ namespace Doctrine\DBAL\Tools\Console\Command; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\Keywords\DB2Keywords; use Doctrine\DBAL\Platforms\Keywords\KeywordList; +use Doctrine\DBAL\Platforms\Keywords\MariaDb102Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords; use Doctrine\DBAL\Platforms\Keywords\OracleKeywords; -use Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords; -use Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords; -use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords; +use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords; +use Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords; use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator; -use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords; -use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords; -use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords; -use Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords; use Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords; -use Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords; -use Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords; use Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords; -use Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords; use Doctrine\DBAL\Tools\Console\ConnectionProvider; -use Exception; use InvalidArgumentException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -36,48 +29,30 @@ use function implode; use function is_array; use function is_string; -use function trigger_error; - -use const E_USER_DEPRECATED; class ReservedWordsCommand extends Command { /** @var array> */ private $keywordListClasses = [ + 'db2' => DB2Keywords::class, 'mysql' => MySQLKeywords::class, 'mysql57' => MySQL57Keywords::class, 'mysql80' => MySQL80Keywords::class, - 'sqlserver' => SQLServerKeywords::class, - 'sqlserver2005' => SQLServer2005Keywords::class, - 'sqlserver2008' => SQLServer2008Keywords::class, - 'sqlserver2012' => SQLServer2012Keywords::class, - 'sqlite' => SQLiteKeywords::class, - 'pgsql' => PostgreSQLKeywords::class, - 'pgsql91' => PostgreSQL91Keywords::class, - 'pgsql92' => PostgreSQL92Keywords::class, + 'mariadb102' => MariaDb102Keywords::class, 'oracle' => OracleKeywords::class, - 'db2' => DB2Keywords::class, - 'sqlanywhere' => SQLAnywhereKeywords::class, - 'sqlanywhere11' => SQLAnywhere11Keywords::class, - 'sqlanywhere12' => SQLAnywhere12Keywords::class, - 'sqlanywhere16' => SQLAnywhere16Keywords::class, + 'pgsql' => PostgreSQL94Keywords::class, + 'pgsql100' => PostgreSQL100Keywords::class, + 'sqlite' => SQLiteKeywords::class, + 'sqlserver' => SQLServer2012Keywords::class, ]; - /** @var ConnectionProvider|null */ + /** @var ConnectionProvider */ private $connectionProvider; - public function __construct(?ConnectionProvider $connectionProvider = null) + public function __construct(ConnectionProvider $connectionProvider) { parent::__construct(); $this->connectionProvider = $connectionProvider; - if ($connectionProvider !== null) { - return; - } - - @trigger_error( - 'Not passing a connection provider as the first constructor argument is deprecated', - E_USER_DEPRECATED - ); } /** @@ -112,8 +87,8 @@ protected function configure() Checks if the current database contains tables and columns with names that are identifiers in this dialect or in other SQL dialects. -By default SQLite, MySQL, PostgreSQL, Microsoft SQL Server, Oracle -and SQL Anywhere keywords are checked: +By default SQLite, MySQL, PostgreSQL, Microsoft SQL Server and Oracle +keywords are checked: %command.full_name% @@ -127,18 +102,13 @@ protected function configure() * mysql * mysql57 * mysql80 + * mariadb102 * pgsql - * pgsql92 + * pgsql100 * sqlite * oracle * sqlserver - * sqlserver2005 - * sqlserver2008 * sqlserver2012 - * sqlanywhere - * sqlanywhere11 - * sqlanywhere12 - * sqlanywhere16 * db2 (Not checked by default) EOT ); @@ -146,6 +116,8 @@ protected function configure() /** * {@inheritdoc} + * + * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -159,24 +131,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $keywordLists = []; } - if (! $keywordLists) { - $keywordLists = [ - 'mysql', - 'mysql57', - 'mysql80', - 'pgsql', - 'pgsql92', - 'sqlite', - 'oracle', - 'sqlserver', - 'sqlserver2005', - 'sqlserver2008', - 'sqlserver2012', - 'sqlanywhere', - 'sqlanywhere11', - 'sqlanywhere12', - 'sqlanywhere16', - ]; + if (count($keywordLists) === 0) { + $keywordLists = array_keys($this->keywordListClasses); } $keywords = []; @@ -205,7 +161,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (count($violations) !== 0) { $output->write( 'There are ' . count($violations) . ' reserved keyword violations' - . ' in your database schema:', + . ' in your database schema:', true ); @@ -226,14 +182,6 @@ private function getConnection(InputInterface $input): Connection $connectionName = $input->getOption('connection'); assert(is_string($connectionName) || $connectionName === null); - if ($this->connectionProvider === null) { - if ($connectionName !== null) { - throw new Exception('Specifying a connection is only supported when a ConnectionProvider is used.'); - } - - return $this->getHelper('db')->getConnection(); - } - if ($connectionName !== null) { return $this->connectionProvider->getConnection($connectionName); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php similarity index 78% rename from doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php rename to doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php index f72538664..a4ba7d3bd 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php @@ -3,9 +3,9 @@ namespace Doctrine\DBAL\Tools\Console\Command; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Tools\Console\ConnectionProvider; use Doctrine\DBAL\Tools\Dumper; -use Exception; use LogicException; use RuntimeException; use Symfony\Component\Console\Command\Command; @@ -15,12 +15,10 @@ use Symfony\Component\Console\Output\OutputInterface; use function assert; +use function is_bool; use function is_numeric; use function is_string; use function stripos; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Task for executing arbitrary SQL that can come from a file or directly from @@ -28,21 +26,13 @@ */ class RunSqlCommand extends Command { - /** @var ConnectionProvider|null */ + /** @var ConnectionProvider */ private $connectionProvider; - public function __construct(?ConnectionProvider $connectionProvider = null) + public function __construct(ConnectionProvider $connectionProvider) { parent::__construct(); $this->connectionProvider = $connectionProvider; - if ($connectionProvider !== null) { - return; - } - - @trigger_error( - 'Not passing a connection provider as the first constructor argument is deprecated', - E_USER_DEPRECATED - ); } /** @return void */ @@ -68,6 +58,8 @@ protected function configure() /** * {@inheritdoc} + * + * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -87,7 +79,10 @@ protected function execute(InputInterface $input, OutputInterface $output) throw new LogicException("Option 'depth' must contains an integer value"); } - if (stripos($sql, 'select') === 0 || $input->getOption('force-fetch')) { + $forceFetch = $input->getOption('force-fetch'); + assert(is_bool($forceFetch)); + + if (stripos($sql, 'select') === 0 || $forceFetch) { $resultSet = $conn->fetchAllAssociative($sql); } else { $resultSet = $conn->executeStatement($sql); @@ -103,14 +98,6 @@ private function getConnection(InputInterface $input): Connection $connectionName = $input->getOption('connection'); assert(is_string($connectionName) || $connectionName === null); - if ($this->connectionProvider === null) { - if ($connectionName !== null) { - throw new Exception('Specifying a connection is only supported when a ConnectionProvider is used.'); - } - - return $this->getHelper('db')->getConnection(); - } - if ($connectionName !== null) { return $this->connectionProvider->getConnection($connectionName); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionNotFound.php b/doctrine/dbal/src/Tools/Console/ConnectionNotFound.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionNotFound.php rename to doctrine/dbal/src/Tools/Console/ConnectionNotFound.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider.php b/doctrine/dbal/src/Tools/Console/ConnectionProvider.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider.php rename to doctrine/dbal/src/Tools/Console/ConnectionProvider.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider/SingleConnectionProvider.php b/doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Tools/Console/ConnectionProvider/SingleConnectionProvider.php rename to doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php diff --git a/doctrine/dbal/src/Tools/Console/ConsoleRunner.php b/doctrine/dbal/src/Tools/Console/ConsoleRunner.php new file mode 100644 index 000000000..929981885 --- /dev/null +++ b/doctrine/dbal/src/Tools/Console/ConsoleRunner.php @@ -0,0 +1,76 @@ +setCatchExceptions(true); + self::addCommands($cli, $connectionProvider); + $cli->addCommands($commands); + $cli->run(); + } + + /** + * @return void + */ + public static function addCommands(Application $cli, ConnectionProvider $connectionProvider) + { + $cli->addCommands([ + new RunSqlCommand($connectionProvider), + new ReservedWordsCommand($connectionProvider), + ]); + } + + /** + * Prints the instructions to create a configuration file + * + * @return void + */ + public static function printCliConfigTemplate() + { + echo <<<'HELP' +You are missing a "cli-config.php" or "config/cli-config.php" file in your +project, which is required to get the Doctrine-DBAL Console working. You can use the +following sample as a template: + +getDateFormatString(), $value); - if (! $dateTime) { + if ($dateTime === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateIntervalType.php b/doctrine/dbal/src/Types/DateIntervalType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateIntervalType.php rename to doctrine/dbal/src/Types/DateIntervalType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php b/doctrine/dbal/src/Types/DateTimeImmutableType.php similarity index 95% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php rename to doctrine/dbal/src/Types/DateTimeImmutableType.php index 9af4fc349..fd7751977 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeImmutableType.php +++ b/doctrine/dbal/src/Types/DateTimeImmutableType.php @@ -51,11 +51,11 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $dateTime = DateTimeImmutable::createFromFormat($platform->getDateTimeFormatString(), $value); - if (! $dateTime) { + if ($dateTime === false) { $dateTime = date_create_immutable($value); } - if (! $dateTime) { + if ($dateTime === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php b/doctrine/dbal/src/Types/DateTimeType.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php rename to doctrine/dbal/src/Types/DateTimeType.php index f6f6da0ce..454295d71 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php +++ b/doctrine/dbal/src/Types/DateTimeType.php @@ -56,11 +56,11 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $val = DateTime::createFromFormat($platform->getDateTimeFormatString(), $value); - if (! $val) { + if ($val === false) { $val = date_create($value); } - if (! $val) { + if ($val === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php b/doctrine/dbal/src/Types/DateTimeTzImmutableType.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php rename to doctrine/dbal/src/Types/DateTimeTzImmutableType.php index b88862479..6e707e065 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php +++ b/doctrine/dbal/src/Types/DateTimeTzImmutableType.php @@ -49,7 +49,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $dateTime = DateTimeImmutable::createFromFormat($platform->getDateTimeTzFormatString(), $value); - if (! $dateTime) { + if ($dateTime === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzType.php b/doctrine/dbal/src/Types/DateTimeTzType.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzType.php rename to doctrine/dbal/src/Types/DateTimeTzType.php index bc25890b7..29672397f 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeTzType.php +++ b/doctrine/dbal/src/Types/DateTimeTzType.php @@ -53,7 +53,11 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) return $value->format($platform->getDateTimeTzFormatString()); } - throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']); + throw ConversionException::conversionFailedInvalidType( + $value, + $this->getName(), + ['null', 'DateTime'] + ); } /** @@ -66,7 +70,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) } $val = DateTime::createFromFormat($platform->getDateTimeTzFormatString(), $value); - if (! $val) { + if ($val === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php b/doctrine/dbal/src/Types/DateType.php similarity index 98% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php rename to doctrine/dbal/src/Types/DateType.php index 81cc86c56..6f86f5436 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php +++ b/doctrine/dbal/src/Types/DateType.php @@ -53,7 +53,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) } $val = DateTime::createFromFormat('!' . $platform->getDateFormatString(), $value); - if (! $val) { + if ($val === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/DecimalType.php b/doctrine/dbal/src/Types/DecimalType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/DecimalType.php rename to doctrine/dbal/src/Types/DecimalType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/FloatType.php b/doctrine/dbal/src/Types/FloatType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/FloatType.php rename to doctrine/dbal/src/Types/FloatType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/GuidType.php b/doctrine/dbal/src/Types/GuidType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/GuidType.php rename to doctrine/dbal/src/Types/GuidType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/IntegerType.php b/doctrine/dbal/src/Types/IntegerType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/IntegerType.php rename to doctrine/dbal/src/Types/IntegerType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/JsonType.php b/doctrine/dbal/src/Types/JsonType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/JsonType.php rename to doctrine/dbal/src/Types/JsonType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/ObjectType.php b/doctrine/dbal/src/Types/ObjectType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/ObjectType.php rename to doctrine/dbal/src/Types/ObjectType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpDateTimeMappingType.php b/doctrine/dbal/src/Types/PhpDateTimeMappingType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/PhpDateTimeMappingType.php rename to doctrine/dbal/src/Types/PhpDateTimeMappingType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/PhpIntegerMappingType.php b/doctrine/dbal/src/Types/PhpIntegerMappingType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/PhpIntegerMappingType.php rename to doctrine/dbal/src/Types/PhpIntegerMappingType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/SimpleArrayType.php b/doctrine/dbal/src/Types/SimpleArrayType.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/SimpleArrayType.php rename to doctrine/dbal/src/Types/SimpleArrayType.php index 5e3e73ce7..ee9c7f2df 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/SimpleArrayType.php +++ b/doctrine/dbal/src/Types/SimpleArrayType.php @@ -4,8 +4,10 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; +use function count; use function explode; use function implode; +use function is_array; use function is_resource; use function stream_get_contents; @@ -29,7 +31,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { - if (! $value) { + if (! is_array($value) || count($value) === 0) { return null; } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/SmallIntType.php b/doctrine/dbal/src/Types/SmallIntType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/SmallIntType.php rename to doctrine/dbal/src/Types/SmallIntType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/StringType.php b/doctrine/dbal/src/Types/StringType.php similarity index 74% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/StringType.php rename to doctrine/dbal/src/Types/StringType.php index 9a510effc..4e7bd55d0 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/StringType.php +++ b/doctrine/dbal/src/Types/StringType.php @@ -17,14 +17,6 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) return $platform->getVarcharTypeDeclarationSQL($column); } - /** - * {@inheritdoc} - */ - public function getDefaultLength(AbstractPlatform $platform) - { - return $platform->getVarcharDefaultLength(); - } - /** * {@inheritdoc} */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/TextType.php b/doctrine/dbal/src/Types/TextType.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/TextType.php rename to doctrine/dbal/src/Types/TextType.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeImmutableType.php b/doctrine/dbal/src/Types/TimeImmutableType.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/TimeImmutableType.php rename to doctrine/dbal/src/Types/TimeImmutableType.php index cc4376955..8d2c1517c 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeImmutableType.php +++ b/doctrine/dbal/src/Types/TimeImmutableType.php @@ -49,7 +49,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $dateTime = DateTimeImmutable::createFromFormat('!' . $platform->getTimeFormatString(), $value); - if (! $dateTime) { + if ($dateTime === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeType.php b/doctrine/dbal/src/Types/TimeType.php similarity index 98% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/TimeType.php rename to doctrine/dbal/src/Types/TimeType.php index 59bd7f75e..4f2c8c631 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/TimeType.php +++ b/doctrine/dbal/src/Types/TimeType.php @@ -53,7 +53,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) } $val = DateTime::createFromFormat('!' . $platform->getTimeFormatString(), $value); - if (! $val) { + if ($val === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/Type.php b/doctrine/dbal/src/Types/Type.php similarity index 70% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/Type.php rename to doctrine/dbal/src/Types/Type.php index f8be9131b..f86a423ea 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/Type.php +++ b/doctrine/dbal/src/Types/Type.php @@ -8,9 +8,6 @@ use function array_map; use function get_class; -use function str_replace; -use function strrpos; -use function substr; /** * The base class for so-called Doctrine mapping types. @@ -19,81 +16,6 @@ */ abstract class Type { - /** @deprecated Use {@see Types::BIGINT} instead. */ - public const BIGINT = Types::BIGINT; - - /** @deprecated Use {@see Types::BINARY} instead. */ - public const BINARY = Types::BINARY; - - /** @deprecated Use {@see Types::BLOB} instead. */ - public const BLOB = Types::BLOB; - - /** @deprecated Use {@see Types::BOOLEAN} instead. */ - public const BOOLEAN = Types::BOOLEAN; - - /** @deprecated Use {@see Types::DATE_MUTABLE} instead. */ - public const DATE = Types::DATE_MUTABLE; - - /** @deprecated Use {@see Types::DATE_IMMUTABLE} instead. */ - public const DATE_IMMUTABLE = Types::DATE_IMMUTABLE; - - /** @deprecated Use {@see Types::DATEINTERVAL} instead. */ - public const DATEINTERVAL = Types::DATEINTERVAL; - - /** @deprecated Use {@see Types::DATETIME_MUTABLE} instead. */ - public const DATETIME = Types::DATETIME_MUTABLE; - - /** @deprecated Use {@see Types::DATETIME_IMMUTABLE} instead. */ - public const DATETIME_IMMUTABLE = Types::DATETIME_IMMUTABLE; - - /** @deprecated Use {@see Types::DATETIMETZ_MUTABLE} instead. */ - public const DATETIMETZ = Types::DATETIMETZ_MUTABLE; - - /** @deprecated Use {@see Types::DATETIMETZ_IMMUTABLE} instead. */ - public const DATETIMETZ_IMMUTABLE = Types::DATETIMETZ_IMMUTABLE; - - /** @deprecated Use {@see Types::DECIMAL} instead. */ - public const DECIMAL = Types::DECIMAL; - - /** @deprecated Use {@see Types::FLOAT} instead. */ - public const FLOAT = Types::FLOAT; - - /** @deprecated Use {@see Types::GUID} instead. */ - public const GUID = Types::GUID; - - /** @deprecated Use {@see Types::INTEGER} instead. */ - public const INTEGER = Types::INTEGER; - - /** @deprecated Use {@see Types::JSON} instead. */ - public const JSON = Types::JSON; - - /** @deprecated Use {@see Types::JSON_ARRAY} instead. */ - public const JSON_ARRAY = Types::JSON_ARRAY; - - /** @deprecated Use {@see Types::OBJECT} instead. */ - public const OBJECT = Types::OBJECT; - - /** @deprecated Use {@see Types::SIMPLE_ARRAY} instead. */ - public const SIMPLE_ARRAY = Types::SIMPLE_ARRAY; - - /** @deprecated Use {@see Types::SMALLINT} instead. */ - public const SMALLINT = Types::SMALLINT; - - /** @deprecated Use {@see Types::STRING} instead. */ - public const STRING = Types::STRING; - - /** @deprecated Use {@see Types::ARRAY} instead. */ - public const TARRAY = Types::ARRAY; - - /** @deprecated Use {@see Types::TEXT} instead. */ - public const TEXT = Types::TEXT; - - /** @deprecated Use {@see Types::TIME_MUTABLE} instead. */ - public const TIME = Types::TIME_MUTABLE; - - /** @deprecated Use {@see Types::TIME_IMMUTABLE} instead. */ - public const TIME_IMMUTABLE = Types::TIME_IMMUTABLE; - /** * The map of supported doctrine mapping types. */ @@ -116,7 +38,6 @@ abstract class Type Types::GUID => GuidType::class, Types::INTEGER => IntegerType::class, Types::JSON => JsonType::class, - Types::JSON_ARRAY => JsonArrayType::class, Types::OBJECT => ObjectType::class, Types::SIMPLE_ARRAY => SimpleArrayType::class, Types::SMALLINT => SmallIntType::class, @@ -144,6 +65,8 @@ final public function __construct() * @param AbstractPlatform $platform The currently used database platform. * * @return mixed The database representation of the value. + * + * @throws ConversionException */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { @@ -158,24 +81,14 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) * @param AbstractPlatform $platform The currently used database platform. * * @return mixed The PHP representation of the value. + * + * @throws ConversionException */ public function convertToPHPValue($value, AbstractPlatform $platform) { return $value; } - /** - * Gets the default length of this type. - * - * @deprecated Rely on information provided by the platform instead. - * - * @return int|null - */ - public function getDefaultLength(AbstractPlatform $platform) - { - return null; - } - /** * Gets the SQL declaration snippet for a column of this type. * @@ -304,23 +217,6 @@ static function (Type $type): string { ); } - /** - * @deprecated Relying on string representation is discouraged and will be removed in DBAL 3.0. - * - * @return string - */ - public function __toString() - { - $type = static::class; - $position = strrpos($type, '\\'); - - if ($position !== false) { - $type = substr($type, $position); - } - - return str_replace('Type', '', $type); - } - /** * Does working with this column require SQL conversion functions? * diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/TypeRegistry.php b/doctrine/dbal/src/Types/TypeRegistry.php similarity index 100% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/TypeRegistry.php rename to doctrine/dbal/src/Types/TypeRegistry.php diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php b/doctrine/dbal/src/Types/Types.php similarity index 92% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php rename to doctrine/dbal/src/Types/Types.php index 3ca677942..56bf3f51c 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php +++ b/doctrine/dbal/src/Types/Types.php @@ -35,9 +35,6 @@ final class Types public const TIME_MUTABLE = 'time'; public const TIME_IMMUTABLE = 'time_immutable'; - /** @deprecated json_array type is deprecated, use {@see self::JSON} instead. */ - public const JSON_ARRAY = 'json_array'; - /** * @codeCoverageIgnore */ diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php b/doctrine/dbal/src/Types/VarDateTimeImmutableType.php similarity index 97% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php rename to doctrine/dbal/src/Types/VarDateTimeImmutableType.php index 23f8b572d..f4f5e3ec3 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php +++ b/doctrine/dbal/src/Types/VarDateTimeImmutableType.php @@ -51,7 +51,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $dateTime = date_create_immutable($value); - if (! $dateTime) { + if ($dateTime === false) { throw ConversionException::conversionFailed($value, $this->getName()); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php b/doctrine/dbal/src/Types/VarDateTimeType.php similarity index 96% rename from doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php rename to doctrine/dbal/src/Types/VarDateTimeType.php index 20960579a..b11ef2871 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php +++ b/doctrine/dbal/src/Types/VarDateTimeType.php @@ -26,7 +26,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) } $val = date_create($value); - if (! $val) { + if ($val === false) { throw ConversionException::conversionFailed($value, $this->getName()); } diff --git a/doctrine/dbal/lib/Doctrine/DBAL/VersionAwarePlatformDriver.php b/doctrine/dbal/src/VersionAwarePlatformDriver.php similarity index 94% rename from doctrine/dbal/lib/Doctrine/DBAL/VersionAwarePlatformDriver.php rename to doctrine/dbal/src/VersionAwarePlatformDriver.php index 8bdae9264..b3ec8b843 100644 --- a/doctrine/dbal/lib/Doctrine/DBAL/VersionAwarePlatformDriver.php +++ b/doctrine/dbal/src/VersionAwarePlatformDriver.php @@ -12,7 +12,7 @@ * This interface should be implemented by drivers that are capable to do this * distinction. */ -interface VersionAwarePlatformDriver +interface VersionAwarePlatformDriver extends Driver { /** * Factory method for creating the appropriate platform instance for the given version. diff --git a/symfony/polyfill-intl-grapheme/Grapheme.php b/symfony/polyfill-intl-grapheme/Grapheme.php index 388a1f107..b42df8e57 100644 --- a/symfony/polyfill-intl-grapheme/Grapheme.php +++ b/symfony/polyfill-intl-grapheme/Grapheme.php @@ -11,7 +11,7 @@ namespace Symfony\Polyfill\Intl\Grapheme; -\define('SYMFONY_GRAPHEME_CLUSTER_RX', PCRE_VERSION >= '8.32' ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX); +\define('SYMFONY_GRAPHEME_CLUSTER_RX', \PCRE_VERSION >= '8.32' ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX); /** * Partial intl implementation in pure PHP. @@ -35,15 +35,15 @@ final class Grapheme { // (CRLF|([ZWNJ-ZWJ]|T+|L*(LV?V+|LV|LVT)T*|L+|[^Control])[Extend]*|[Control]) // This regular expression is a work around for http://bugs.exim.org/1279 - const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴교구궈궤귀규그긔기까깨꺄꺠꺼께껴꼐꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨끄끠끼나내냐냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴느늬니다대댜댸더데뎌뎨도돠돼되됴두둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴또똬뙈뙤뚀뚜뚸뛔뛰뜌뜨띄띠라래랴럐러레려례로롸뢔뢰료루뤄뤠뤼류르릐리마매먀먜머메며몌모뫄뫠뫼묘무뭐뭬뮈뮤므믜미바배뱌뱨버베벼볘보봐봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴뻐뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼쁘쁴삐사새샤섀서세셔셰소솨쇄쇠쇼수숴쉐쉬슈스싀시싸쌔쌰썌써쎄쎠쎼쏘쏴쐐쐬쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어에여예오와왜외요우워웨위유으의이자재쟈쟤저제져졔조좌좨죄죠주줘줴쥐쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴쬐쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체쳐쳬초촤쵀최쵸추춰췌취츄츠츼치카캐캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴큐크킈키타태탸턔터테텨톄토톼퇘퇴툐투퉈퉤튀튜트틔티파패퍄퍠퍼페펴폐포퐈퐤푀표푸풔풰퓌퓨프픠피하해햐햬허헤혀혜호화홰회효후훠훼휘휴흐희히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])'; + public const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴교구궈궤귀규그긔기까깨꺄꺠꺼께껴꼐꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨끄끠끼나내냐냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴느늬니다대댜댸더데뎌뎨도돠돼되됴두둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴또똬뙈뙤뚀뚜뚸뛔뛰뜌뜨띄띠라래랴럐러레려례로롸뢔뢰료루뤄뤠뤼류르릐리마매먀먜머메며몌모뫄뫠뫼묘무뭐뭬뮈뮤므믜미바배뱌뱨버베벼볘보봐봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴뻐뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼쁘쁴삐사새샤섀서세셔셰소솨쇄쇠쇼수숴쉐쉬슈스싀시싸쌔쌰썌써쎄쎠쎼쏘쏴쐐쐬쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어에여예오와왜외요우워웨위유으의이자재쟈쟤저제져졔조좌좨죄죠주줘줴쥐쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴쬐쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체쳐쳬초촤쵀최쵸추춰췌취츄츠츼치카캐캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴큐크킈키타태탸턔터테텨톄토톼퇘퇴툐투퉈퉤튀튜트틔티파패퍄퍠퍼페펴폐포퐈퐤푀표푸풔풰퓌퓨프픠피하해햐햬허헤혀혜호화홰회효후훠훼휘휴흐희히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])'; - public static function grapheme_extract($s, $size, $type = GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0) + public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0) { if (0 > $start) { $start = \strlen($s) + $start; } - if (!\is_scalar($s)) { + if (!is_scalar($s)) { $hasError = false; set_error_handler(function () use (&$hasError) { $hasError = true; }); $next = substr($s, $start); @@ -61,7 +61,15 @@ public static function grapheme_extract($s, $size, $type = GRAPHEME_EXTR_COUNT, $type = (int) $type; $start = (int) $start; - if (!isset($s[0]) || 0 > $size || 0 > $start || 0 > $type || 2 < $type) { + if (\GRAPHEME_EXTR_COUNT !== $type && \GRAPHEME_EXTR_MAXBYTES !== $type && \GRAPHEME_EXTR_MAXCHARS !== $type) { + if (80000 > \PHP_VERSION_ID) { + return false; + } + + throw new \ValueError('grapheme_extract(): Argument #3 ($type) must be one of GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS'); + } + + if (!isset($s[0]) || 0 > $size || 0 > $start) { return false; } if (0 === $size) { @@ -70,7 +78,7 @@ public static function grapheme_extract($s, $size, $type = GRAPHEME_EXTR_COUNT, $next = $start; - $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); if (!isset($s[1])) { return false; @@ -80,9 +88,9 @@ public static function grapheme_extract($s, $size, $type = GRAPHEME_EXTR_COUNT, $ret = ''; do { - if (GRAPHEME_EXTR_COUNT === $type) { + if (\GRAPHEME_EXTR_COUNT === $type) { --$size; - } elseif (GRAPHEME_EXTR_MAXBYTES === $type) { + } elseif (\GRAPHEME_EXTR_MAXBYTES === $type) { $size -= \strlen($s[$i]); } else { $size -= iconv_strlen($s[$i], 'UTF-8//IGNORE'); @@ -181,7 +189,7 @@ public static function grapheme_strstr($s, $needle, $beforeNeedle = false) private static function grapheme_position($s, $needle, $offset, $mode) { $needle = (string) $needle; - if (!preg_match('/./us', $needle)) { + if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) { return false; } $s = (string) $s; @@ -205,13 +213,25 @@ private static function grapheme_position($s, $needle, $offset, $mode) } } - switch ($mode) { - case 0: $needle = iconv_strpos($s, $needle, 0, 'UTF-8'); break; - case 1: $needle = mb_stripos($s, $needle, 0, 'UTF-8'); break; - case 2: $needle = iconv_strrpos($s, $needle, 'UTF-8'); break; - default: $needle = mb_strripos($s, $needle, 0, 'UTF-8'); break; + // As UTF-8 is self-synchronizing, and we have ensured the strings are valid UTF-8, + // we can use normal binary string functions here. For case-insensitive searches, + // case fold the strings first. + $caseInsensitive = $mode & 1; + $reverse = $mode & 2; + if ($caseInsensitive) { + // Use the same case folding mode as mbstring does for mb_stripos(). + // Stick to SIMPLE case folding to avoid changing the length of the string, which + // might result in offsets being shifted. + $mode = \defined('MB_CASE_FOLD_SIMPLE') ? \MB_CASE_FOLD_SIMPLE : \MB_CASE_UPPER; + $s = mb_convert_case($s, $mode, 'UTF-8'); + $needle = mb_convert_case($needle, $mode, 'UTF-8'); + } + if ($reverse) { + $needlePos = strrpos($s, $needle); + } else { + $needlePos = strpos($s, $needle); } - return false !== $needle ? self::grapheme_strlen(iconv_substr($s, 0, $needle, 'UTF-8')) + $offset : false; + return false !== $needlePos ? self::grapheme_strlen(substr($s, 0, $needlePos)) + $offset : false; } } diff --git a/symfony/polyfill-intl-grapheme/bootstrap.php b/symfony/polyfill-intl-grapheme/bootstrap.php index 1a44b21ed..a9ea03c7e 100644 --- a/symfony/polyfill-intl-grapheme/bootstrap.php +++ b/symfony/polyfill-intl-grapheme/bootstrap.php @@ -15,6 +15,10 @@ return; } +if (\PHP_VERSION_ID >= 80000) { + return require __DIR__.'/bootstrap80.php'; +} + if (!defined('GRAPHEME_EXTR_COUNT')) { define('GRAPHEME_EXTR_COUNT', 0); } @@ -26,13 +30,13 @@ } if (!function_exists('grapheme_extract')) { - function grapheme_extract($haystack, $size, $extract_type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $extract_type, $start, $next); } + function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); } } if (!function_exists('grapheme_stripos')) { function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); } } if (!function_exists('grapheme_stristr')) { - function grapheme_stristr($haystack, $needle, $before_needle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $before_needle); } + function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); } } if (!function_exists('grapheme_strlen')) { function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); } @@ -47,8 +51,8 @@ function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme: function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); } } if (!function_exists('grapheme_strstr')) { - function grapheme_strstr($haystack, $needle, $before_needle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $before_needle); } + function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); } } if (!function_exists('grapheme_substr')) { - function grapheme_substr($string, $start, $length = null) { return p\Grapheme::grapheme_substr($string, $start, $length); } + function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); } } diff --git a/symfony/polyfill-intl-grapheme/bootstrap80.php b/symfony/polyfill-intl-grapheme/bootstrap80.php new file mode 100644 index 000000000..e144d5b06 --- /dev/null +++ b/symfony/polyfill-intl-grapheme/bootstrap80.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Grapheme as p; + +if (!defined('GRAPHEME_EXTR_COUNT')) { + define('GRAPHEME_EXTR_COUNT', 0); +} +if (!defined('GRAPHEME_EXTR_MAXBYTES')) { + define('GRAPHEME_EXTR_MAXBYTES', 1); +} +if (!defined('GRAPHEME_EXTR_MAXCHARS')) { + define('GRAPHEME_EXTR_MAXCHARS', 2); +} + +if (!function_exists('grapheme_extract')) { + function grapheme_extract(string $haystack, int $size, int $type = GRAPHEME_EXTR_COUNT, int $offset = 0, &$next = null): string|false { return p\Grapheme::grapheme_extract($haystack, $size, $type, $offset, $next); } +} +if (!function_exists('grapheme_stripos')) { + function grapheme_stripos(string $haystack, string $needle, int $offset = 0): int|false { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); } +} +if (!function_exists('grapheme_stristr')) { + function grapheme_stristr(string $haystack, string $needle, bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); } +} +if (!function_exists('grapheme_strlen')) { + function grapheme_strlen(string $string): int|false|null { return p\Grapheme::grapheme_strlen($string); } +} +if (!function_exists('grapheme_strpos')) { + function grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); } +} +if (!function_exists('grapheme_strripos')) { + function grapheme_strripos(string $haystack, string $needle, int $offset = 0): int|false { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); } +} +if (!function_exists('grapheme_strrpos')) { + function grapheme_strrpos(string $haystack, string $needle, int $offset = 0): int|false { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); } +} +if (!function_exists('grapheme_strstr')) { + function grapheme_strstr(string $haystack, string $needle, bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); } +} +if (!function_exists('grapheme_substr')) { + function grapheme_substr(string $string, int $offset, int $length = null): string|false { return p\Grapheme::grapheme_substr($string, $offset, $length); } +} diff --git a/symfony/polyfill-intl-grapheme/composer.json b/symfony/polyfill-intl-grapheme/composer.json index 4d0bcb782..5ca4e3b95 100644 --- a/symfony/polyfill-intl-grapheme/composer.json +++ b/symfony/polyfill-intl-grapheme/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill",