"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Symfony/Component/Cache/Traits/PdoTrait.php" between
symfony-4.4.14.tar.gz and symfony-4.4.15.tar.gz

About: Symfony is a web application framework for PHP projects. Source code (4.4 series).

PdoTrait.php  (symfony-4.4.14):PdoTrait.php  (symfony-4.4.15)
skipping to change at line 14 skipping to change at line 14
* This file is part of the Symfony package. * This file is part of the Symfony package.
* *
* (c) Fabien Potencier <fabien@symfony.com> * (c) Fabien Potencier <fabien@symfony.com>
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Component\Cache\Traits; namespace Symfony\Component\Cache\Traits;
use Doctrine\DBAL\Abstraction\Result;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception\TableNotFoundException; use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\Marshaller\DefaultMarshaller; use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\MarshallerInterface; use Symfony\Component\Cache\Marshaller\MarshallerInterface;
/** /**
skipping to change at line 209 skipping to change at line 207
$sql = str_pad('', (\count($ids) << 1) - 1, '?,'); $sql = str_pad('', (\count($ids) << 1) - 1, '?,');
$sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $th is->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $thi s->table WHERE $this->idCol IN ($sql)"; $sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $th is->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $thi s->table WHERE $this->idCol IN ($sql)";
$stmt = $this->getConnection()->prepare($sql); $stmt = $this->getConnection()->prepare($sql);
$stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT);
foreach ($ids as $id) { foreach ($ids as $id) {
$stmt->bindValue(++$i, $id); $stmt->bindValue(++$i, $id);
} }
$result = $stmt->execute(); $result = $stmt->execute();
if ($result instanceof Result) { if (\is_object($result)) {
$result = $result->iterateNumeric(); $result = $result->iterateNumeric();
} else { } else {
$stmt->setFetchMode(\PDO::FETCH_NUM); $stmt->setFetchMode(\PDO::FETCH_NUM);
$result = $stmt; $result = $stmt;
} }
foreach ($result as $row) { foreach ($result as $row) {
if (null === $row[1]) { if (null === $row[1]) {
$expired[] = $row[0]; $expired[] = $row[0];
} else { } else {
skipping to change at line 248 skipping to change at line 246
*/ */
protected function doHave($id) protected function doHave($id)
{ {
$sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this-> lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)"; $sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this-> lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)";
$stmt = $this->getConnection()->prepare($sql); $stmt = $this->getConnection()->prepare($sql);
$stmt->bindValue(':id', $id); $stmt->bindValue(':id', $id);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT); $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
$result = $stmt->execute(); $result = $stmt->execute();
return (bool) ($result instanceof DriverResult ? $result->fetchOne() : $ stmt->fetchColumn()); return (bool) (\is_object($result) ? $result->fetchOne() : $stmt->fetchC olumn());
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doClear($namespace) protected function doClear($namespace)
{ {
$conn = $this->getConnection(); $conn = $this->getConnection();
if ('' === $namespace) { if ('' === $namespace) {
skipping to change at line 394 skipping to change at line 392
if (!$conn->isTransactionActive() || \in_array($this->driver, [' pgsql', 'sqlite', 'sqlsrv'], true)) { if (!$conn->isTransactionActive() || \in_array($this->driver, [' pgsql', 'sqlite', 'sqlsrv'], true)) {
$this->createTable(); $this->createTable();
} }
$result = $stmt->execute(); $result = $stmt->execute();
} catch (\PDOException $e) { } catch (\PDOException $e) {
if (!$conn->inTransaction() || \in_array($this->driver, ['pgsql' , 'sqlite', 'sqlsrv'], true)) { if (!$conn->inTransaction() || \in_array($this->driver, ['pgsql' , 'sqlite', 'sqlsrv'], true)) {
$this->createTable(); $this->createTable();
} }
$result = $stmt->execute(); $result = $stmt->execute();
} }
if (null === $driver && !($result instanceof DriverResult ? $result : $stmt)->rowCount()) { if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
try { try {
$insertStmt->execute(); $insertStmt->execute();
} catch (DBALException | Exception $e) { } catch (DBALException | Exception $e) {
} catch (\PDOException $e) { } catch (\PDOException $e) {
// A concurrent write won, let it be // A concurrent write won, let it be
} }
} }
} }
return $failed; return $failed;
 End of changes. 5 change blocks. 
5 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)