Skip to content

Commit

Permalink
Improve MSI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Mar 8, 2024
1 parent 58607a8 commit c8baf69
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ private function executeWithRetry(callable $callable, ...$params)
goto attempt;
}

$this->retriableConnection->resetAttemptCount();

/** @psalm-suppress PossiblyUndefinedVariable */
return $result;
}
Expand Down
30 changes: 30 additions & 0 deletions tests/Functional/ConnectionTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\PDO\MySQL\Driver as PDODriver;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\ParameterType;

class ConnectionTraitTest extends AbstractFunctionalTestCase
{
Expand Down Expand Up @@ -135,6 +136,35 @@ public function testShouldResetStatementOnStatementExecuteError(string $driver,
$this->assertConnectionCount(2, $connection);
}

/**
* @dataProvider driverDataProvider
*
* @param class-string<Driver> $driver
*/
public function testBindParamShouldRespectTypeWhenRecreatingStatement(string $driver, bool $enableSavepoints): void
{
$connection = $this->getConnectedConnection($driver, 1, $enableSavepoints);
$this->assertConnectionCount(1, $connection);

$statement = $connection->prepare("SELECT 'foo', ?, ?");
$statement->bindValue(1, 'bar');
$param = 1;
/** @psalm-suppress DeprecatedMethod */
$statement->bindParam(2, $param, ParameterType::INTEGER);
// change param by ref
$param = 2;
if (PDODriver::class === $driver) {
// PDO driver returns result always as string
$param = (string) $param;
}

$this->forceDisconnect($connection);
$result = $statement->executeQuery()->fetchAllNumeric();

$this->assertSame([['foo', 'bar', $param]], $result);
$this->assertConnectionCount(2, $connection);
}

/**
* @dataProvider driverDataProvider
*
Expand Down

0 comments on commit c8baf69

Please sign in to comment.