prooph / pdo-event-store

PDO implementation of ProophEventStore http://getprooph.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MariaDB / hasStream fails to detect existing Stream

aheissenberger opened this issue · comments

The comparing fails as $statement->fetchColumn() returns a Number:

public function hasStream(StreamName $streamName): bool
{
$sql = <<<EOT
SELECT COUNT(1) FROM `$this->eventStreamsTable`
WHERE real_stream_name = :streamName;
EOT;
$statement = $this->connection->prepare($sql);
try {
$statement->execute(['streamName' => $streamName->toString()]);
} catch (PDOException $exception) {
// ignore and check error code
}
if ($statement->errorCode() !== '00000') {
throw RuntimeException::fromStatementErrorInfo($statement->errorInfo());
}
return '1' === $statement->fetchColumn();
}

Problem is fixed in MySqlEventStore.php

return 1 === (int) $statement->fetchColumn();