diff --git a/Store/PdoStore.php b/Store/PdoStore.php index 22aec6b..4de05b4 100644 --- a/Store/PdoStore.php +++ b/Store/PdoStore.php @@ -267,7 +267,11 @@ public function createTable(): void $table->setPrimaryKey([$this->idCol]); foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { - $conn->exec($sql); + if (method_exists($conn, 'executeStatement')) { + $conn->executeStatement($sql); + } else { + $conn->exec($sql); + } } return; @@ -293,7 +297,11 @@ public function createTable(): void throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver)); } - $conn->exec($sql); + if (method_exists($conn, 'executeStatement')) { + $conn->executeStatement($sql); + } else { + $conn->exec($sql); + } } /** @@ -303,7 +311,12 @@ private function prune(): void { $sql = "DELETE FROM $this->table WHERE $this->expirationCol <= {$this->getCurrentTimestampStatement()}"; - $this->getConnection()->exec($sql); + $conn = $this->getConnection(); + if (method_exists($conn, 'executeStatement')) { + $conn->executeStatement($sql); + } else { + $conn->exec($sql); + } } private function getDriver(): string