From 93ca6e2546ff5008f6c7fd842c9db76fd4fc53fd Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 27 Nov 2019 16:45:09 -0800 Subject: [PATCH 1/5] Allow build failures for unstable dependencies --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index cc516636cda..6a6520c74f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -336,3 +336,6 @@ jobs: install: - composer config minimum-stability dev - travis_retry composer update --prefer-dist + + allow_failures: + - env: DEPENDENCIES=dev From 090014e1781b1d9ccd52302707c187ce5c3b88d2 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Dec 2019 01:24:03 +0100 Subject: [PATCH 2/5] [GH-3777] Keep using dependencies that were stable during 2.10 branch off. --- .appveyor.yml | 1 - .travis.yml | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a7fe2f1cb06..a61ba24ef67 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -117,7 +117,6 @@ install: } # install composer dependencies - cd C:\projects\dbal - - rm composer.lock - appveyor-retry composer self-update - appveyor-retry composer install --no-progress --prefer-dist diff --git a/.travis.yml b/.travis.yml index 6a6520c74f5..cac4d984d59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,7 @@ before_script: - if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; install: - - rm composer.lock - - travis_retry composer -n update --prefer-dist + - travis_retry composer -n install --prefer-dist script: - | From e359383f71379d533fba584c9f701a90e40d7795 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Dec 2019 15:53:28 +0100 Subject: [PATCH 3/5] [GH-3777] Also need to fix .appveyor.yml based on eb3b1b3 --- .appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a61ba24ef67..352719e2617 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -49,7 +49,7 @@ install: - ps: | # Check if installation is cached if (!(Test-Path c:\tools\php)) { - appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version 7.3.12 # install sqlite appveyor-retry cinst -y sqlite Get-ChildItem -Path c:\tools\php @@ -68,7 +68,8 @@ install: Add-Content php.ini "`n extension=php_curl.dll" Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem" - $DLLVersion = "5.5.0preview" + # Get and install the latest stable sqlsrv DLL's + $DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/sqlsrv/stable.txt").Content cd c:\tools\php\ext $source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip" $destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip" From 9f4d9a5b59fbc00a9b37a4d26dbc6829e82d31bd Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Tue, 19 Nov 2019 21:11:36 +0300 Subject: [PATCH 4/5] Fix breaks named parameters in OCI8Statement --- .../DBAL/Driver/OCI8/OCI8Statement.php | 14 +++++++--- .../Functional/Driver/OCI8/StatementTest.php | 26 ++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php index c974bf8fc7f..2f8b9323817 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php @@ -276,9 +276,15 @@ public function bindValue($param, $value, $type = ParameterType::STRING) /** * {@inheritdoc} */ - public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) { - $column = $this->_paramMap[$column]; + if (is_int($param)) { + if (! isset($this->_paramMap[$param])) { + throw new OCI8Exception(sprintf('Could not find variable mapping with index %d, in the SQL statement', $param)); + } + + $param = $this->_paramMap[$param]; + } if ($type === ParameterType::LARGE_OBJECT) { $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); @@ -291,11 +297,11 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l $variable =& $lob; } - $this->boundValues[$column] =& $variable; + $this->boundValues[$param] =& $variable; return oci_bind_by_name( $this->_sth, - $column, + $param, $variable, $length ?? -1, $this->convertParameterType($type) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php index 8ecbed68082..70f829e7b71 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php @@ -37,17 +37,41 @@ public function testQueryConversion(string $query, array $params, array $expecte ); } + /** + * Low-level approach to working with parameter binding + * + * @param mixed[] $params + * @param mixed[] $expected + * + * @dataProvider queryConversionProvider + */ + public function testStatementBindParameters(string $query, array $params, array $expected) : void + { + $stmt = $this->connection->prepare($query); + $stmt->execute($params); + + self::assertEquals( + $expected, + $stmt->fetch() + ); + } + /** * @return array> */ public static function queryConversionProvider() : iterable { return [ - 'simple' => [ + 'positional' => [ 'SELECT ? COL1 FROM DUAL', [1], ['COL1' => 1], ], + 'named' => [ + 'SELECT :COL COL1 FROM DUAL', + [':COL' => 1], + ['COL1' => 1], + ], 'literal-with-placeholder' => [ "SELECT '?' COL1, ? COL2 FROM DUAL", [2], From b5a71d178fb242756d6d4b0fc33c57ab6c09fc85 Mon Sep 17 00:00:00 2001 From: Marius Ghita Date: Mon, 23 Dec 2019 01:42:23 +0200 Subject: [PATCH 5/5] Remove superfluous Configuration instance A configuration instance is not strictly required by [DriverManager::getConnection](https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/DriverManager.php#L139). As an upside, it doesn't add an extra warning for people that use Psalm/PHPmd when starting off from the documentation example. As the Configuration class has an `@internal` block those tools threat it as the other meaning for `@internal`, as in class that is [internal to the library and not for public use](https://docs.phpdoc.org/references/phpdoc/tags/internal.html). --- docs/en/reference/configuration.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/en/reference/configuration.rst b/docs/en/reference/configuration.rst index 4fa8991ec33..5607c4b32f0 100644 --- a/docs/en/reference/configuration.rst +++ b/docs/en/reference/configuration.rst @@ -10,7 +10,6 @@ You can get a DBAL Connection through the .. code-block:: php 'mydb', @@ -19,19 +18,18 @@ You can get a DBAL Connection through the 'host' => 'localhost', 'driver' => 'pdo_mysql', ); - $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); Or, using the simpler URL form: .. code-block:: php 'mysql://user:secret@localhost/mydb', ); - $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); The ``DriverManager`` returns an instance of ``Doctrine\DBAL\Connection`` which is a wrapper around the